From 2af141a2c069c56d56f110414f600f3a38ad8617 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 30 Aug 2023 13:07:13 +0100 Subject: ash: changes to login shell functionality Upstream BusyBox supports the usual Unix functionality where the login process adds a '-' prefix to the shell's argv[0]. Since busybox-w32 doesn't have a login process this serves no purpose and can be removed. Instead it would be useful to have a way to invoke a login shell without requiring any arguments. Advantages would be: - easier to configure busybox-w32 'ash' as the SSH login shell; - double clicking on a shell binary could start a login shell. Add 'lash' as an alias for 'ash' which starts a login shell without requiring the '-l' option. Saves 16 bytes. --- shell/ash.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 2ea87a049..95f399b0b 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -209,6 +209,9 @@ //applet:IF_ASH(APPLET(ash, BB_DIR_BIN, BB_SUID_DROP)) // APPLET_ODDNAME:name main location suid_type help //applet:IF_SH_IS_ASH( APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, ash)) +//applet:IF_PLATFORM_MINGW32( +//applet:IF_SH_IS_ASH( APPLET_ODDNAME(lash, ash, BB_DIR_BIN, BB_SUID_DROP, ash)) +//applet:) //applet:IF_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, ash)) //kbuild:lib-$(CONFIG_SHELL_ASH) += ash.o ash_ptr_hack.o shell_common.o @@ -15999,7 +16002,11 @@ procargs(char **argv) int login_sh; xargv = argv; +#if ENABLE_PLATFORM_MINGW32 + login_sh = applet_name[0] == 'l'; +#else login_sh = xargv[0] && xargv[0][0] == '-'; +#endif #if NUM_SCRIPTS > 0 if (minusc) goto setarg0; -- cgit v1.2.3-55-g6feb