Allow multiple shells to be enabled.
authorMatt Kraai <kraai@debian.org>
Wed, 1 Aug 2001 17:21:35 +0000 (17:21 -0000)
committerMatt Kraai <kraai@debian.org>
Wed, 1 Aug 2001 17:21:35 +0000 (17:21 -0000)
21 files changed:
Changelog
Config.h
Makefile
README
applets.h
applets/usage.h
ash.c
debian/Config.h-deb
debian/Config.h-static
debian/Config.h-udeb
hush.c
include/applets.h
include/usage.h
lash.c
msh.c
sh.c [deleted file]
shell/ash.c
shell/hush.c
shell/lash.c
shell/msh.c
usage.h

index 45005b5..6325417 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -42,6 +42,7 @@
            -- Reworked rdate option handling (is now smaller).
            -- Size reduction in ping
            -- Always write dd counts to stderr
+           -- Allow multiple shells to be enabled
        * Aaron Lehmann 
            -- slimmed down md5sum 
            -- contributed a nice new (hand written, not lex/yacc) Posix math 
index 4523fbc..831eb93 100644 (file)
--- a/Config.h
+++ b/Config.h
@@ -9,6 +9,7 @@
 // BusyBox Applications
 //#define BB_ADJTIMEX
 //#define BB_AR
+//#define BB_ASH
 #define BB_BASENAME
 #define BB_CAT
 #define BB_CHGRP
@@ -51,6 +52,7 @@
 #define BB_HEAD
 //#define BB_HOSTID
 //#define BB_HOSTNAME
+//#define BB_HUSH
 #define BB_ID
 //#define BB_IFCONFIG
 #define BB_INIT
@@ -58,6 +60,7 @@
 #define BB_KILL
 #define BB_KILLALL
 #define BB_KLOGD
+//#define BB_LASH
 //#define BB_LENGTH
 #define BB_LN
 //#define BB_LOADACM
@@ -78,6 +81,7 @@
 #define BB_MODPROBE
 #define BB_MORE
 #define BB_MOUNT
+#define BB_MSH
 //#define BB_MT
 #define BB_MV
 //#define BB_NC
 //#define BB_RPM2CPIO
 #define BB_SED
 //#define BB_SETKEYCODES
-#define BB_SH
 #define BB_SLEEP
 #define BB_SORT
 //#define BB_STTY
 // pretty/useful).
 //
 //
-// If you enabled BB_SH above, you may select one of the following shells.  
-// You can only select ONE of the following shells.  Sorry.
-//
-// lash is the very smallest shell (adds just 10k) and it is quite usable as 
-// a command prompt, but it is not suitable for any but the most trivial
-// scripting (such as an initrd that calls insmod a few times) since it does
-// not understand Bourne shell grammer.  It does handle pipes, redirects, and
-// job control though.  Adding in command editing makes it very nice
-// lightweight command prompt.
-//#define BB_FEATURE_LASH
-//
-// hush is also quite small (just 18k) and it has very complete Bourne shell
-// grammer.  It handles if/then/else/fi just fine, but doesn't handle loops
-// like for/do/done or case/esac and such.  It also currently has a problem
-// with job control.
-//#define BB_FEATURE_HUSH
-//
-// msh: The minix shell (adds just 30k) is quite complete and handles things
-// like for/do/done, case/esac and all the things you expect a Bourne shell to
-// do.  It is not always pedantically correct about Bourne shell grammer (try
-// running the shell testscript "tests/sh.testcases" on it and compare vs bash)
-// but for most things it works quite well.  It also uses only vfork, so it can
-// be used on uClinux systems.  This was only recently added, so there is still
-// room to shrink it further...
-#define BB_FEATURE_MSH
-//
-// ash: This adds about 60k in the default configuration and is the most
-// complete and most pedantically correct shell included with busybox.  This
-// shell was also recently added, and several people (mainly Vladimir and Erik)
-// have been working on it.  There are a number of configurable things at the
-// top of ash.c as well, so check those out if you want to tweak things.  The
-// Posix math support is currently disabled (that bit of code was horrible) but
-// will be restored for the next BusyBox release.
-//#define BB_FEATURE_ASH
+// If you enabled one or more of the shells, you may select which one
+// should be run when sh is invoked:
+//#define BB_FEATURE_SH_IS_ASH
+//#define BB_FEATURE_SH_IS_HUSH
+//#define BB_FEATURE_SH_IS_LASH
+#define BB_FEATURE_SH_IS_MSH
 //
 // BusyBox will, by default, malloc space for its buffers.  This costs code
 // size for the call to xmalloc.  You can use the following feature to have
 #define BB_FEATURE_SORT_UNIQUE
 //
 // Enable command line editing in the shell.  
-// Only relevant if BB_SH is enabled. On by default.
+// Only relevant if a shell is enabled. On by default.
 #define BB_FEATURE_COMMAND_EDITING
 //
 // Enable tab completion in the shell.  This is now working quite nicely.
-// This feature adds a bit over 4k. Only relevant if BB_SH is enabled.
+// This feature adds a bit over 4k. Only relevant if a shell is enabled.
 #define BB_FEATURE_COMMAND_TAB_COMPLETION
 //
 // Attempts to match usernames in a ~-prefixed path
 //Allow the shell to invoke all the compiled in BusyBox applets as if they
 //were shell builtins.  Nice for staticly linking an emergency rescue shell,
 //among other things. Off by default.
-// Only relevant if BB_SH is enabled.
+// Only relevant if a shell is enabled.
 //#define BB_FEATURE_SH_STANDALONE_SHELL
 //
 //When this is enabled, busybox shell applets can be called using full path
 //will use BusyBox cat even if /bin/cat exists on the filesystem and is _not_
 //busybox.  Some systems want this, others do not.  Choose wisely.  :-) This
 //only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled.
-// Only relevant if BB_SH is enabled. Off by default.
+// Only relevant if a shell is enabled. Off by default.
 //#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
 //
 // Uncomment this option for a fancy shell prompt that includes the
 // current username and hostname.  On systems that don't have usernames
 // or hostnames, this can look hideous.
-// Only relevant if BB_SH is enabled.
+// Only relevant if a shell is enabled.
 //#define BB_FEATURE_SH_FANCY_PROMPT
 //
 //Turn on extra fbset options
        #undef BB_KLOGD                 /* Uses daemon() */
        #undef BB_UPDATE                /* Uses daemon() */
 #endif
-#if defined BB_SH
-       #if defined BB_FEATURE_COMMAND_EDITING 
+#if defined BB_ASH || defined BB_HUSH || defined BB_LASH || defined BB_MSH
+       #if defined BB_FEATURE_COMMAND_EDITING
                #define BB_CMDEDIT
        #else
                #undef BB_FEATURE_COMMAND_EDITING
                #define BB_LOGREAD
        #endif
 #endif
+//
+#if defined BB_ASH && defined BB_FEATURE_SH_IS_ASH
+# define BB_SH
+# define shell_main ash_main
+#elif defined BB_HUSH && defined BB_FEATURE_SH_IS_HUSH
+# define BB_SH
+# define shell_main hush_main
+#elif defined BB_LASH && defined BB_FEATURE_SH_IS_LASH
+# define BB_SH
+# define shell_main lash_main
+#elif defined BB_MSH && defined BB_FEATURE_SH_IS_MSH
+# define BB_SH
+# define shell_main msh_main
+#endif
index 88a7aa0..287c3c8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -349,7 +349,7 @@ busybox.links: busybox.mkll Config.h applets.h
        - $(SHELL) $^ >$@
 
 nfsmount.o cmdedit.o: %.o: %.h
-sh.o: cmdedit.h
+ash.o hush.o lash.o msh.o: cmdedit.h
 $(OBJECTS): %.o: %.c Config.h busybox.h applets.h Makefile
        $(CC) $(CFLAGS) -I. $(patsubst %,-I%,$(subst :, ,$(BB_SRC_DIR))) -c $< -o $*.o
 
@@ -377,8 +377,6 @@ libbb.a:  $(LIBBB_MOBJ) $(LIBBB_AROBJS) $(LIBBB_OBJS)
 
 usage.o: usage.h
 
-sh.o: sh.c lash.c hush.c msh.c ash.c
-
 libbb/loop.o: libbb/loop.h
 
 libbb/loop.h: mk_loop_h.sh
diff --git a/README b/README
index ae0215c..4f806a0 100644 (file)
--- a/README
+++ b/README
@@ -51,6 +51,38 @@ Supported kernels:
 
 ----------------
 
+Shells:
+
+lash is the very smallest shell (adds just 10k) and it is quite usable as 
+a command prompt, but it is not suitable for any but the most trivial
+scripting (such as an initrd that calls insmod a few times) since it does
+not understand Bourne shell grammer.  It does handle pipes, redirects, and
+job control though.  Adding in command editing makes it very nice
+lightweight command prompt.
+
+hush is also quite small (just 18k) and it has very complete Bourne shell
+grammer.  It handles if/then/else/fi just fine, but doesn't handle loops
+like for/do/done or case/esac and such.  It also currently has a problem
+with job control.
+
+msh: The minix shell (adds just 30k) is quite complete and handles things
+like for/do/done, case/esac and all the things you expect a Bourne shell to
+do.  It is not always pedantically correct about Bourne shell grammer (try
+running the shell testscript "tests/sh.testcases" on it and compare vs bash)
+but for most things it works quite well.  It also uses only vfork, so it can
+be used on uClinux systems.  This was only recently added, so there is still
+room to shrink it further...
+
+ash: This adds about 60k in the default configuration and is the most
+complete and most pedantically correct shell included with busybox.  This
+shell was also recently added, and several people (mainly Vladimir and Erik)
+have been working on it.  There are a number of configurable things at the
+top of ash.c as well, so check those out if you want to tweak things.  The
+Posix math support is currently disabled (that bit of code was horrible) but
+will be restored for the next BusyBox release.
+
+----------------
+
 Getting help:
 
 When you find you need help, you can check out the BusyBox mailing list
index 0786c39..184bce0 100644 (file)
--- a/applets.h
+++ b/applets.h
@@ -52,6 +52,9 @@
 #ifdef BB_AR
        APPLET(ar, ar_main, _BB_DIR_USR_BIN)
 #endif
+#ifdef BB_ASH
+       APPLET_NOUSAGE("ash", ash_main, _BB_DIR_BIN)
+#endif
 #ifdef BB_BASENAME
        APPLET(basename, basename_main, _BB_DIR_USR_BIN)
 #endif
 #ifdef BB_HOSTNAME
        APPLET(hostname, hostname_main, _BB_DIR_BIN)
 #endif
+#ifdef BB_HUSH
+       APPLET_NOUSAGE("hush", hush_main, _BB_DIR_BIN)
+#endif
 #ifdef BB_ID
        APPLET(id, id_main, _BB_DIR_USR_BIN)
 #endif
 #ifdef BB_KLOGD
        APPLET(klogd, klogd_main, _BB_DIR_SBIN)
 #endif
+#ifdef BB_LASH
+       APPLET(lash, lash_main, _BB_DIR_BIN)
+#endif
 #ifdef BB_LENGTH
        APPLET(length, length_main, _BB_DIR_USR_BIN)
 #endif
 #ifdef BB_MOUNT
        APPLET(mount, mount_main, _BB_DIR_BIN)
 #endif
+#ifdef BB_MSH
+       APPLET_NOUSAGE("msh", msh_main, _BB_DIR_BIN)
+#endif
 #ifdef BB_MT
        APPLET(mt, mt_main, _BB_DIR_BIN)
 #endif
 #ifdef BB_SETKEYCODES
        APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN)
 #endif
-#ifdef BB_SH
-       APPLET(sh, shell_main, _BB_DIR_BIN)
+#ifdef BB_FEATURE_SH_IS_ASH
+       APPLET_NOUSAGE("sh", ash_main, _BB_DIR_BIN)
+#elif defined(BB_FEATURE_SH_IS_HUSH)
+       APPLET_NOUSAGE("sh", hush_main, _BB_DIR_BIN)
+#elif defined(BB_FEATURE_SH_IS_LASH)
+       APPLET_NOUSAGE("sh", lash_main, _BB_DIR_BIN)
+#elif defined(BB_FEATURE_SH_IS_MSH)
+       APPLET_NOUSAGE("sh", msh_main, _BB_DIR_BIN)
 #endif
 #ifdef BB_SLEEP
        APPLET(sleep, sleep_main, _BB_DIR_BIN)
index 08da42b..13759d2 100644 (file)
 #define setkeycodes_example_usage \
        "$ setkeycodes e030 127\n"
 
-#define sh_trivial_usage \
+#define lash_trivial_usage \
        "[FILE]...\n" \
        "or: sh -c command [args]..."
-#define sh_full_usage \
+#define lash_full_usage \
        "lash: The BusyBox LAme SHell (command interpreter)"
-#define sh_notes_usage \
+#define lash_notes_usage \
 "This command does not yet have proper documentation.\n" \
 "\n" \
 "Use lash just as you would use any other shell.  It properly handles pipes,\n" \
diff --git a/ash.c b/ash.c
index 15e1adb..b1aec62 100644 (file)
--- a/ash.c
+++ b/ash.c
@@ -7638,7 +7638,7 @@ static void procargs (int, char **);
  */
 
 int
-shell_main(argc, argv)
+ash_main(argc, argv)
        int argc;
        char **argv;
 {
@@ -12874,7 +12874,7 @@ findvar(struct var **vpp, const char *name)
 /*
  * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
  * This file contains code for the times builtin.
- * $Id: ash.c,v 1.15 2001/07/31 21:38:23 andersen Exp $
+ * $Id: ash.c,v 1.16 2001/08/01 17:21:33 kraai Exp $
  */
 static int timescmd (int argc, char **argv)
 {
index 93f5597..020f89d 100644 (file)
@@ -9,6 +9,7 @@
 // BusyBox Applications
 //#define BB_ADJTIMEX
 #define BB_AR
+//#define BB_ASH
 #define BB_BASENAME
 #define BB_CAT
 #define BB_CHGRP
@@ -51,6 +52,7 @@
 #define BB_HEAD
 //#define BB_HOSTID
 //#define BB_HOSTNAME
+//#define BB_HUSH
 #define BB_ID
 //#define BB_IFCONFIG
 #define BB_INIT
@@ -58,6 +60,7 @@
 #define BB_KILL
 #define BB_KILLALL
 #define BB_KLOGD
+//#define BB_LASH
 //#define BB_LENGTH
 #define BB_LN
 //#define BB_LOADACM
@@ -78,6 +81,7 @@
 //#define BB_NC
 #define BB_MORE
 #define BB_MOUNT
+//#define BB_MSH
 //#define BB_MT
 #define BB_MV
 //#define BB_NSLOOKUP
 //#define BB_RPM2CPIO
 #define BB_SED
 //#define BB_SETKEYCODES
-//#define BB_SH
 #define BB_SLEEP
 #define BB_SORT
 //#define BB_STTY
 // pretty/useful).
 //
 //
-// If you enabled BB_SH above, you may select one of the following shells.  
-// You can only select ONE of the following shells.  Sorry.
-//
-// lash is the very smallest shell (adds just 10k) and it is quite usable as a
-// command prompt, but it is not suitable for any but the most trivial scripting
-// (such as an initrd that calls insmod a few times) since it does not
-// understand Bourne shell grammer.  It does handle pipes, redirects, and job
-// control though.  Adding in command editing makes it very nice lightweight
-// command prompt.
-//#define BB_FEATURE_LASH
-//
-// hush is also quite small (just 18k) and it has very complete Bourne shell
-// grammer.  It handles if/then/else/fi just fine, but doesn't handle loops
-// like for/do/done or case/esac and such.  It also currently has a problem
-// with job control.
-//#define BB_FEATURE_HUSH
-//
-// msh: The minix shell (adds just 30k) is quite complete and handles things
-// like for/do/done, case/esac and all the things you expect a Bourne shell to
-// do.  It is not always pedantically correct about Bourne shell grammer (try
-// running the shell testscript "tests/sh.testcases" on it and compare vs
-// bash) but for most things it works quite well.  It also uses only vfork, so
-// it can be used on uClinux systems.  This was only recently added, so there is 
-// still room to shrink  it further...
-#define BB_FEATURE_MSH
-//
-// ash: This adds about 60k in the default configuration and is the most
-// complete and most pedantically correct shell included with busybox.  This
-// shell was also recently added, and several people (mainly Vladimir and Erik)
-// have been working on it.  There are a number of configurable things at the
-// top of ash.c as well, so check those out if you want to tweak things.  The
-// Posix math support is currently disabled (that bit of code was horrible) but
-// will be restored for the next BusyBox release.
-//#define BB_FEATURE_ASH
+// If you enabled one or more of the shells, you may select which one
+// should be run when sh is invoked:
+//#define BB_FEATURE_SH_IS_ASH
+//#define BB_FEATURE_SH_IS_HUSH
+//#define BB_FEATURE_SH_IS_LASH
+#define BB_FEATURE_SH_IS_MSH
 //
 // BusyBox will, by default, malloc space for its buffers.  This costs code
 // size for the call to xmalloc.  You can use the following feature to have
 #define BB_FEATURE_SORT_UNIQUE
 //
 // Enable command line editing in the shell.  
-// Only relevant if BB_SH is enabled. On by default.
+// Only relevant if a shell is enabled. On by default.
 #define BB_FEATURE_COMMAND_EDITING
 //
 // Enable tab completion in the shell.  This is now working quite nicely.
-// This feature adds a bit over 4k. Only relevant if BB_SH is enabled.
+// This feature adds a bit over 4k. Only relevant if a shell is enabled.
 #define BB_FEATURE_COMMAND_TAB_COMPLETION
 //
 // Attempts to match usernames in a ~-prefixed path
 //Allow the shell to invoke all the compiled in BusyBox applets as if they
 //were shell builtins.  Nice for staticly linking an emergency rescue shell,
 //among other things. Off by default.
-// Only relevant if BB_SH is enabled.
+// Only relevant if a shell is enabled.
 //#define BB_FEATURE_SH_STANDALONE_SHELL
 //
 //When this is enabled, busybox shell applets can be called using full path
 //will use BusyBox cat even if /bin/cat exists on the filesystem and is _not_
 //busybox.  Some systems want this, others do not.  Choose wisely.  :-) This
 //only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled.
-// Only relevant if BB_SH is enabled. Off by default.
+// Only relevant if a shell is enabled. Off by default.
 //#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
 //
 // Uncomment this option for a fancy shell prompt that includes the
 // current username and hostname.  On systems that don't have usernames
 // or hostnames, this can look hideous.
-// Only relevant if BB_SH is enabled.
+// Only relevant if a shell is enabled.
 //#define BB_FEATURE_SH_FANCY_PROMPT
 //
 //Turn on extra fbset options
 // Nothing beyond this point should ever be touched by 
 // mere mortals so leave this stuff alone.
 //
-#if defined BB_SH
-       #if defined BB_FEATURE_COMMAND_EDITING 
+#if defined BB_ASH || defined BB_HUSH || defined BB_LASH || defined BB_MSH
+       #if defined BB_FEATURE_COMMAND_EDITING
                #define BB_CMDEDIT
        #else
                #undef BB_FEATURE_COMMAND_EDITING
                #define BB_LOGREAD
        #endif
 #endif
+//
+#if defined BB_ASH && defined BB_FEATURE_SH_IS_ASH
+# define BB_SH
+# define shell_main ash_main
+#elif defined BB_HUSH && defined BB_FEATURE_SH_IS_HUSH
+# define BB_SH
+# define shell_main hush_main
+#elif defined BB_LASH && defined BB_FEATURE_SH_IS_LASH
+# define BB_SH
+# define shell_main lash_main
+#elif defined BB_MSH && defined BB_FEATURE_SH_IS_MSH
+# define BB_SH
+# define shell_main msh_main
+#endif
index e049b5a..a538b1a 100644 (file)
@@ -9,6 +9,7 @@
 // BusyBox Applications
 //#define BB_ADJTIMEX
 #define BB_AR
+#define BB_ASH
 #define BB_BASENAME
 #define BB_CAT
 #define BB_CHGRP
@@ -51,6 +52,7 @@
 #define BB_HEAD
 #define BB_HOSTID
 #define BB_HOSTNAME
+#define BB_HUSH
 #define BB_ID
 #define BB_IFCONFIG
 #define BB_INIT
@@ -58,6 +60,7 @@
 #define BB_KILL
 #define BB_KILLALL
 #define BB_KLOGD
+#define BB_LASH
 #define BB_LENGTH
 #define BB_LN
 #define BB_LOADACM
@@ -78,6 +81,7 @@
 #define BB_NC
 #define BB_MORE
 #define BB_MOUNT
+#define BB_MSH
 #define BB_MT
 #define BB_MV
 #define BB_NSLOOKUP
 #define BB_RPM2CPIO
 #define BB_SED
 #define BB_SETKEYCODES
-#define BB_SH
 #define BB_SLEEP
 #define BB_SORT
 #define BB_STTY
 // pretty/useful).
 //
 //
-// If you enabled BB_SH above, you may select one of the following shells.  
-// You can only select ONE of the following shells.  Sorry.
-//
-// lash is the very smallest shell (adds just 10k) and it is quite usable as a
-// command prompt, but it is not suitable for any but the most trivial scripting
-// (such as an initrd that calls insmod a few times) since it does not
-// understand Bourne shell grammer.  It does handle pipes, redirects, and job
-// control though.  Adding in command editing makes it very nice lightweight
-// command prompt.
-//#define BB_FEATURE_LASH
-//
-// hush is also quite small (just 18k) and it has very complete Bourne shell
-// grammer.  It handles if/then/else/fi just fine, but doesn't handle loops
-// like for/do/done or case/esac and such.  It also currently has a problem
-// with job control.
-//#define BB_FEATURE_HUSH
-//
-// msh: The minix shell (adds just 30k) is quite complete and handles things
-// like for/do/done, case/esac and all the things you expect a Bourne shell to
-// do.  It is not always pedantically correct about Bourne shell grammer (try
-// running the shell testscript "tests/sh.testcases" on it and compare vs
-// bash) but for most things it works quite well.  It also uses only vfork, so
-// it can be used on uClinux systems.  This was only recently added, so there is 
-// still room to shrink it further...
-//#define BB_FEATURE_MSH
-//
-// ash: This adds about 60k in the default configuration and is the most
-// complete and most pedantically correct shell included with busybox.  This
-// shell was also recently added, and several people (mainly Vladimir and Erik)
-// have been working on it.  There are a number of configurable things at the
-// top of ash.c as well, so check those out if you want to tweak things.  The
-// Posix math support is currently disabled (that bit of code was horrible) but
-// will be restored for the next BusyBox release.
-#define BB_FEATURE_ASH
+// If you enabled one or more of the shells, you may select which one
+// should be run when sh is invoked:
+//#define BB_FEATURE_SH_IS_ASH
+//#define BB_FEATURE_SH_IS_HUSH
+//#define BB_FEATURE_SH_IS_LASH
+#define BB_FEATURE_SH_IS_MSH
 //
 // BusyBox will, by default, malloc space for its buffers.  This costs code
 // size for the call to xmalloc.  You can use the following feature to have
 #define BB_FEATURE_SORT_UNIQUE
 //
 // Enable command line editing in the shell.  
-// Only relevant if BB_SH is enabled. On by default.
+// Only relevant if a shell is enabled. On by default.
 #define BB_FEATURE_COMMAND_EDITING
 //
 // Enable tab completion in the shell.  This is now working quite nicely.
-// This feature adds a bit over 4k. Only relevant if BB_SH is enabled.
+// This feature adds a bit over 4k. Only relevant if a shell is enabled.
 #define BB_FEATURE_COMMAND_TAB_COMPLETION
 //
 // Attempts to match usernames in a ~-prefixed path
 //Allow the shell to invoke all the compiled in BusyBox applets as if they
 //were shell builtins.  Nice for staticly linking an emergency rescue shell,
 //among other things. Off by default.
-// Only relevant if BB_SH is enabled.
+// Only relevant if a shell is enabled.
 #define BB_FEATURE_SH_STANDALONE_SHELL
 //
 //When this is enabled, busybox shell applets can be called using full path
 //will use BusyBox cat even if /bin/cat exists on the filesystem and is _not_
 //busybox.  Some systems want this, others do not.  Choose wisely.  :-) This
 //only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled.
-// Only relevant if BB_SH is enabled. Off by default.
+// Only relevant if a shell is enabled. Off by default.
 #define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
 //
 // Uncomment this option for a fancy shell prompt that includes the
 // current username and hostname.  On systems that don't have usernames
 // or hostnames, this can look hideous.
-// Only relevant if BB_SH is enabled.
+// Only relevant if a shell is enabled.
 #define BB_FEATURE_SH_FANCY_PROMPT
 //
 //Turn on extra fbset options
 // Nothing beyond this point should ever be touched by 
 // mere mortals so leave this stuff alone.
 //
-#if defined BB_SH
-       #if defined BB_FEATURE_COMMAND_EDITING 
+#if defined BB_ASH || defined BB_HUSH || defined BB_LASH || defined BB_MSH
+       #if defined BB_FEATURE_COMMAND_EDITING
                #define BB_CMDEDIT
        #else
                #undef BB_FEATURE_COMMAND_EDITING
                #define BB_LOGREAD
        #endif
 #endif
+//
+#if defined BB_ASH && defined BB_FEATURE_SH_IS_ASH
+# define BB_SH
+# define shell_main ash_main
+#elif defined BB_HUSH && defined BB_FEATURE_SH_IS_HUSH
+# define BB_SH
+# define shell_main hush_main
+#elif defined BB_LASH && defined BB_FEATURE_SH_IS_LASH
+# define BB_SH
+# define shell_main lash_main
+#elif defined BB_MSH && defined BB_FEATURE_SH_IS_MSH
+# define BB_SH
+# define shell_main msh_main
+#endif
index dfc32f6..172d3dc 100644 (file)
@@ -9,6 +9,7 @@
 // BusyBox Applications
 //#define BB_ADJTIMEX
 //#define BB_AR
+//#define BB_ASH
 #define BB_BASENAME
 #define BB_CAT
 #define BB_CHGRP
@@ -51,6 +52,7 @@
 #define BB_HEAD
 //#define BB_HOSTID
 //#define BB_HOSTNAME
+//#define BB_HUSH
 #define BB_ID
 //#define BB_IFCONFIG
 #define BB_INIT
@@ -58,6 +60,7 @@
 #define BB_KILL
 #define BB_KILLALL
 #define BB_KLOGD
+//#define BB_LASH
 //#define BB_LENGTH
 #define BB_LN
 //#define BB_LOADACM
@@ -78,6 +81,7 @@
 //#define BB_NC
 #define BB_MORE
 #define BB_MOUNT
+//#define BB_MSH
 //#define BB_MT
 #define BB_MV
 //#define BB_NSLOOKUP
 //#define BB_RPM2CPIO
 #define BB_SED
 //#define BB_SETKEYCODES
-//#define BB_SH
 #define BB_SLEEP
 #define BB_SORT
 //#define BB_STTY
 // pretty/useful).
 //
 //
-// If you enabled BB_SH above, you may select one of the following shells.  
-// You can only select ONE of the following shells.  Sorry.
-//
-// lash is the very smallest shell (adds just 10k) and it is quite usable as a
-// command prompt, but it is not suitable for any but the most trivial scripting
-// (such as an initrd that calls insmod a few times) since it does not
-// understand Bourne shell grammer.  It does handle pipes, redirects, and job
-// control though.  Adding in command editing makes it very nice lightweight
-// command prompt.
-//#define BB_FEATURE_LASH
-//
-// hush is also quite small (just 18k) and it has very complete Bourne shell
-// grammer.  It handles if/then/else/fi just fine, but doesn't handle loops
-// like for/do/done or case/esac and such.  It also currently has a problem
-// with job control.
-//#define BB_FEATURE_HUSH
-//
-// msh: The minix shell (adds just 30k) is quite complete and handles things
-// like for/do/done, case/esac and all the things you expect a Bourne shell to
-// do.  It is not always pedantically correct about Bourne shell grammer (try
-// running the shell testscript "tests/sh.testcases" on it and compare vs
-// bash) but for most things it works quite well.  It also uses only vfork, so
-// it can be used on uClinux systems.  This was only recently added, so there is 
-// still room to shrink  it further...
-#define BB_FEATURE_MSH
-//
-// ash: This adds about 60k in the default configuration and is the most
-// complete and most pedantically correct shell included with busybox.  This
-// shell was also recently added, and several people (mainly Vladimir and Erik)
-// have been working on it.  There are a number of configurable things at the
-// top of ash.c as well, so check those out if you want to tweak things.  The
-// Posix math support is currently disabled (that bit of code was horrible) but
-// will be restored for the next BusyBox release.
-//#define BB_FEATURE_ASH
+// If you enabled one or more of the shells, you may select which one
+// should be run when sh is invoked:
+//#define BB_FEATURE_SH_IS_ASH
+//#define BB_FEATURE_SH_IS_HUSH
+//#define BB_FEATURE_SH_IS_LASH
+#define BB_FEATURE_SH_IS_MSH
 //
 // BusyBox will, by default, malloc space for its buffers.  This costs code
 // size for the call to xmalloc.  You can use the following feature to have
 #define BB_FEATURE_SORT_UNIQUE
 //
 // Enable command line editing in the shell.  
-// Only relevant if BB_SH is enabled. On by default.
+// Only relevant if a shell is enabled. On by default.
 #define BB_FEATURE_COMMAND_EDITING
 //
 // Enable tab completion in the shell.  This is now working quite nicely.
-// This feature adds a bit over 4k. Only relevant if BB_SH is enabled.
+// This feature adds a bit over 4k. Only relevant if a shell is enabled.
 #define BB_FEATURE_COMMAND_TAB_COMPLETION
 //
 // Attempts to match usernames in a ~-prefixed path
 //Allow the shell to invoke all the compiled in BusyBox applets as if they
 //were shell builtins.  Nice for staticly linking an emergency rescue shell,
 //among other things. Off by default.
-// Only relevant if BB_SH is enabled.
+// Only relevant if a shell is enabled.
 //#define BB_FEATURE_SH_STANDALONE_SHELL
 //
 //When this is enabled, busybox shell applets can be called using full path
 //will use BusyBox cat even if /bin/cat exists on the filesystem and is _not_
 //busybox.  Some systems want this, others do not.  Choose wisely.  :-) This
 //only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled.
-// Only relevant if BB_SH is enabled. Off by default.
+// Only relevant if a shell is enabled. Off by default.
 //#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
 //
 // Uncomment this option for a fancy shell prompt that includes the
 // current username and hostname.  On systems that don't have usernames
 // or hostnames, this can look hideous.
-// Only relevant if BB_SH is enabled.
+// Only relevant if a shell is enabled.
 //#define BB_FEATURE_SH_FANCY_PROMPT
 //
 //Turn on extra fbset options
 // Nothing beyond this point should ever be touched by 
 // mere mortals so leave this stuff alone.
 //
-#if defined BB_SH
-       #if defined BB_FEATURE_COMMAND_EDITING 
+#if defined BB_ASH || defined BB_HUSH || defined BB_LASH || defined BB_MSH
+       #if defined BB_FEATURE_COMMAND_EDITING
                #define BB_CMDEDIT
        #else
                #undef BB_FEATURE_COMMAND_EDITING
                #define BB_LOGREAD
        #endif
 #endif
+//
+#if defined BB_ASH && defined BB_FEATURE_SH_IS_ASH
+# define BB_SH
+# define shell_main ash_main
+#elif defined BB_HUSH && defined BB_FEATURE_SH_IS_HUSH
+# define BB_SH
+# define shell_main hush_main
+#elif defined BB_LASH && defined BB_FEATURE_SH_IS_LASH
+# define BB_SH
+# define shell_main lash_main
+#elif defined BB_MSH && defined BB_FEATURE_SH_IS_MSH
+# define BB_SH
+# define shell_main msh_main
+#endif
diff --git a/hush.c b/hush.c
index 1344042..0e619f8 100644 (file)
--- a/hush.c
+++ b/hush.c
 #else
 #define applet_name "hush"
 #include "standalone.h"
-#define shell_main main
+#define hush_main main
 #undef BB_FEATURE_SH_FANCY_PROMPT
 #endif
 
@@ -2562,7 +2562,7 @@ static void setup_job_control()
        tcsetpgrp(shell_terminal, shell_pgrp);
 }
 
-int shell_main(int argc, char **argv)
+int hush_main(int argc, char **argv)
 {
        int opt;
        FILE *input;
@@ -2572,8 +2572,8 @@ int shell_main(int argc, char **argv)
        global_argc = argc;
        global_argv = argv;
        
-       /* (re?) initialize globals.  Sometimes shell_main() ends up calling
-        * shell_main(), therefore we cannot rely on the BSS to zero out this 
+       /* (re?) initialize globals.  Sometimes hush_main() ends up calling
+        * hush_main(), therefore we cannot rely on the BSS to zero out this 
         * stuff.  Reset these to 0 every time. */
        ifs = NULL;
        /* map[] is taken care of with call to update_ifs_map() */
index 0786c39..184bce0 100644 (file)
@@ -52,6 +52,9 @@
 #ifdef BB_AR
        APPLET(ar, ar_main, _BB_DIR_USR_BIN)
 #endif
+#ifdef BB_ASH
+       APPLET_NOUSAGE("ash", ash_main, _BB_DIR_BIN)
+#endif
 #ifdef BB_BASENAME
        APPLET(basename, basename_main, _BB_DIR_USR_BIN)
 #endif
 #ifdef BB_HOSTNAME
        APPLET(hostname, hostname_main, _BB_DIR_BIN)
 #endif
+#ifdef BB_HUSH
+       APPLET_NOUSAGE("hush", hush_main, _BB_DIR_BIN)
+#endif
 #ifdef BB_ID
        APPLET(id, id_main, _BB_DIR_USR_BIN)
 #endif
 #ifdef BB_KLOGD
        APPLET(klogd, klogd_main, _BB_DIR_SBIN)
 #endif
+#ifdef BB_LASH
+       APPLET(lash, lash_main, _BB_DIR_BIN)
+#endif
 #ifdef BB_LENGTH
        APPLET(length, length_main, _BB_DIR_USR_BIN)
 #endif
 #ifdef BB_MOUNT
        APPLET(mount, mount_main, _BB_DIR_BIN)
 #endif
+#ifdef BB_MSH
+       APPLET_NOUSAGE("msh", msh_main, _BB_DIR_BIN)
+#endif
 #ifdef BB_MT
        APPLET(mt, mt_main, _BB_DIR_BIN)
 #endif
 #ifdef BB_SETKEYCODES
        APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN)
 #endif
-#ifdef BB_SH
-       APPLET(sh, shell_main, _BB_DIR_BIN)
+#ifdef BB_FEATURE_SH_IS_ASH
+       APPLET_NOUSAGE("sh", ash_main, _BB_DIR_BIN)
+#elif defined(BB_FEATURE_SH_IS_HUSH)
+       APPLET_NOUSAGE("sh", hush_main, _BB_DIR_BIN)
+#elif defined(BB_FEATURE_SH_IS_LASH)
+       APPLET_NOUSAGE("sh", lash_main, _BB_DIR_BIN)
+#elif defined(BB_FEATURE_SH_IS_MSH)
+       APPLET_NOUSAGE("sh", msh_main, _BB_DIR_BIN)
 #endif
 #ifdef BB_SLEEP
        APPLET(sleep, sleep_main, _BB_DIR_BIN)
index 08da42b..13759d2 100644 (file)
 #define setkeycodes_example_usage \
        "$ setkeycodes e030 127\n"
 
-#define sh_trivial_usage \
+#define lash_trivial_usage \
        "[FILE]...\n" \
        "or: sh -c command [args]..."
-#define sh_full_usage \
+#define lash_full_usage \
        "lash: The BusyBox LAme SHell (command interpreter)"
-#define sh_notes_usage \
+#define lash_notes_usage \
 "This command does not yet have proper documentation.\n" \
 "\n" \
 "Use lash just as you would use any other shell.  It properly handles pipes,\n" \
diff --git a/lash.c b/lash.c
index 8f86095..0af6691 100644 (file)
--- a/lash.c
+++ b/lash.c
@@ -1545,7 +1545,7 @@ static void setup_job_control()
        tcsetpgrp(shell_terminal, shell_pgrp);
 }
 
-int shell_main(int argc_l, char **argv_l)
+int lash_main(int argc_l, char **argv_l)
 {
        int opt, interactive=FALSE;
        FILE *input = stdin;
diff --git a/msh.c b/msh.c
index 8f046e7..92a0f85 100644 (file)
--- a/msh.c
+++ b/msh.c
@@ -143,7 +143,7 @@ static int newfile(char *s);
 static char *findeq(char *cp);
 static char *cclass(char *p, int sub);
 static void initarea(void);
-extern int shell_main(int argc, char **argv);
+extern int msh_main(int argc, char **argv);
 
 
 struct brkcon {
@@ -692,7 +692,7 @@ static char * current_prompt;
  */
 
 
-extern int shell_main(int argc, char **argv)
+extern int msh_main(int argc, char **argv)
 {
        register int f;
        register char *s;
diff --git a/sh.c b/sh.c
deleted file mode 100644 (file)
index f5c06b4..0000000
--- a/sh.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * Shell wrapper file for busybox
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "Config.h"
-
-/* This is to make testing things a bit simpler (to avoid
- * a full recompile) till we get the new build system in place */
-#if 0
-#undef BB_FEATURE_LASH
-#undef BB_FEATURE_HUSH
-#undef BB_FEATURE_MSH
-#define BB_FEATURE_ASH
-#endif
-
-#if defined BB_FEATURE_ASH
-#include "ash.c"
-#elif defined BB_FEATURE_MSH
-#include "msh.c"
-#elif defined BB_FEATURE_HUSH
-#include "hush.c"
-#elif defined BB_FEATURE_LASH
-#include "lash.c"
-#endif 
-
-/*
-Local Variables:
-c-file-style: "linux"
-c-basic-offset: 4
-tab-width: 4
-End:
-*/
index 15e1adb..b1aec62 100644 (file)
@@ -7638,7 +7638,7 @@ static void procargs (int, char **);
  */
 
 int
-shell_main(argc, argv)
+ash_main(argc, argv)
        int argc;
        char **argv;
 {
@@ -12874,7 +12874,7 @@ findvar(struct var **vpp, const char *name)
 /*
  * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
  * This file contains code for the times builtin.
- * $Id: ash.c,v 1.15 2001/07/31 21:38:23 andersen Exp $
+ * $Id: ash.c,v 1.16 2001/08/01 17:21:33 kraai Exp $
  */
 static int timescmd (int argc, char **argv)
 {
index 1344042..0e619f8 100644 (file)
 #else
 #define applet_name "hush"
 #include "standalone.h"
-#define shell_main main
+#define hush_main main
 #undef BB_FEATURE_SH_FANCY_PROMPT
 #endif
 
@@ -2562,7 +2562,7 @@ static void setup_job_control()
        tcsetpgrp(shell_terminal, shell_pgrp);
 }
 
-int shell_main(int argc, char **argv)
+int hush_main(int argc, char **argv)
 {
        int opt;
        FILE *input;
@@ -2572,8 +2572,8 @@ int shell_main(int argc, char **argv)
        global_argc = argc;
        global_argv = argv;
        
-       /* (re?) initialize globals.  Sometimes shell_main() ends up calling
-        * shell_main(), therefore we cannot rely on the BSS to zero out this 
+       /* (re?) initialize globals.  Sometimes hush_main() ends up calling
+        * hush_main(), therefore we cannot rely on the BSS to zero out this 
         * stuff.  Reset these to 0 every time. */
        ifs = NULL;
        /* map[] is taken care of with call to update_ifs_map() */
index 8f86095..0af6691 100644 (file)
@@ -1545,7 +1545,7 @@ static void setup_job_control()
        tcsetpgrp(shell_terminal, shell_pgrp);
 }
 
-int shell_main(int argc_l, char **argv_l)
+int lash_main(int argc_l, char **argv_l)
 {
        int opt, interactive=FALSE;
        FILE *input = stdin;
index 8f046e7..92a0f85 100644 (file)
@@ -143,7 +143,7 @@ static int newfile(char *s);
 static char *findeq(char *cp);
 static char *cclass(char *p, int sub);
 static void initarea(void);
-extern int shell_main(int argc, char **argv);
+extern int msh_main(int argc, char **argv);
 
 
 struct brkcon {
@@ -692,7 +692,7 @@ static char * current_prompt;
  */
 
 
-extern int shell_main(int argc, char **argv)
+extern int msh_main(int argc, char **argv)
 {
        register int f;
        register char *s;
diff --git a/usage.h b/usage.h
index 08da42b..13759d2 100644 (file)
--- a/usage.h
+++ b/usage.h
 #define setkeycodes_example_usage \
        "$ setkeycodes e030 127\n"
 
-#define sh_trivial_usage \
+#define lash_trivial_usage \
        "[FILE]...\n" \
        "or: sh -c command [args]..."
-#define sh_full_usage \
+#define lash_full_usage \
        "lash: The BusyBox LAme SHell (command interpreter)"
-#define sh_notes_usage \
+#define lash_notes_usage \
 "This command does not yet have proper documentation.\n" \
 "\n" \
 "Use lash just as you would use any other shell.  It properly handles pipes,\n" \