commit - e27216e1c5bbaeb1074d4c65f38aa9b2072940ed
commit + 0cf61ffcaf5321ee5888f5c1d247a1c383ff75fd
blob - ea7c2a34c9fb1d51b5a084685abfdb9c251d3e41
blob + 7386263214341fbdfc27b45de40d8168a79e0935
--- compat/getprogname.c
+++ compat/getprogname.c
#include "../config.h"
-#if HAVE_PROGRAM_INVOCATION_SHORT_NAME
+#if HAVE___PROGNAME
+#include <stddef.h>
+
+extern char *__progname;
+
+const char *
+getprogname(void)
+{
+ return __progname;
+}
+
+#elif HAVE_PROGRAM_INVOCATION_SHORT_NAME
+
#include <errno.h>
extern char *program_invocation_short_name;
}
#else
-
+# warning Found no way to get the program name, will use "gmid" for all utilities.
const char *
getprogname(void)
{
blob - 297f2b5ef4bcdbf7cdb536581edf85451370f622
blob + 6aa612830423d44df3bffe9db49055328ef154d2
--- configure
+++ configure
exit 1
fi
+runtest getprogname GETPROGNAME || \
+runtest __progname __PROGNAME || \
+runtest program_invocation_short_name PROGRAM_INVOCATION_SHORT_NAME -D_GNU_SOURCE || true
+
runtest arc4random ARC4RANDOM || true
runtest arc4random_buf ARC4RANDOM_BUF || true
runtest err ERR || true
runtest freezero FREEZERO || true
runtest getdtablecount GETDTABLECOUNT || true
runtest getdtablesize GETDTABLESIZE || true
-runtest getprogname GETPROGNAME || true
runtest imsg IMSG "" -lutil libimsg || true
runtest landlock LANDLOCK || true
runtest libevent LIBEVENT "" -levent libevent_core|| true
runtest memmem MEMMEM -D_GNU_SOURCE || true
runtest openssl OPENSSL "" '-lcrypto -lssl' 'libcrypto libssl' || true
runtest pr_set_name PR_SET_NAME || true
-runtest program_invocation_short_name PROGRAM_INVOCATION_SHORT_NAME -D_GNU_SOURCE || true
runtest queue_h QUEUE_H || true
runtest reallocarray REALLOCARRAY -D_OPENBSD_SOURCE || true
runtest recallocarray RECALLOCARRAY || true
#ifndef SYSCONFDIR
# define SYSCONFDIR "${SYSCONFDIR}"
#endif
+
+#define HAVE___PROGNAME ${HAVE___PROGNAME:-0}
+#define HAVE_PROGRAM_INVOCATION_SHORT_NAME ${HAVE_PROGRAM_INVOCATION_SHORT_NAME:-0}
__HEREDOC__
blob - bc9d7c5c10993aed4cbcca56ade80dbf9b1d5225
blob + 3bb5f8f281fe4c35e0987c526de6150829b875ab
--- have/Makefile
+++ have/Makefile
SSL_CTX_load_verify_mem.c \
SSL_CTX_use_certificate_chain_mem.c \
X509_LOOKUP_mem.c \
+ __progname.c \
arc4random.c \
arc4random_buf.c \
endian_h.c \
blob - /dev/null
blob + dbef94cf93c9e485b2fea7f4a589490315315a9f (mode 644)
--- /dev/null
+++ have/__progname.c
+/* public domain */
+
+#include <stdio.h>
+
+extern const char *__progname;
+
+int
+main(void)
+{
+ puts(__progname);
+}