commit a72cc6be31afa97532ea4339ee6e5f3ea20fac68 from: Omar Polo date: Thu Feb 11 09:13:58 2021 UTC improve compat/getprogname on GNU libc but why'd they called it program_invocation_short_name? They couldn't find a longer name? commit - 4d7043e33c8d90402797c71ff96747897d053515 commit + a72cc6be31afa97532ea4339ee6e5f3ea20fac68 blob - ee178b750ad97e0ed4ef9418d57e61f0004f5147 blob + a243233e862d7543bb608489a36fdfd7c13be822 --- compat/getprogname.c +++ compat/getprogname.c @@ -16,8 +16,24 @@ #include "../config.h" +#ifdef HAVE_PROGRAM_INVOCATION_SHORT_NAME + +#include + +extern char *program_invocation_short_name; + const char * getprogname(void) { + return program_invocation_short_name; +} + +#else + +const char * +getprogname(void) +{ return "gmid"; } + +#endif blob - 2943ac500abb10cc360f3757fea51b90b04b7b43 blob + ff215093e67bcf907bf3b4c78c9abb336a1d726d --- configure +++ configure @@ -49,6 +49,7 @@ HAVE_GETPROGNAME= HAVE_LIBEVENT= HAVE_LIBTLS= HAVE_OPENSSL= +HAVE_PROGRAM_INVOCATION_SHORT_NAME= HAVE_PR_SET_NAME= HAVE_RECALLOCARRAY= HAVE_SETPROCTITLE= @@ -233,6 +234,7 @@ runtest getprogname GETPROGNAME || true runtest libevent LIBEVENT || true runtest libtls LIBTLS || true runtest openssl OPENSSL || true +runtest program_invocation_short_name PROGRAM_INVOCATION_SHORT_NAME "" -D_GNU_SOURCE || true runtest pr_set_name PR_SET_NAME || true runtest recallocarray RECALLOCARRAY || true runtest setproctitle SETPROCTITLE || true @@ -283,6 +285,7 @@ cat <<__HEREDOC__ #define HAVE_EXPLICIT_BZERO ${HAVE_EXPLICIT_BZERO} #define HAVE_GETPROGNAME ${HAVE_GETPROGNAME} #define HAVE_LIBEVENT ${HAVE_LIBEVENT} +#define HAVE_PROGRAM_INVOCATION_SHORT_NAME ${HAVE_PROGRAM_INVOCATION_SHORT_NAME} #define HAVE_PR_SET_NAME ${HAVE_PR_SET_NAME} #define HAVE_RECALLOCARRAY ${HAVE_RECALLOCARRAY} #define HAVE_SETPROCTITLE ${SETPROCTITLE}