aboutsummaryrefslogtreecommitdiffstats
path: root/sha3sum-mcb.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-10-21 17:22:38 +0200
committerMattias Andrée <maandree@kth.se>2020-10-21 17:22:38 +0200
commit0db712267007206d30f74e6b2e856acf8e5502b7 (patch)
tree6a0807871dd8e6c2df2b1fa7a46677e3095f1c40 /sha3sum-mcb.c
parentUpdate test for -z (diff)
downloadsha3sum-0db712267007206d30f74e6b2e856acf8e5502b7.tar.gz
sha3sum-0db712267007206d30f74e6b2e856acf8e5502b7.tar.bz2
sha3sum-0db712267007206d30f74e6b2e856acf8e5502b7.tar.xz
Add multicall binary option
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'sha3sum-mcb.c')
-rw-r--r--sha3sum-mcb.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sha3sum-mcb.c b/sha3sum-mcb.c
new file mode 100644
index 0000000..88990ca
--- /dev/null
+++ b/sha3sum-mcb.c
@@ -0,0 +1,27 @@
+/* See LICENSE file for copyright and license details. */
+#include <string.h>
+#include <stdio.h>
+
+#include "commands.h"
+
+#define _(NAME, MAIN) int MAIN(int argc, char *argv[]);
+LIST_COMMANDS(_)
+#undef _
+
+int
+main(int argc, char *argv[])
+{
+ char *p;
+
+ p = strrchr(argv[0], '/');
+ p = p ? &p[1] : argv[0];
+
+ #define _(NAME, MAIN)\
+ if (!strcmp(p, NAME))\
+ return MAIN(argc, argv);
+ LIST_COMMANDS(_)
+ #undef _
+
+ fprintf(stderr, "%s is a multicall binary and cannot be execute directly\n", argv[0]);
+ return 127;
+}