datefudge-1.17-bsd.patch (2751B)
1 diff --git a/Makefile b/Makefile 2 index b2f81bb..35da75e 100644 3 --- a/Makefile 4 +++ b/Makefile 5 @@ -12,17 +12,17 @@ compile all: datefudge datefudge.so 6 7 install: datefudge datefudge.so datefudge.1 8 install -d $(DESTDIR)/usr/lib/datefudge/ 9 - $(INSTALL_PROGRAM) -o root -g root -m 644 datefudge.so $(DESTDIR)/usr/lib/datefudge/datefudge.so 10 + $(INSTALL_PROGRAM) -o root -g wheel -m 644 datefudge.so $(DESTDIR)/usr/lib/datefudge/datefudge.so 11 install -d $(DESTDIR)/usr/bin/ 12 - $(INSTALL_PROGRAM) -o root -g root -m 755 datefudge $(DESTDIR)/usr/bin 13 + $(INSTALL_PROGRAM) -o root -g wheel -m 755 datefudge $(DESTDIR)/usr/bin 14 install -d $(DESTDIR)/usr/share/man/man1 15 - install -o root -g root -m 644 datefudge.1 $(DESTDIR)/usr/share/man/man1 16 + install -o root -g wheel -m 644 datefudge.1 $(DESTDIR)/usr/share/man/man1 17 18 datefudge: datefudge.sh 19 sed -e 's,@VERSION@,$(VERSION),g' < $< > $@ 20 21 datefudge.so: datefudge.o 22 - $(CC) $(LDFLAGS) -o $@ -shared $< -ldl -lc 23 + $(CC) $(LDFLAGS) -o $@ -shared $< -lc 24 25 datefudge.o: datefudge.c 26 $(CC) $(CFLAGS) -c -o $@ $< 27 @@ -39,8 +39,8 @@ test: compile 28 export TZ=UTC ;\ 29 ret1=1; ret2=1 ;\ 30 for i in 1 2; do \ 31 - export DATEFUDGE=`LC_ALL=C date --date='yesterday 0:00' +%s` ;\ 32 - dt=`LC_ALL=C LD_PRELOAD=$(CURDIR)/datefudge.so date --date=12:15 +%F.%T` ;\ 33 + export DATEFUDGE=`LC_ALL=C date -v-1d -v0H -v0M +%s` ;\ 34 + dt=`LC_ALL=C LD_PRELOAD=$(CURDIR)/datefudge.so date -v12H -v15M +%F.%T` ;\ 35 exp="1970-01-02.12:15:00" ;\ 36 [ "$$dt" != "$$exp" ] || { echo "OK"; ret1=0; break; } ;\ 37 echo "failed: expected: $$exp, actual: $$dt" ;\ 38 @@ -49,7 +49,7 @@ test: compile 39 echo -n "Running a simple perl localtime() test... " ;\ 40 pscr='@t=localtime(time);$$t[5]+=1900;$$t[4]++;printf "%04d-%02d-%02d\n",$$t[5],$$t[4],$$t[3];';\ 41 for i in 1 2; do \ 42 - export DATEFUDGE=`LC_ALL=C date --date='yesterday 0:00' +%s` ;\ 43 + export DATEFUDGE=`LC_ALL=C date -v-1d -v0H -v0M +%s` ;\ 44 dt=`LD_PRELOAD=$(CURDIR)/datefudge.so perl -e "$$pscr"` ;\ 45 exp="1970-01-02" ;\ 46 [ "$$dt" != "$$exp" ] || { echo "OK"; ret2=0; break; } ;\ 47 diff --git a/datefudge.c b/datefudge.c 48 index 8c86652..fc7e3d6 100644 49 --- a/datefudge.c 50 +++ b/datefudge.c 51 @@ -14,7 +14,6 @@ 52 #include <stdlib.h> 53 #include <dlfcn.h> 54 #include <assert.h> 55 -#include <features.h> 56 #include <unistd.h> 57 #include <time.h> 58 #include <sys/time.h>