[hackers] [xgetidle] Initial commit of xgetidle. || Christoph Lohmann

From: <git_AT_suckless.org>
Date: Fri, 07 Dec 2012 11:34:09 +0100

commit 89cf5792ca6104b5afe150d02813b3f259ca61bd
Author: Christoph Lohmann <20h_AT_r-36.net>
Date: Fri Dec 7 11:32:02 2012 +0100

    Initial commit of xgetidle.

diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..506c2f6
--- /dev/null
+++ b/LICENSE
_AT_@ -0,0 +1,22 @@
+MIT/X Consortium License
+
+© 2008 Kai Hendry <hendry_AT_webconverger.com>
+© 2012 Christoph Lohmann <20h_AT_r-36.net>
+
+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.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1d7d4d9
--- /dev/null
+++ b/Makefile
_AT_@ -0,0 +1,56 @@
+# xgetidle – display the X idle time
+# See LICENSE file for copyright and license details.
+
+include config.mk
+
+SRC = xgetidle.c
+OBJ = ${SRC:.c=.o}
+
+all: options xgetidle
+
+options:
+ _AT_echo xgetidle build options:
+ _AT_echo "CFLAGS = ${CFLAGS}"
+ _AT_echo "LDFLAGS = ${LDFLAGS}"
+ _AT_echo "CC = ${CC}"
+
+.c.o:
+ _AT_echo CC $<
+ _AT_${CC} -c ${CFLAGS} $<
+
+${OBJ}: config.mk
+
+xgetidle: xgetidle.o
+ _AT_echo CC -o $@
+ _AT_${CC} -o $@ xgetidle.o ${LDFLAGS}
+
+clean:
+ _AT_echo cleaning
+ _AT_rm -f xgetidle ${OBJ} xgetidle-${VERSION}.tar.gz
+
+dist: clean
+ _AT_echo creating dist tarball
+ _AT_mkdir -p xgetidle-${VERSION}
+ _AT_cp -R LICENSE Makefile README config.mk \
+ xgetidle.1 arg.h ${SRC} xgetidle-${VERSION}
+ _AT_tar -cf xgetidle-${VERSION}.tar xgetidle-${VERSION}
+ _AT_gzip xgetidle-${VERSION}.tar
+ _AT_rm -rf xgetidle-${VERSION}
+
+install: all
+ _AT_echo installing executable file to ${DESTDIR}${PREFIX}/bin
+ _AT_mkdir -p ${DESTDIR}${PREFIX}/bin
+ _AT_cp -f xgetidle ${DESTDIR}${PREFIX}/bin
+ _AT_chmod 755 ${DESTDIR}${PREFIX}/bin/xgetidle
+ _AT_echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
+ _AT_mkdir -p ${DESTDIR}${MANPREFIX}/man1
+ _AT_sed "s/VERSION/${VERSION}/g" < xgetidle.1 > ${DESTDIR}${MANPREFIX}/man1/xgetidle.1
+ _AT_chmod 644 ${DESTDIR}${MANPREFIX}/man1/xgetidle.1
+
+uninstall:
+ _AT_echo removing executable file from ${DESTDIR}${PREFIX}/bin
+ _AT_rm -f ${DESTDIR}${PREFIX}/bin/xgetidle
+ _AT_echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
+ _AT_rm -f ${DESTDIR}${MANPREFIX}/man1/xgetidle.1
+
+.PHONY: all options clean dist install uninstall
diff --git a/arg.h b/arg.h
new file mode 100644
index 0000000..2b189fe
--- /dev/null
+++ b/arg.h
_AT_@ -0,0 +1,55 @@
+/*
+ * Copy me if you can.
+ * by 20h
+ */
+
+#ifndef __ARG_H__
+#define __ARG_H__
+
+extern char *argv0;
+
+#define USED(x) ((void)(x))
+
+/* use main(int argc, char *argv[]) */
+#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\
+ argv[0] && argv[0][1]\
+ && argv[0][0] == '-';\
+ argc--, argv++) {\
+ char _argc;\
+ char **_argv;\
+ int brk;\
+ if (argv[0][1] == '-' && argv[0][2] == '
Received on Fri Dec 07 2012 - 11:34:09 CET

This archive was generated by hypermail 2.3.0 : Fri Dec 07 2012 - 11:36:09 CET