]> The Tcpdump Group git mirrors - tcpslice/commitdiff
Update -h (help) option to print 32/64-bit build and time_t size
authorFrancois-Xavier Le Bail <[email protected]>
Wed, 13 Mar 2024 14:56:15 +0000 (15:56 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Wed, 13 Mar 2024 14:57:11 +0000 (15:57 +0100)
With an Autoconf update: Get the size of a void * and a time_t.

With this change we know:
whether this is a 32-bit or 64-bit build ;
whether the time_t size is 32-bit or 64-bit.

configure.ac
tcpslice.c

index b08c5d70caaa44444f6e639e17fb6fb034799e7a..781674b988cb9eccda347ffa8ab60a1b71efa755 100644 (file)
@@ -31,6 +31,15 @@ fi
 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
 
 AC_CHECK_HEADERS(fcntl.h)
+#
+# Get the size of a void *, to know whether this is a 32-bit or 64-bit build.
+#
+AC_CHECK_SIZEOF([void *])
+
+#
+# Get the size of a time_t, to know whether it's 32-bit or 64-bit.
+#
+AC_CHECK_SIZEOF([time_t],,[#include <time.h>])
 
 #
 # Try to arrange for large file support.
index fd5d7258bf230879f091ea1d1ebcf4fbc066435a..22075468b4b40afd6da1a7bdcdbd78aa421da5cb 100644 (file)
@@ -1130,6 +1130,11 @@ print_usage(FILE *f)
 
 #endif /* HAVE_LIBNIDS */
 
+#if defined(SIZEOF_VOID_P) && defined(SIZEOF_TIME_T)
+       (void)fprintf (f, "%u-bit build, %u-bit time_t\n",
+                      SIZEOF_VOID_P * 8, SIZEOF_TIME_T * 8);
+#endif
+
        (void)fprintf(f,
                      "Usage: tcpslice [-DdhlRrtv] [-w file]\n"
                      "                [ -s types [ -e seconds ] [ -f format ] ]\n"