From 9b2afe6dd66bcb975f037cb7b78ef0e6f9e87212 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 3 Sep 2001 19:21:07 +0000 Subject: [PATCH] Backport fix from Matt, for when applet names contain a leading dash and a full pathname. --- busybox/applets/busybox.c | 12 ++++++------ busybox/busybox.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/busybox/applets/busybox.c b/busybox/applets/busybox.c index 7a220f7b0..33efb5d84 100644 --- a/busybox/applets/busybox.c +++ b/busybox/applets/busybox.c @@ -69,16 +69,16 @@ int main(int argc, char **argv) { const char *s; - for (s = applet_name = argv[0]; *s != '\0';) { + applet_name = argv[0]; + + if (applet_name[0] == '-') + applet_name++; + + for (s = applet_name; *s != '\0';) { if (*s++ == '/') applet_name = s; } - /* Add in a special case hack for a leading hyphen */ - if (**argv == '-' && *(*argv+1)!= '-') { - applet_name = (*argv+1); - } - #ifdef BB_LOCALE_SUPPORT #ifdef BB_INIT if(getpid()!=1) /* Do not set locale for `init' */ diff --git a/busybox/busybox.c b/busybox/busybox.c index 7a220f7b0..33efb5d84 100644 --- a/busybox/busybox.c +++ b/busybox/busybox.c @@ -69,16 +69,16 @@ int main(int argc, char **argv) { const char *s; - for (s = applet_name = argv[0]; *s != '\0';) { + applet_name = argv[0]; + + if (applet_name[0] == '-') + applet_name++; + + for (s = applet_name; *s != '\0';) { if (*s++ == '/') applet_name = s; } - /* Add in a special case hack for a leading hyphen */ - if (**argv == '-' && *(*argv+1)!= '-') { - applet_name = (*argv+1); - } - #ifdef BB_LOCALE_SUPPORT #ifdef BB_INIT if(getpid()!=1) /* Do not set locale for `init' */ -- 2.25.1