summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-04-18 15:27:27 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-04-19 15:50:45 -0400
commit0035cc4ff492cab91adeb49d0c577fe5982064bd (patch)
tree6fcd6b48b00ceb4ae696a5a3d9d03e23c9676a70 /src
parentd7d5e1c474e4e110172b7180de9c41e5ebbf93f6 (diff)
downloadbfs-0035cc4ff492cab91adeb49d0c577fe5982064bd.tar.xz
config: Check for program_invocation_short_name
This lets us pick it up on musl too, since there's no __MUSL__ macro. Link: https://wiki.musl-libc.org/faq#Q:-Why-is-there-no-%3Ccode%3E__MUSL__%3C/code%3E-macro?
Diffstat (limited to 'src')
-rw-r--r--src/bfstd.c6
-rw-r--r--src/prelude.h2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/bfstd.c b/src/bfstd.c
index e1b4804..e8a927a 100644
--- a/src/bfstd.c
+++ b/src/bfstd.c
@@ -186,10 +186,10 @@ char *xgetdelim(FILE *file, char delim) {
const char *xgetprogname(void) {
const char *cmd = NULL;
-#if __GLIBC__
- cmd = program_invocation_short_name;
-#elif BSD
+#if BFS_HAS_GETPROGNAME
cmd = getprogname();
+#elif BFS_HAS_GETPROGNAME_GNU
+ cmd = program_invocation_short_name;
#endif
if (!cmd) {
diff --git a/src/prelude.h b/src/prelude.h
index c3a0752..a23b167 100644
--- a/src/prelude.h
+++ b/src/prelude.h
@@ -26,6 +26,8 @@
// bfs packaging configuration
+#include "config.h"
+
#ifndef BFS_COMMAND
# define BFS_COMMAND "bfs"
#endif