aboutsummaryrefslogtreecommitdiffstats
path: root/contacts.c.in
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-07-05 20:28:23 +0200
committerMattias Andrée <maandree@kth.se>2023-07-05 20:28:23 +0200
commitbf1ccb7ce4f13deb52013b9cbddfe2ad7cceba00 (patch)
treec0213fdb769a77f3aac3c1a0e91794bdaa4812d9 /contacts.c.in
parentImprove make config file portability and remove -g from CFLAGS and -s from LDFLAGS (diff)
downloadcontacts-bf1ccb7ce4f13deb52013b9cbddfe2ad7cceba00.tar.gz
contacts-bf1ccb7ce4f13deb52013b9cbddfe2ad7cceba00.tar.bz2
contacts-bf1ccb7ce4f13deb52013b9cbddfe2ad7cceba00.tar.xz
Improve multicall-binary: keep dashs as are when printing that a command was not found
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--contacts.c.in12
1 files changed, 5 insertions, 7 deletions
diff --git a/contacts.c.in b/contacts.c.in
index b297951..024b94e 100644
--- a/contacts.c.in
+++ b/contacts.c.in
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
-#define X(NAM) int main__##NAM(int, char *[]);
+#define X(DASH, UNDERSCORE) int main__##UNDERSCORE(int, char *[]);
LIST_COMMANDS
#undef X
@@ -11,17 +11,15 @@ char *argv0 = NULL;
int
main(int argc, char *argv[])
{
- char *name, *p;
+ const char *name;
name = strrchr(*argv, '/');
if (!name++)
name = *argv;
- for (p = name; (p = strchr(p, '-'));)
- *p++ = '_';
-#define X(NAM)\
- if (!strcmp(name, #NAM))\
- return main__##NAM(argc, argv);
+#define X(DASH, UNDERSCORE)\
+ if (!strcmp(name, #DASH))\
+ return main__##UNDERSCORE(argc, argv);
LIST_COMMANDS;
#undef X