aboutsummaryrefslogtreecommitdiffstats
path: root/contacts.c.in
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-03 11:06:36 +0200
committerMattias Andrée <maandree@kth.se>2021-04-03 11:06:36 +0200
commitcfc081f9c4f5f538145cbd93f98f714d0be1dad0 (patch)
treeaa9c213cb875568d11194c10f92849605d2d3c0d /contacts.c.in
parentUse strcmpnul (diff)
downloadcontacts-cfc081f9c4f5f538145cbd93f98f714d0be1dad0.tar.gz
contacts-cfc081f9c4f5f538145cbd93f98f714d0be1dad0.tar.bz2
contacts-cfc081f9c4f5f538145cbd93f98f714d0be1dad0.tar.xz
m + Add multicall binary
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'contacts.c.in')
-rw-r--r--contacts.c.in30
1 files changed, 30 insertions, 0 deletions
diff --git a/contacts.c.in b/contacts.c.in
new file mode 100644
index 0000000..5e470ac
--- /dev/null
+++ b/contacts.c.in
@@ -0,0 +1,30 @@
+/* See LICENSE file for copyright and license details. */
+#include <stdio.h>
+#include <string.h>
+
+#define X(NAM) int NAM##_main(int, char *[]);
+LIST_COMMANDS
+#undef X
+
+char *argv0 = NULL;
+
+int
+main(int argc, char *argv[])
+{
+ char *name, *p;
+
+ name = strrchr(*argv, '/');
+ if (!name++)
+ name = *argv;
+ for (p = name; (p = strchr(p, '-'));)
+ *p++ = '_';
+
+#define X(NAM)\
+ if (!strcmp(name, #NAM))\
+ return NAM##_main(argc, argv);
+ LIST_COMMANDS;
+#undef X
+
+ fprintf(stderr, "%s: unrecognised command for multicall binary\n", *argv);
+ return 127;
+}