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
This commit is contained in:
Eric Andersen 2001-06-21 04:56:24 +00:00
parent aff5e2eaef
commit fa2661f2e5
2 changed files with 4 additions and 10 deletions

View File

@ -74,13 +74,10 @@ int main(int argc, char **argv)
applet_name = s; applet_name = s;
} }
#ifdef BB_SH /* Add in a special case hack for a leading hyphen */
/* Add in a special case hack -- whenever **argv == '-'
* (i.e., '-su' or '-sh') always invoke the shell */
if (**argv == '-' && *(*argv+1)!= '-') { if (**argv == '-' && *(*argv+1)!= '-') {
applet_name = "sh"; applet_name = (*argv+1);
} }
#endif
#ifdef BB_LOCALE_SUPPORT #ifdef BB_LOCALE_SUPPORT
#ifdef BB_INIT #ifdef BB_INIT

View File

@ -74,13 +74,10 @@ int main(int argc, char **argv)
applet_name = s; applet_name = s;
} }
#ifdef BB_SH /* Add in a special case hack for a leading hyphen */
/* Add in a special case hack -- whenever **argv == '-'
* (i.e., '-su' or '-sh') always invoke the shell */
if (**argv == '-' && *(*argv+1)!= '-') { if (**argv == '-' && *(*argv+1)!= '-') {
applet_name = "sh"; applet_name = (*argv+1);
} }
#endif
#ifdef BB_LOCALE_SUPPORT #ifdef BB_LOCALE_SUPPORT
#ifdef BB_INIT #ifdef BB_INIT