aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-08-18 09:51:08 +0200
committerMattias Andrée <maandree@kth.se>2024-08-18 09:51:08 +0200
commit14b54412d395359c59ddb65bf5c4787177213525 (patch)
tree089ba6ea87a332418a318437d3e349708cbd4761
parentAdd @since for definitions added in version 1.2 (diff)
parentImprove libsimple-arg.h for multicall binaries (diff)
downloadlibsimple-14b54412d395359c59ddb65bf5c4787177213525.tar.gz
libsimple-14b54412d395359c59ddb65bf5c4787177213525.tar.bz2
libsimple-14b54412d395359c59ddb65bf5c4787177213525.tar.xz
Merge tag '1.3' into since
Version 1.3
-rw-r--r--config.mk4
-rw-r--r--libsimple-arg.h12
2 files changed, 14 insertions, 2 deletions
diff --git a/config.mk b/config.mk
index f160bbd..605a704 100644
--- a/config.mk
+++ b/config.mk
@@ -1,6 +1,8 @@
-PREFIX = /usr
+PREFIX = /usr
MANPREFIX = $(PREFIX)/share/man
+CC = cc
+
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
CFLAGS = -std=c11 -Wall -Wextra -O2 $(CPPFLAGS)
LDFLAGS = -s
diff --git a/libsimple-arg.h b/libsimple-arg.h
index 3ffc3ed..bc7d4ae 100644
--- a/libsimple-arg.h
+++ b/libsimple-arg.h
@@ -7,6 +7,15 @@
#include <string.h>
+#ifdef LIBSIMPLY_CONFIG_MULTICALL_BINARY /* Define by the application */
+# define _LIBSIMPLY_IF_MULTICALL_BINARY(...) __VA_ARGS__
+# define _LIBSIMPLY_UNLESS_MULTICALL_BINARY(...)
+#else
+# define _LIBSIMPLY_IF_MULTICALL_BINARY(...)
+# define _LIBSIMPLY_UNLESS_MULTICALL_BINARY(...) __VA_ARGS__
+#endif
+
+
/**
* The zeroth command line argument, the name of the process,
* set by the command line parsing macros
@@ -467,7 +476,8 @@ struct longopt {
fprintf(stderr, "usage: %s%s%s\n", argv0, *syn ? " " : "", syn);\
exit(STATUS);\
}\
- char *argv0 = NULL
+ _LIBSIMPLY_UNLESS_MULTICALL_BINARY(char *argv0 = NULL)\
+ _LIBSIMPLY_IF_MULTICALL_BINARY(int main(int, char *[]))
#endif