Added docs, makefile, and bugfix. - sprop - simple xprop replacement
 (HTM) git clone git://git.suckless.org/sprop
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 7fe59afa862d113f80dd178492e3a572af2cb881
 (DIR) parent 2aae9d8ed744b37d002871f2f001170b7cfa21bb
 (HTM) Author: Connor Lane Smith <cls@lubutu.com>
       Date:   Wed,  7 Apr 2010 12:33:13 +0000
       
       Added docs, makefile, and bugfix.
       Diffstat:
         A LICENSE                             |      21 +++++++++++++++++++++
         A Makefile                            |      54 +++++++++++++++++++++++++++++++
         A README                              |      24 ++++++++++++++++++++++++
         A config.mk                           |      23 +++++++++++++++++++++++
         A sprop.1                             |      23 +++++++++++++++++++++++
         M sprop.c                             |      20 +++++++++++++-------
       
       6 files changed, 158 insertions(+), 7 deletions(-)
       ---
 (DIR) diff --git a/LICENSE b/LICENSE
       @@ -0,0 +1,21 @@
       +MIT/X Consortium License
       +
       +© 2010 Connor Lane Smith <cls@lubutu.com>
       +
       +Permission is hereby granted, free of charge, to any person obtaining a
       +copy of this software and associated documentation files (the "Software"),
       +to deal in the Software without restriction, including without limitation
       +the rights to use, copy, modify, merge, publish, distribute, sublicense,
       +and/or sell copies of the Software, and to permit persons to whom the
       +Software is furnished to do so, subject to the following conditions:
       +
       +The above copyright notice and this permission notice shall be included in
       +all copies or substantial portions of the Software.
       +
       +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
       +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
       +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
       +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
       +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
       +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
       +DEALINGS IN THE SOFTWARE.
 (DIR) diff --git a/Makefile b/Makefile
       @@ -0,0 +1,54 @@
       +# sprop - simple X property utility
       +
       +include config.mk
       +
       +SRC = sprop.c
       +OBJ = ${SRC:.c=.o}
       +
       +all: options sprop
       +
       +options:
       +        @echo sprop build options:
       +        @echo "CFLAGS   = ${CFLAGS}"
       +        @echo "LDFLAGS  = ${LDFLAGS}"
       +        @echo "CC       = ${CC}"
       +
       +.c.o:
       +        @echo CC $<
       +        @${CC} -c ${CFLAGS} $<
       +
       +${OBJ}: config.mk
       +
       +sprop: ${OBJ}
       +        @echo CC -o $@
       +        @${CC} -o $@ ${OBJ} ${LDFLAGS}
       +
       +clean:
       +        @echo cleaning
       +        @rm -f sprop ${OBJ} sprop-${VERSION}.tar.gz
       +
       +dist: clean
       +        @echo creating dist tarball
       +        @mkdir -p sprop-${VERSION}
       +        @cp -R LICENSE Makefile README config.mk sprop.1 ${SRC} sprop-${VERSION}
       +        @tar -cf sprop-${VERSION}.tar sprop-${VERSION}
       +        @gzip sprop-${VERSION}.tar
       +        @rm -rf sprop-${VERSION}
       +
       +install: all
       +        @echo installing executable file to ${DESTDIR}${PREFIX}/bin
       +        @mkdir -p ${DESTDIR}${PREFIX}/bin
       +        @cp -f sprop ${DESTDIR}${PREFIX}/bin
       +        @chmod 755 ${DESTDIR}${PREFIX}/bin/sprop
       +        @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
       +        @mkdir -p ${DESTDIR}${MANPREFIX}/man1
       +        @sed "s/VERSION/${VERSION}/g" < sprop.1 > ${DESTDIR}${MANPREFIX}/man1/sprop.1
       +        @chmod 644 ${DESTDIR}${MANPREFIX}/man1/sprop.1
       +
       +uninstall:
       +        @echo removing executable file from ${DESTDIR}${PREFIX}/bin
       +        @rm -f ${DESTDIR}${PREFIX}/bin/sprop
       +        @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
       +        @rm -f ${DESTDIR}${MANPREFIX}/man1/sprop.1
       +
       +.PHONY: all options clean dist install uninstall
 (DIR) diff --git a/README b/README
       @@ -0,0 +1,24 @@
       +sprop - simple X property utility
       +=================================
       +Prints/sets window properties in an X server.
       +
       +
       +Requirements
       +------------
       +In order to build sprop you need the Xlib header files.
       +
       +
       +Installation
       +------------
       +Edit config.mk to match your local setup (sprop is installed into
       +the /usr/local namespace by default).
       +
       +Afterwards enter the following command to build and install sprop
       +(if necessary as root):
       +
       +    make clean install
       +
       +
       +Running sprop
       +--------------
       +See the man page for details.
 (DIR) diff --git a/config.mk b/config.mk
       @@ -0,0 +1,23 @@
       +# sprop version
       +VERSION = 0.1
       +
       +# Customize below to fit your system
       +
       +# paths
       +PREFIX = /usr/local
       +MANPREFIX = ${PREFIX}/share/man
       +
       +X11INC = /usr/X11R6/include
       +X11LIB = /usr/X11R6/lib
       +
       +# includes and libs
       +INCS = -I. -I/usr/include -I${X11INC}
       +LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
       +
       +# flags
       +CPPFLAGS = -DVERSION=\"${VERSION}\"
       +CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
       +LDFLAGS = -s ${LIBS}
       +
       +# compiler and linker
       +CC = cc
 (DIR) diff --git a/sprop.1 b/sprop.1
       @@ -0,0 +1,23 @@
       +.TH SPROP 1 sprop\-VERSION
       +.SH NAME
       +sprop \- simple X property utility
       +.SH SYNOPSIS
       +.B sprop
       +.I xid atom
       +.RI [ value ]
       +[-v]
       +.SH DESCRIPTION
       +.SS Overview
       +The
       +.I sprop
       +utility prints the value of the property
       +.I atom
       +of the window with the given
       +.IR xid ,
       +or alternatively sets it to
       +.I value
       +if given. sprop can only interact with atoms which are strings.
       +.SS Options
       +.TP
       +.B \-v
       +prints version information to standard output, then exits.
 (DIR) diff --git a/sprop.c b/sprop.c
       @@ -1,4 +1,5 @@
        #include <stdio.h>
       +#include <stdlib.h>
        #include <string.h>
        #include <X11/Xlib.h>
        #include <X11/Xatom.h>
       @@ -21,20 +22,25 @@ main(int argc, char *argv[])
                case 4:
                        value = argv[3];
                case 3:
       -                if((atom = XInternAtom(dpy, argv[2], True)) == None) {
       -                        fprintf(stderr, "sprop: no such atom\n");
       -                        return 1;
       -                }
       +                atom = XInternAtom(dpy, argv[2], True);
                        win = atoi(argv[1]);
                        break;
       +        case 2:
       +                if(!strcmp(argv[1], "-v")) {
       +                        printf("sprop-"VERSION", © 2010 Connor Lane Smith\n");
       +                        return 0;
       +                }
                default:
       -                fprintf(stderr, "usage: sprop <xid> <atom> [<value>]\n");
       +                fprintf(stderr, "usage: sprop <xid> <atom> [<value>] [-v]\n");
                        return 1;
                }
                if(value)
                        setatom(atom, value);
                else {
       -                value = getatom(atom);
       +                if(!(value = getatom(atom))) {
       +                        fprintf(stderr, "sprop: cannot get atom\n");
       +                        return 1;
       +                }
                        printf("%s\n", value);
                        XFree(value);
                }
       @@ -52,7 +58,7 @@ getatom(Atom atom)
        
                XGetWindowProperty(dpy, win, atom, 0, BUFSIZ, False, XA_STRING,
                                &adummy, &idummy, &ldummy, &ldummy, &p);
       -        return p;
       +        return (char *)p;
        }
        
        void