From: Eric Andersen Date: Thu, 21 Jun 2001 04:56:24 +0000 (-0000) Subject: Per a suggestion from Tom Oehser, fix up the leading-hyphen hack to X-Git-Tag: 0_52~91 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fa2661f2e5a95f0efd1f019c8ad8742af7bcb55b;p=oweals%2Fbusybox.git Per a suggestion from Tom Oehser, fix up the leading-hyphen hack to make it general. Now all leading single hyphens are ignored for purposed of applet name matching, while argv[0] is still passed unaltered to applets, so leading-hyphen sensitive applets (such as sh) can react accordingly. -Erik --- diff --git a/applets/busybox.c b/applets/busybox.c index f3d0c4c2f..7a220f7b0 100644 --- a/applets/busybox.c +++ b/applets/busybox.c @@ -74,13 +74,10 @@ int main(int argc, char **argv) applet_name = s; } -#ifdef BB_SH - /* Add in a special case hack -- whenever **argv == '-' - * (i.e., '-su' or '-sh') always invoke the shell */ + /* Add in a special case hack for a leading hyphen */ if (**argv == '-' && *(*argv+1)!= '-') { - applet_name = "sh"; + applet_name = (*argv+1); } -#endif #ifdef BB_LOCALE_SUPPORT #ifdef BB_INIT diff --git a/busybox.c b/busybox.c index f3d0c4c2f..7a220f7b0 100644 --- a/busybox.c +++ b/busybox.c @@ -74,13 +74,10 @@ int main(int argc, char **argv) applet_name = s; } -#ifdef BB_SH - /* Add in a special case hack -- whenever **argv == '-' - * (i.e., '-su' or '-sh') always invoke the shell */ + /* Add in a special case hack for a leading hyphen */ if (**argv == '-' && *(*argv+1)!= '-') { - applet_name = "sh"; + applet_name = (*argv+1); } -#endif #ifdef BB_LOCALE_SUPPORT #ifdef BB_INIT