[hackers] [sandy] Applied Evil_Bob's patch || Dimitris Zervas
commit e32611cbf2489deac5a965ab21a77b11ffb94632
Author: Dimitris Zervas <dzervas_AT_dzervas.gr>
Date: Thu Jul 24 00:10:55 2014 +0300
Applied Evil_Bob's patch
diff --git a/LICENSE b/LICENSE
index 5227375..9beeacd 100644
--- a/LICENSE
+++ b/LICENSE
_AT_@ -1,8 +1,9 @@
MIT/X Consortium License
-© 2011 Rafael Garcia <rafael.garcia.gallego_AT_gmail.com>
+© 2014 Rafael Garcia <rafael.garcia.gallego_AT_gmail.com>
Raquel Garcia <raquel.garcia.bautista_AT_gmail.com>
Dimitris Zervas <dzervas_AT_dzervas.gr>
+ Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
diff --git a/Makefile b/Makefile
index 1e6b26a..c73a52b 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -3,58 +3,68 @@
include config.mk
+.POSIX:
+.SUFFIXES: .c .o
+
+HDR = arg.h
+
SRC = sandy.c
-OBJ = ${SRC:.c=.o}
+
+OBJ = $(SRC:.c=.o)
all: options sandy
options:
_AT_echo sandy build options:
- _AT_echo "CFLAGS = ${CFLAGS}"
- _AT_echo "LDFLAGS = ${LDFLAGS}"
- _AT_echo "CC = ${CC}"
+ _AT_echo "CFLAGS = $(CFLAGS)"
+ _AT_echo "LDFLAGS = $(LDFLAGS)"
+ _AT_echo "CC = $(CC)"
+
+$(OBJ): config.h config.mk
+
+.o:
+ _AT_echo LD $@
+ _AT_$(LD) -o $@ $< $(LDFLAGS)
.c.o:
_AT_echo CC $<
- _AT_${CC} -c ${CFLAGS} $<
-
-${OBJ}: config.h config.mk
+ _AT_$(CC) -c -o $@ $< $(CFLAGS)
config.h:
_AT_echo creating $@ from config.def.h
_AT_cp config.def.h $@
-sandy: ${OBJ}
+sandy: $(OBJ)
_AT_echo CC -o $@
- _AT_${CC} -o $@ sandy.o ${LDFLAGS}
+ _AT_$(CC) -o $@ $(OBJ) $(LDFLAGS)
clean:
_AT_echo cleaning
- _AT_rm -f sandy ${OBJ} sandy-${VERSION}.tar.gz
+ _AT_rm -f sandy $(OBJ) sandy-$(VERSION).tar.gz
dist: clean
_AT_echo creating dist tarball
- _AT_mkdir -p sandy-${VERSION}
+ _AT_mkdir -p sandy-$(VERSION)
_AT_cp -R LICENSE Makefile config.mk config.def.h \
- README TODO sandy.1 ${SRC} sandy-${VERSION}
- _AT_tar -cf sandy-${VERSION}.tar sandy-${VERSION}
- _AT_gzip sandy-${VERSION}.tar
- _AT_rm -rf sandy-${VERSION}
+ README TODO sandy.1 $(HDR) $(SRC) sandy-$(VERSION)
+ _AT_tar -cf sandy-$(VERSION).tar sandy-$(VERSION)
+ _AT_gzip sandy-$(VERSION).tar
+ _AT_rm -rf sandy-$(VERSION)
install: all
- _AT_echo installing executable file to ${DESTDIR}${PREFIX}/bin
- _AT_mkdir -p ${DESTDIR}${PREFIX}/bin
- _AT_cp -f sandy ${DESTDIR}${PREFIX}/bin
- _AT_chmod 755 ${DESTDIR}${PREFIX}/bin/sandy
- _AT_echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
- _AT_mkdir -p ${DESTDIR}${MANPREFIX}/man1
- _AT_sed "s/VERSION/${VERSION}/g" < sandy.1 > ${DESTDIR}${MANPREFIX}/man1/sandy.1
- _AT_chmod 644 ${DESTDIR}${MANPREFIX}/man1/sandy.1
+ _AT_echo installing executable file to $(DESTDIR)$(PREFIX)/bin
+ _AT_mkdir -p $(DESTDIR)$(PREFIX)/bin
+ _AT_cp -f sandy $(DESTDIR)$(PREFIX)/bin
+ _AT_chmod 755 $(DESTDIR)$(PREFIX)/bin/sandy
+ _AT_echo installing manual page to $(DESTDIR)$(MANPREFIX)/man1
+ _AT_mkdir -p $(DESTDIR)$(MANPREFIX)/man1
+ _AT_sed "s/VERSION/$(VERSION)/g" < sandy.1 > $(DESTDIR)$(MANPREFIX)/man1/sandy.1
+ _AT_chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sandy.1
uninstall:
- _AT_echo removing executable file from ${DESTDIR}${PREFIX}/bin
- _AT_rm -f ${DESTDIR}${PREFIX}/bin/sandy
- _AT_echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
- _AT_rm -f ${DESTDIR}${MANPREFIX}/man1/sandy.1
+ _AT_echo removing executable file from $(DESTDIR)$(PREFIX)/bin
+ _AT_rm -f $(DESTDIR)$(PREFIX)/bin/sandy
+ _AT_echo removing manual page from $(DESTDIR)$(MANPREFIX)/man1
+ _AT_rm -f $(DESTDIR)$(MANPREFIX)/man1/sandy.1
.PHONY: all options clean dist install uninstall
diff --git a/arg.h b/arg.h
new file mode 100644
index 0000000..4ea4216
--- /dev/null
+++ b/arg.h
_AT_@ -0,0 +1,61 @@
+/*
+ * Copy me if you can.
+ * by 20h
+ */
+
+#ifndef ARG_H__
+#define ARG_H__
+
+extern char *argv0;
+
+/* 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 Wed Jul 23 2014 - 23:19:14 CEST
This archive was generated by hypermail 2.3.0
: Wed Jul 23 2014 - 23:24:12 CEST