aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-04 12:56:27 +0200
committerMattias Andrée <maandree@kth.se>2021-04-04 12:56:27 +0200
commitcd1f1bb076e39a5ddda93e048059c704e5a566dc (patch)
tree8ad9aafacf5bcc36e97fd297f70d691044d51b96
parentSet CC=cc in config.mk (diff)
downloadlibsimple-cd1f1bb076e39a5ddda93e048059c704e5a566dc.tar.gz
libsimple-cd1f1bb076e39a5ddda93e048059c704e5a566dc.tar.bz2
libsimple-cd1f1bb076e39a5ddda93e048059c704e5a566dc.tar.xz
Improve libsimple-arg.h for multicall binaries1.3
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--libsimple-arg.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/libsimple-arg.h b/libsimple-arg.h
index 983f4c8..67be5e9 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
@@ -431,7 +440,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