aboutsummaryrefslogtreecommitdiff
path: root/compat/getprogname.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-02-11 09:13:58 +0000
committerOmar Polo <op@omarpolo.com>2021-02-11 09:13:58 +0000
commita72cc6be31afa97532ea4339ee6e5f3ea20fac68 (patch)
tree51eb4aaee130afe3e723f43310700adc071e3ae6 /compat/getprogname.c
parent4d7043e33c8d90402797c71ff96747897d053515 (diff)
improve compat/getprogname on GNU libc
but why'd they called it program_invocation_short_name? They couldn't find a longer name?
Diffstat (limited to 'compat/getprogname.c')
-rw-r--r--compat/getprogname.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/compat/getprogname.c b/compat/getprogname.c
index ee178b7..a243233 100644
--- a/compat/getprogname.c
+++ b/compat/getprogname.c
@@ -16,8 +16,24 @@
#include "../config.h"
+#ifdef HAVE_PROGRAM_INVOCATION_SHORT_NAME
+
+#include <errno.h>
+
+extern char *program_invocation_short_name;
+
+const char *
+getprogname(void)
+{
+ return program_invocation_short_name;
+}
+
+#else
+
const char *
getprogname(void)
{
return "gmid";
}
+
+#endif