-- 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
// BusyBox Applications
//#define BB_ADJTIMEX
//#define BB_AR
+//#define BB_ASH
#define BB_BASENAME
#define BB_CAT
#define BB_CHGRP
#define BB_HEAD
//#define BB_HOSTID
//#define BB_HOSTNAME
+//#define BB_HUSH
#define BB_ID
//#define BB_IFCONFIG
#define BB_INIT
#define BB_KILL
#define BB_KILLALL
#define BB_KLOGD
+//#define BB_LASH
//#define BB_LENGTH
#define BB_LN
//#define BB_LOADACM
#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
- $(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
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
----------------
+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
#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)
#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" \
*/
int
-shell_main(argc, argv)
+ash_main(argc, argv)
int argc;
char **argv;
{
/*
* 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)
{
// BusyBox Applications
//#define BB_ADJTIMEX
#define BB_AR
+//#define BB_ASH
#define BB_BASENAME
#define BB_CAT
#define BB_CHGRP
#define BB_HEAD
//#define BB_HOSTID
//#define BB_HOSTNAME
+//#define BB_HUSH
#define BB_ID
//#define BB_IFCONFIG
#define BB_INIT
#define BB_KILL
#define BB_KILLALL
#define BB_KLOGD
+//#define BB_LASH
//#define BB_LENGTH
#define BB_LN
//#define BB_LOADACM
//#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
// BusyBox Applications
//#define BB_ADJTIMEX
#define BB_AR
+#define BB_ASH
#define BB_BASENAME
#define BB_CAT
#define BB_CHGRP
#define BB_HEAD
#define BB_HOSTID
#define BB_HOSTNAME
+#define BB_HUSH
#define BB_ID
#define BB_IFCONFIG
#define BB_INIT
#define BB_KILL
#define BB_KILLALL
#define BB_KLOGD
+#define BB_LASH
#define BB_LENGTH
#define BB_LN
#define BB_LOADACM
#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
// BusyBox Applications
//#define BB_ADJTIMEX
//#define BB_AR
+//#define BB_ASH
#define BB_BASENAME
#define BB_CAT
#define BB_CHGRP
#define BB_HEAD
//#define BB_HOSTID
//#define BB_HOSTNAME
+//#define BB_HUSH
#define BB_ID
//#define BB_IFCONFIG
#define BB_INIT
#define BB_KILL
#define BB_KILLALL
#define BB_KLOGD
+//#define BB_LASH
//#define BB_LENGTH
#define BB_LN
//#define BB_LOADACM
//#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
#else
#define applet_name "hush"
#include "standalone.h"
-#define shell_main main
+#define hush_main main
#undef BB_FEATURE_SH_FANCY_PROMPT
#endif
tcsetpgrp(shell_terminal, shell_pgrp);
}
-int shell_main(int argc, char **argv)
+int hush_main(int argc, char **argv)
{
int opt;
FILE *input;
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() */
#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)
#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" \
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;
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 {
*/
-extern int shell_main(int argc, char **argv)
+extern int msh_main(int argc, char **argv)
{
register int f;
register char *s;
+++ /dev/null
-/* 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:
-*/
*/
int
-shell_main(argc, argv)
+ash_main(argc, argv)
int argc;
char **argv;
{
/*
* 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)
{
#else
#define applet_name "hush"
#include "standalone.h"
-#define shell_main main
+#define hush_main main
#undef BB_FEATURE_SH_FANCY_PROMPT
#endif
tcsetpgrp(shell_terminal, shell_pgrp);
}
-int shell_main(int argc, char **argv)
+int hush_main(int argc, char **argv)
{
int opt;
FILE *input;
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() */
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;
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 {
*/
-extern int shell_main(int argc, char **argv)
+extern int msh_main(int argc, char **argv)
{
register int f;
register char *s;
#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" \