about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-10-22 15:31:21 +0200
committerLeah Neukirchen <leah@vuxu.org>2022-10-22 15:31:21 +0200
commit168d9538f16869d4cdcbcc01a5ddce0af4a8b918 (patch)
tree20ea382f585fec693ec4af79636672859d4dae57 /src
parent1ecea7abf3bc8b3885763053876075ba93b20ad0 (diff)
downloadoutils-168d9538f16869d4cdcbcc01a5ddce0af4a8b918.tar.gz
outils-168d9538f16869d4cdcbcc01a5ddce0af4a8b918.tar.xz
outils-168d9538f16869d4cdcbcc01a5ddce0af4a8b918.zip
fix and install ts v0.12
Diffstat (limited to 'src')
-rw-r--r--src/liboutils/outils.h32
-rw-r--r--src/usr.bin/ts/ts.c4
2 files changed, 31 insertions, 5 deletions
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);
 }