From: Eric Andersen Date: Thu, 29 Jun 2000 20:20:14 +0000 (-0000) Subject: Added support for being a login shell, so things like '-su' or '-sh' (stuff X-Git-Tag: 0_46~73 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5d41d60f1e78aceb92555596c3a58c13c65d4e5b;p=oweals%2Fbusybox.git Added support for being a login shell, so things like '-su' or '-sh' (stuff where argv[0][0]=='-') will now always invoke the shell. Now you can use BusyBox as a login shell. -Erik --- diff --git a/Changelog b/Changelog index c674ab275..11464b675 100644 --- a/Changelog +++ b/Changelog @@ -12,6 +12,9 @@ Fix thanks to Arne Bernin * Added support for "sh -c command args...", thanks to Marius Groeger + * Added support for being a login shell, so things like + '-su' or '-sh' (stuff where argv[0][0]=='-') will now always + invoke the shell. Now you can use BusyBox as a login shell. -Erik Andersen diff --git a/applets/busybox.c b/applets/busybox.c index 48ca05408..486ef4d77 100644 --- a/applets/busybox.c +++ b/applets/busybox.c @@ -479,6 +479,13 @@ int main(int argc, char **argv) *argv = name; +#ifdef BB_SH + /* Add in a special case hack -- whenever **argv == '-' + * (i.e. '-su' or '-sh') always invoke the shell */ + if (**argv == '-') + exit(((*(shell_main)) (argc, argv))); +#endif + while (a->name != 0) { if (strcmp(name, a->name) == 0) { exit(((*(a->main)) (argc, argv))); diff --git a/busybox.c b/busybox.c index 48ca05408..486ef4d77 100644 --- a/busybox.c +++ b/busybox.c @@ -479,6 +479,13 @@ int main(int argc, char **argv) *argv = name; +#ifdef BB_SH + /* Add in a special case hack -- whenever **argv == '-' + * (i.e. '-su' or '-sh') always invoke the shell */ + if (**argv == '-') + exit(((*(shell_main)) (argc, argv))); +#endif + while (a->name != 0) { if (strcmp(name, a->name) == 0) { exit(((*(a->main)) (argc, argv)));