diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | src/liboutils/outils.h | 32 | ||||
-rw-r--r-- | src/usr.bin/ts/ts.c | 4 |
3 files changed, 34 insertions, 6 deletions
diff --git a/Makefile b/Makefile index ae9b7a2..f8721fe 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ CPPFLAGS=-include src/liboutils/outils.h -isystem src/liboutils/include -Isrc/bi LDFLAGS=-Wl,--as-needed LIBS=-lm -ALL=src/usr.bin/apply/apply src/usr.bin/jot/jot src/usr.bin/lam/lam src/usr.bin/lndir/lndir src/bin/md5/md5 src/usr.bin/rs/rs src/usr.bin/signify/signify src/usr.bin/calendar/calendar src/usr.bin/vis/vis src/usr.bin/unvis/unvis src/usr.bin/what/what src/usr.sbin/rdate/rdate +ALL=src/usr.bin/apply/apply src/usr.bin/jot/jot src/usr.bin/lam/lam src/usr.bin/lndir/lndir src/bin/md5/md5 src/usr.bin/rs/rs src/usr.bin/signify/signify src/usr.bin/ts/ts src/usr.bin/calendar/calendar src/usr.bin/vis/vis src/usr.bin/unvis/unvis src/usr.bin/what/what src/usr.sbin/rdate/rdate all: $(ALL) %: %.o @@ -23,6 +23,8 @@ src/usr.bin/rs/rs: src/usr.bin/rs/rs.o src/usr.bin/rs/utf8.o src/liboutils/pledg src/usr.bin/signify/signify: src/usr.bin/signify/signify.o src/usr.bin/signify/crypto_api.o src/usr.bin/signify/fe25519.o src/usr.bin/signify/mod_ed25519.o src/usr.bin/signify/mod_ge25519.o src/usr.bin/signify/sc25519.o src/usr.bin/signify/zsig.o src/liboutils/pledge.o src/liboutils/strlcpy.o src/liboutils/base64.o src/liboutils/explicit_bzero.o src/liboutils/ohash.o src/liboutils/arc4random.o src/liboutils/getentropy_linux.o src/liboutils/readpassphrase.o src/liboutils/sha2.o src/liboutils/sha256hl.o src/liboutils/sha512_256hl.o src/liboutils/sha512hl.o src/liboutils/timingsafe_bcmp.o src/liboutils/bcrypt_pbkdf.o src/liboutils/blowfish.o src/liboutils/freezero.o +src/usr.bin/ts/ts: src/usr.bin/ts/ts.o src/liboutils/strlcpy.o src/liboutils/pledge.o + src/usr.bin/calendar/calendar: src/usr.bin/calendar/calendar.o src/usr.bin/calendar/day.o src/usr.bin/calendar/io.o src/usr.bin/calendar/ostern.o src/usr.bin/calendar/paskha.o src/usr.bin/calendar/pesach.o src/liboutils/arc4random_uniform.o src/liboutils/arc4random.o src/liboutils/getentropy_linux.o src/liboutils/explicit_bzero.o src/liboutils/pledge.o src/liboutils/sha2.o src/liboutils/strtonum.o src/usr.bin/vis/vis: src/usr.bin/vis/vis.o src/usr.bin/vis/foldit.o src/liboutils/pledge.o src/liboutils/strtonum.o src/liboutils/vis.o diff --git a/src/liboutils/outils.h b/src/liboutils/outils.h index 1e628ed..7e9a7ec 100644 --- a/src/liboutils/outils.h +++ b/src/liboutils/outils.h @@ -1,9 +1,9 @@ #define DEF_WEAK(x) #define __weak_alias(new, old) \ - extern __typeof(old) new __attribute__((weak, alias(#old))) + extern __typeof(old) new __attribute__((weak, alias(#old))) #define MAKE_CLONE(new, old) \ - extern __typeof(old) new __attribute__((weak, alias(#old))) + extern __typeof(old) new __attribute__((weak, alias(#old))) #define __dead __attribute__((__noreturn__)) #define __BEGIN_DECLS #define __END_DECLS @@ -17,10 +17,34 @@ #ifndef SA_LEN #define SA_LEN(X) \ - (((struct sockaddr*)(X))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : \ - ((struct sockaddr*)(X))->sa_family == AF_INET6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr)) + (((struct sockaddr*)(X))->sa_family == AF_INET ? sizeof(struct sockaddr_in) : \ + ((struct sockaddr*)(X))->sa_family == AF_INET6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr)) #endif +#ifndef timespecadd +#define timespecadd(tsp, usp, vsp) \ + do { \ + (vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec; \ + (vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec; \ + if ((vsp)->tv_nsec >= 1000000000L) { \ + (vsp)->tv_sec++; \ + (vsp)->tv_nsec -= 1000000000L; \ + } \ + } while (0) +#endif +#ifndef timespecsub +#define timespecsub(tsp, usp, vsp) \ + do { \ + (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \ + (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \ + if ((vsp)->tv_nsec < 0) { \ + (vsp)->tv_sec--; \ + (vsp)->tv_nsec += 1000000000L; \ + } \ + } while (0) +#endif + + #include <stdio.h> #include <stdint.h> #include <sys/types.h> diff --git a/src/usr.bin/ts/ts.c b/src/usr.bin/ts/ts.c index f8e3cb0..2d82b82 100644 --- a/src/usr.bin/ts/ts.c +++ b/src/usr.bin/ts/ts.c @@ -131,10 +131,12 @@ main(int argc, char *argv[]) return 0; } +extern char *__progname; + static void __dead usage(void) { - fprintf(stderr, "usage: %s [-i | -s] [-m] [format]\n", getprogname()); + fprintf(stderr, "usage: %s [-i | -s] [-m] [format]\n", __progname); exit(1); } |