summaryrefslogtreecommitdiff
authorMatt Kraai <kraai@debian.org>2001-08-01 17:21:35 (GMT)
committer Matt Kraai <kraai@debian.org>2001-08-01 17:21:35 (GMT)
commit2d91deba45d5a284614e06cc55e2be03599ca26d (patch)
tree0ba0d2096b4305465ddea8532a5931cb4c02b343
parent00344431402703089c6b93f6119f9966cc7ba566 (diff)
downloadbusybox-2d91deba45d5a284614e06cc55e2be03599ca26d.zip
busybox-2d91deba45d5a284614e06cc55e2be03599ca26d.tar.gz
busybox-2d91deba45d5a284614e06cc55e2be03599ca26d.tar.bz2
Allow multiple shells to be enabled.
Diffstat
-rw-r--r--Changelog1
-rw-r--r--Config.h73
-rw-r--r--Makefile4
-rw-r--r--README32
-rw-r--r--applets.h22
-rw-r--r--applets/usage.h6
-rw-r--r--ash.c4
-rw-r--r--debian/Config.h-deb73
-rw-r--r--debian/Config.h-static73
-rw-r--r--debian/Config.h-udeb73
-rw-r--r--hush.c8
-rw-r--r--include/applets.h22
-rw-r--r--include/usage.h6
-rw-r--r--lash.c2
-rw-r--r--msh.c4
-rw-r--r--sh.c48
-rw-r--r--shell/ash.c4
-rw-r--r--shell/hush.c8
-rw-r--r--shell/lash.c2
-rw-r--r--shell/msh.c4
-rw-r--r--usage.h6
21 files changed, 225 insertions, 250 deletions
diff --git a/Changelog b/Changelog
index 45005b5..6325417 100644
--- 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
diff --git a/Config.h b/Config.h
index 4523fbc..831eb93 100644
--- 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
@@ -101,7 +105,6 @@
//#define BB_RPM2CPIO
#define BB_SED
//#define BB_SETKEYCODES
-#define BB_SH
#define BB_SLEEP
#define BB_SORT
//#define BB_STTY
@@ -146,40 +149,12 @@
// 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
@@ -286,11 +261,11 @@
#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
@@ -299,7 +274,7 @@
//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
@@ -308,13 +283,13 @@
//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
@@ -435,8 +410,8 @@
#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
@@ -494,3 +469,17 @@
#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/Makefile b/Makefile
index 88a7aa0..287c3c8 100644
--- 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
--- 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
diff --git a/applets.h b/applets.h
index 0786c39..184bce0 100644
--- 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
@@ -185,6 +188,9 @@
#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
@@ -206,6 +212,9 @@
#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
@@ -272,6 +281,9 @@
#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
@@ -344,8 +356,14 @@
#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)
diff --git a/applets/usage.h b/applets/usage.h
index 08da42b..13759d2 100644
--- a/applets/usage.h
+++ b/applets/usage.h
@@ -1365,12 +1365,12 @@
#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
--- 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)
{
diff --git a/debian/Config.h-deb b/debian/Config.h-deb
index 93f5597..020f89d 100644
--- a/debian/Config.h-deb
+++ b/debian/Config.h-deb
@@ -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
@@ -99,7 +103,6 @@
//#define BB_RPM2CPIO
#define BB_SED
//#define BB_SETKEYCODES
-//#define BB_SH
#define BB_SLEEP
#define BB_SORT
//#define BB_STTY
@@ -143,40 +146,12 @@
// 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
@@ -283,11 +258,11 @@
#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
@@ -296,7 +271,7 @@
//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
@@ -305,13 +280,13 @@
//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
@@ -416,8 +391,8 @@
// 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
@@ -482,3 +457,17 @@
#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/debian/Config.h-static b/debian/Config.h-static
index e049b5a..a538b1a 100644
--- a/debian/Config.h-static
+++ b/debian/Config.h-static
@@ -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
@@ -99,7 +103,6 @@
#define BB_RPM2CPIO
#define BB_SED
#define BB_SETKEYCODES
-#define BB_SH
#define BB_SLEEP
#define BB_SORT
#define BB_STTY
@@ -143,40 +146,12 @@
// 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
@@ -283,11 +258,11 @@
#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
@@ -296,7 +271,7 @@
//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
@@ -305,13 +280,13 @@
//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
@@ -416,8 +391,8 @@
// 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
@@ -482,3 +457,17 @@
#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/debian/Config.h-udeb b/debian/Config.h-udeb
index dfc32f6..172d3dc 100644
--- a/debian/Config.h-udeb
+++ b/debian/Config.h-udeb
@@ -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
@@ -99,7 +103,6 @@
//#define BB_RPM2CPIO
#define BB_SED
//#define BB_SETKEYCODES
-//#define BB_SH
#define BB_SLEEP
#define BB_SORT
//#define BB_STTY
@@ -143,40 +146,12 @@
// 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
@@ -283,11 +258,11 @@
#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
@@ -296,7 +271,7 @@
//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
@@ -305,13 +280,13 @@
//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
@@ -416,8 +391,8 @@
// 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
@@ -482,3 +457,17 @@
#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
--- a/hush.c
+++ b/hush.c
@@ -112,7 +112,7 @@
#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() */
diff --git a/include/applets.h b/include/applets.h
index 0786c39..184bce0 100644
--- a/include/applets.h
+++ b/include/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
@@ -185,6 +188,9 @@
#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
@@ -206,6 +212,9 @@
#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
@@ -272,6 +281,9 @@
#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
@@ -344,8 +356,14 @@
#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)
diff --git a/include/usage.h b/include/usage.h
index 08da42b..13759d2 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -1365,12 +1365,12 @@
#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
--- 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
--- 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
index f5c06b4..0000000
--- a/sh.c
+++ b/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:
-*/
diff --git a/shell/ash.c b/shell/ash.c
index 15e1adb..b1aec62 100644
--- a/shell/ash.c
+++ b/shell/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)
{
diff --git a/shell/hush.c b/shell/hush.c
index 1344042..0e619f8 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -112,7 +112,7 @@
#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() */
diff --git a/shell/lash.c b/shell/lash.c
index 8f86095..0af6691 100644
--- a/shell/lash.c
+++ b/shell/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/shell/msh.c b/shell/msh.c
index 8f046e7..92a0f85 100644
--- a/shell/msh.c
+++ b/shell/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/usage.h b/usage.h
index 08da42b..13759d2 100644
--- a/usage.h
+++ b/usage.h
@@ -1365,12 +1365,12 @@
#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" \