Allow multiple shells to be enabled.

This commit is contained in:
Matt Kraai 2001-08-01 17:21:35 +00:00
parent 0034443140
commit 2d91deba45
21 changed files with 225 additions and 250 deletions

View File

@ -42,6 +42,7 @@
-- Reworked rdate option handling (is now smaller). -- Reworked rdate option handling (is now smaller).
-- Size reduction in ping -- Size reduction in ping
-- Always write dd counts to stderr -- Always write dd counts to stderr
-- Allow multiple shells to be enabled
* Aaron Lehmann * Aaron Lehmann
-- slimmed down md5sum -- slimmed down md5sum
-- contributed a nice new (hand written, not lex/yacc) Posix math -- contributed a nice new (hand written, not lex/yacc) Posix math

View File

@ -9,6 +9,7 @@
// BusyBox Applications // BusyBox Applications
//#define BB_ADJTIMEX //#define BB_ADJTIMEX
//#define BB_AR //#define BB_AR
//#define BB_ASH
#define BB_BASENAME #define BB_BASENAME
#define BB_CAT #define BB_CAT
#define BB_CHGRP #define BB_CHGRP
@ -51,6 +52,7 @@
#define BB_HEAD #define BB_HEAD
//#define BB_HOSTID //#define BB_HOSTID
//#define BB_HOSTNAME //#define BB_HOSTNAME
//#define BB_HUSH
#define BB_ID #define BB_ID
//#define BB_IFCONFIG //#define BB_IFCONFIG
#define BB_INIT #define BB_INIT
@ -58,6 +60,7 @@
#define BB_KILL #define BB_KILL
#define BB_KILLALL #define BB_KILLALL
#define BB_KLOGD #define BB_KLOGD
//#define BB_LASH
//#define BB_LENGTH //#define BB_LENGTH
#define BB_LN #define BB_LN
//#define BB_LOADACM //#define BB_LOADACM
@ -78,6 +81,7 @@
#define BB_MODPROBE #define BB_MODPROBE
#define BB_MORE #define BB_MORE
#define BB_MOUNT #define BB_MOUNT
#define BB_MSH
//#define BB_MT //#define BB_MT
#define BB_MV #define BB_MV
//#define BB_NC //#define BB_NC
@ -101,7 +105,6 @@
//#define BB_RPM2CPIO //#define BB_RPM2CPIO
#define BB_SED #define BB_SED
//#define BB_SETKEYCODES //#define BB_SETKEYCODES
#define BB_SH
#define BB_SLEEP #define BB_SLEEP
#define BB_SORT #define BB_SORT
//#define BB_STTY //#define BB_STTY
@ -146,40 +149,12 @@
// pretty/useful). // pretty/useful).
// //
// //
// If you enabled BB_SH above, you may select one of the following shells. // If you enabled one or more of the shells, you may select which one
// You can only select ONE of the following shells. Sorry. // should be run when sh is invoked:
// //#define BB_FEATURE_SH_IS_ASH
// lash is the very smallest shell (adds just 10k) and it is quite usable as //#define BB_FEATURE_SH_IS_HUSH
// a command prompt, but it is not suitable for any but the most trivial //#define BB_FEATURE_SH_IS_LASH
// scripting (such as an initrd that calls insmod a few times) since it does #define BB_FEATURE_SH_IS_MSH
// 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
// //
// BusyBox will, by default, malloc space for its buffers. This costs code // 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 // size for the call to xmalloc. You can use the following feature to have
@ -286,11 +261,11 @@
#define BB_FEATURE_SORT_UNIQUE #define BB_FEATURE_SORT_UNIQUE
// //
// Enable command line editing in the shell. // 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 #define BB_FEATURE_COMMAND_EDITING
// //
// Enable tab completion in the shell. This is now working quite nicely. // 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 #define BB_FEATURE_COMMAND_TAB_COMPLETION
// //
// Attempts to match usernames in a ~-prefixed path // 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 //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, //were shell builtins. Nice for staticly linking an emergency rescue shell,
//among other things. Off by default. //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 //#define BB_FEATURE_SH_STANDALONE_SHELL
// //
//When this is enabled, busybox shell applets can be called using full path //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_ //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 //busybox. Some systems want this, others do not. Choose wisely. :-) This
//only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled. //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 //#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
// //
// Uncomment this option for a fancy shell prompt that includes the // Uncomment this option for a fancy shell prompt that includes the
// current username and hostname. On systems that don't have usernames // current username and hostname. On systems that don't have usernames
// or hostnames, this can look hideous. // 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 //#define BB_FEATURE_SH_FANCY_PROMPT
// //
//Turn on extra fbset options //Turn on extra fbset options
@ -435,8 +410,8 @@
#undef BB_KLOGD /* Uses daemon() */ #undef BB_KLOGD /* Uses daemon() */
#undef BB_UPDATE /* Uses daemon() */ #undef BB_UPDATE /* Uses daemon() */
#endif #endif
#if defined BB_SH #if defined BB_ASH || defined BB_HUSH || defined BB_LASH || defined BB_MSH
#if defined BB_FEATURE_COMMAND_EDITING #if defined BB_FEATURE_COMMAND_EDITING
#define BB_CMDEDIT #define BB_CMDEDIT
#else #else
#undef BB_FEATURE_COMMAND_EDITING #undef BB_FEATURE_COMMAND_EDITING
@ -494,3 +469,17 @@
#define BB_LOGREAD #define BB_LOGREAD
#endif #endif
#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

View File

@ -349,7 +349,7 @@ busybox.links: busybox.mkll Config.h applets.h
- $(SHELL) $^ >$@ - $(SHELL) $^ >$@
nfsmount.o cmdedit.o: %.o: %.h 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 $(OBJECTS): %.o: %.c Config.h busybox.h applets.h Makefile
$(CC) $(CFLAGS) -I. $(patsubst %,-I%,$(subst :, ,$(BB_SRC_DIR))) -c $< -o $*.o $(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 usage.o: usage.h
sh.o: sh.c lash.c hush.c msh.c ash.c
libbb/loop.o: libbb/loop.h libbb/loop.o: libbb/loop.h
libbb/loop.h: mk_loop_h.sh libbb/loop.h: mk_loop_h.sh

32
README
View File

@ -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: Getting help:
When you find you need help, you can check out the BusyBox mailing list When you find you need help, you can check out the BusyBox mailing list

View File

@ -52,6 +52,9 @@
#ifdef BB_AR #ifdef BB_AR
APPLET(ar, ar_main, _BB_DIR_USR_BIN) APPLET(ar, ar_main, _BB_DIR_USR_BIN)
#endif #endif
#ifdef BB_ASH
APPLET_NOUSAGE("ash", ash_main, _BB_DIR_BIN)
#endif
#ifdef BB_BASENAME #ifdef BB_BASENAME
APPLET(basename, basename_main, _BB_DIR_USR_BIN) APPLET(basename, basename_main, _BB_DIR_USR_BIN)
#endif #endif
@ -185,6 +188,9 @@
#ifdef BB_HOSTNAME #ifdef BB_HOSTNAME
APPLET(hostname, hostname_main, _BB_DIR_BIN) APPLET(hostname, hostname_main, _BB_DIR_BIN)
#endif #endif
#ifdef BB_HUSH
APPLET_NOUSAGE("hush", hush_main, _BB_DIR_BIN)
#endif
#ifdef BB_ID #ifdef BB_ID
APPLET(id, id_main, _BB_DIR_USR_BIN) APPLET(id, id_main, _BB_DIR_USR_BIN)
#endif #endif
@ -206,6 +212,9 @@
#ifdef BB_KLOGD #ifdef BB_KLOGD
APPLET(klogd, klogd_main, _BB_DIR_SBIN) APPLET(klogd, klogd_main, _BB_DIR_SBIN)
#endif #endif
#ifdef BB_LASH
APPLET(lash, lash_main, _BB_DIR_BIN)
#endif
#ifdef BB_LENGTH #ifdef BB_LENGTH
APPLET(length, length_main, _BB_DIR_USR_BIN) APPLET(length, length_main, _BB_DIR_USR_BIN)
#endif #endif
@ -272,6 +281,9 @@
#ifdef BB_MOUNT #ifdef BB_MOUNT
APPLET(mount, mount_main, _BB_DIR_BIN) APPLET(mount, mount_main, _BB_DIR_BIN)
#endif #endif
#ifdef BB_MSH
APPLET_NOUSAGE("msh", msh_main, _BB_DIR_BIN)
#endif
#ifdef BB_MT #ifdef BB_MT
APPLET(mt, mt_main, _BB_DIR_BIN) APPLET(mt, mt_main, _BB_DIR_BIN)
#endif #endif
@ -344,8 +356,14 @@
#ifdef BB_SETKEYCODES #ifdef BB_SETKEYCODES
APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN) APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN)
#endif #endif
#ifdef BB_SH #ifdef BB_FEATURE_SH_IS_ASH
APPLET(sh, shell_main, _BB_DIR_BIN) 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 #endif
#ifdef BB_SLEEP #ifdef BB_SLEEP
APPLET(sleep, sleep_main, _BB_DIR_BIN) APPLET(sleep, sleep_main, _BB_DIR_BIN)

View File

@ -1365,12 +1365,12 @@
#define setkeycodes_example_usage \ #define setkeycodes_example_usage \
"$ setkeycodes e030 127\n" "$ setkeycodes e030 127\n"
#define sh_trivial_usage \ #define lash_trivial_usage \
"[FILE]...\n" \ "[FILE]...\n" \
"or: sh -c command [args]..." "or: sh -c command [args]..."
#define sh_full_usage \ #define lash_full_usage \
"lash: The BusyBox LAme SHell (command interpreter)" "lash: The BusyBox LAme SHell (command interpreter)"
#define sh_notes_usage \ #define lash_notes_usage \
"This command does not yet have proper documentation.\n" \ "This command does not yet have proper documentation.\n" \
"\n" \ "\n" \
"Use lash just as you would use any other shell. It properly handles pipes,\n" \ "Use lash just as you would use any other shell. It properly handles pipes,\n" \

4
ash.c
View File

@ -7638,7 +7638,7 @@ static void procargs (int, char **);
*/ */
int int
shell_main(argc, argv) ash_main(argc, argv)
int argc; int argc;
char **argv; char **argv;
{ {
@ -12874,7 +12874,7 @@ findvar(struct var **vpp, const char *name)
/* /*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org> * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* This file contains code for the times builtin. * 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) static int timescmd (int argc, char **argv)
{ {

73
debian/Config.h-deb vendored
View File

@ -9,6 +9,7 @@
// BusyBox Applications // BusyBox Applications
//#define BB_ADJTIMEX //#define BB_ADJTIMEX
#define BB_AR #define BB_AR
//#define BB_ASH
#define BB_BASENAME #define BB_BASENAME
#define BB_CAT #define BB_CAT
#define BB_CHGRP #define BB_CHGRP
@ -51,6 +52,7 @@
#define BB_HEAD #define BB_HEAD
//#define BB_HOSTID //#define BB_HOSTID
//#define BB_HOSTNAME //#define BB_HOSTNAME
//#define BB_HUSH
#define BB_ID #define BB_ID
//#define BB_IFCONFIG //#define BB_IFCONFIG
#define BB_INIT #define BB_INIT
@ -58,6 +60,7 @@
#define BB_KILL #define BB_KILL
#define BB_KILLALL #define BB_KILLALL
#define BB_KLOGD #define BB_KLOGD
//#define BB_LASH
//#define BB_LENGTH //#define BB_LENGTH
#define BB_LN #define BB_LN
//#define BB_LOADACM //#define BB_LOADACM
@ -78,6 +81,7 @@
//#define BB_NC //#define BB_NC
#define BB_MORE #define BB_MORE
#define BB_MOUNT #define BB_MOUNT
//#define BB_MSH
//#define BB_MT //#define BB_MT
#define BB_MV #define BB_MV
//#define BB_NSLOOKUP //#define BB_NSLOOKUP
@ -99,7 +103,6 @@
//#define BB_RPM2CPIO //#define BB_RPM2CPIO
#define BB_SED #define BB_SED
//#define BB_SETKEYCODES //#define BB_SETKEYCODES
//#define BB_SH
#define BB_SLEEP #define BB_SLEEP
#define BB_SORT #define BB_SORT
//#define BB_STTY //#define BB_STTY
@ -143,40 +146,12 @@
// pretty/useful). // pretty/useful).
// //
// //
// If you enabled BB_SH above, you may select one of the following shells. // If you enabled one or more of the shells, you may select which one
// You can only select ONE of the following shells. Sorry. // should be run when sh is invoked:
// //#define BB_FEATURE_SH_IS_ASH
// lash is the very smallest shell (adds just 10k) and it is quite usable as a //#define BB_FEATURE_SH_IS_HUSH
// command prompt, but it is not suitable for any but the most trivial scripting //#define BB_FEATURE_SH_IS_LASH
// (such as an initrd that calls insmod a few times) since it does not #define BB_FEATURE_SH_IS_MSH
// 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
// //
// BusyBox will, by default, malloc space for its buffers. This costs code // 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 // size for the call to xmalloc. You can use the following feature to have
@ -283,11 +258,11 @@
#define BB_FEATURE_SORT_UNIQUE #define BB_FEATURE_SORT_UNIQUE
// //
// Enable command line editing in the shell. // 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 #define BB_FEATURE_COMMAND_EDITING
// //
// Enable tab completion in the shell. This is now working quite nicely. // 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 #define BB_FEATURE_COMMAND_TAB_COMPLETION
// //
// Attempts to match usernames in a ~-prefixed path // 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 //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, //were shell builtins. Nice for staticly linking an emergency rescue shell,
//among other things. Off by default. //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 //#define BB_FEATURE_SH_STANDALONE_SHELL
// //
//When this is enabled, busybox shell applets can be called using full path //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_ //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 //busybox. Some systems want this, others do not. Choose wisely. :-) This
//only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled. //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 //#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
// //
// Uncomment this option for a fancy shell prompt that includes the // Uncomment this option for a fancy shell prompt that includes the
// current username and hostname. On systems that don't have usernames // current username and hostname. On systems that don't have usernames
// or hostnames, this can look hideous. // 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 //#define BB_FEATURE_SH_FANCY_PROMPT
// //
//Turn on extra fbset options //Turn on extra fbset options
@ -416,8 +391,8 @@
// Nothing beyond this point should ever be touched by // Nothing beyond this point should ever be touched by
// mere mortals so leave this stuff alone. // mere mortals so leave this stuff alone.
// //
#if defined BB_SH #if defined BB_ASH || defined BB_HUSH || defined BB_LASH || defined BB_MSH
#if defined BB_FEATURE_COMMAND_EDITING #if defined BB_FEATURE_COMMAND_EDITING
#define BB_CMDEDIT #define BB_CMDEDIT
#else #else
#undef BB_FEATURE_COMMAND_EDITING #undef BB_FEATURE_COMMAND_EDITING
@ -482,3 +457,17 @@
#define BB_LOGREAD #define BB_LOGREAD
#endif #endif
#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

View File

@ -9,6 +9,7 @@
// BusyBox Applications // BusyBox Applications
//#define BB_ADJTIMEX //#define BB_ADJTIMEX
#define BB_AR #define BB_AR
#define BB_ASH
#define BB_BASENAME #define BB_BASENAME
#define BB_CAT #define BB_CAT
#define BB_CHGRP #define BB_CHGRP
@ -51,6 +52,7 @@
#define BB_HEAD #define BB_HEAD
#define BB_HOSTID #define BB_HOSTID
#define BB_HOSTNAME #define BB_HOSTNAME
#define BB_HUSH
#define BB_ID #define BB_ID
#define BB_IFCONFIG #define BB_IFCONFIG
#define BB_INIT #define BB_INIT
@ -58,6 +60,7 @@
#define BB_KILL #define BB_KILL
#define BB_KILLALL #define BB_KILLALL
#define BB_KLOGD #define BB_KLOGD
#define BB_LASH
#define BB_LENGTH #define BB_LENGTH
#define BB_LN #define BB_LN
#define BB_LOADACM #define BB_LOADACM
@ -78,6 +81,7 @@
#define BB_NC #define BB_NC
#define BB_MORE #define BB_MORE
#define BB_MOUNT #define BB_MOUNT
#define BB_MSH
#define BB_MT #define BB_MT
#define BB_MV #define BB_MV
#define BB_NSLOOKUP #define BB_NSLOOKUP
@ -99,7 +103,6 @@
#define BB_RPM2CPIO #define BB_RPM2CPIO
#define BB_SED #define BB_SED
#define BB_SETKEYCODES #define BB_SETKEYCODES
#define BB_SH
#define BB_SLEEP #define BB_SLEEP
#define BB_SORT #define BB_SORT
#define BB_STTY #define BB_STTY
@ -143,40 +146,12 @@
// pretty/useful). // pretty/useful).
// //
// //
// If you enabled BB_SH above, you may select one of the following shells. // If you enabled one or more of the shells, you may select which one
// You can only select ONE of the following shells. Sorry. // should be run when sh is invoked:
// //#define BB_FEATURE_SH_IS_ASH
// lash is the very smallest shell (adds just 10k) and it is quite usable as a //#define BB_FEATURE_SH_IS_HUSH
// command prompt, but it is not suitable for any but the most trivial scripting //#define BB_FEATURE_SH_IS_LASH
// (such as an initrd that calls insmod a few times) since it does not #define BB_FEATURE_SH_IS_MSH
// 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
// //
// BusyBox will, by default, malloc space for its buffers. This costs code // 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 // size for the call to xmalloc. You can use the following feature to have
@ -283,11 +258,11 @@
#define BB_FEATURE_SORT_UNIQUE #define BB_FEATURE_SORT_UNIQUE
// //
// Enable command line editing in the shell. // 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 #define BB_FEATURE_COMMAND_EDITING
// //
// Enable tab completion in the shell. This is now working quite nicely. // 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 #define BB_FEATURE_COMMAND_TAB_COMPLETION
// //
// Attempts to match usernames in a ~-prefixed path // 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 //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, //were shell builtins. Nice for staticly linking an emergency rescue shell,
//among other things. Off by default. //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 #define BB_FEATURE_SH_STANDALONE_SHELL
// //
//When this is enabled, busybox shell applets can be called using full path //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_ //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 //busybox. Some systems want this, others do not. Choose wisely. :-) This
//only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled. //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 #define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
// //
// Uncomment this option for a fancy shell prompt that includes the // Uncomment this option for a fancy shell prompt that includes the
// current username and hostname. On systems that don't have usernames // current username and hostname. On systems that don't have usernames
// or hostnames, this can look hideous. // 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 #define BB_FEATURE_SH_FANCY_PROMPT
// //
//Turn on extra fbset options //Turn on extra fbset options
@ -416,8 +391,8 @@
// Nothing beyond this point should ever be touched by // Nothing beyond this point should ever be touched by
// mere mortals so leave this stuff alone. // mere mortals so leave this stuff alone.
// //
#if defined BB_SH #if defined BB_ASH || defined BB_HUSH || defined BB_LASH || defined BB_MSH
#if defined BB_FEATURE_COMMAND_EDITING #if defined BB_FEATURE_COMMAND_EDITING
#define BB_CMDEDIT #define BB_CMDEDIT
#else #else
#undef BB_FEATURE_COMMAND_EDITING #undef BB_FEATURE_COMMAND_EDITING
@ -482,3 +457,17 @@
#define BB_LOGREAD #define BB_LOGREAD
#endif #endif
#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

73
debian/Config.h-udeb vendored
View File

@ -9,6 +9,7 @@
// BusyBox Applications // BusyBox Applications
//#define BB_ADJTIMEX //#define BB_ADJTIMEX
//#define BB_AR //#define BB_AR
//#define BB_ASH
#define BB_BASENAME #define BB_BASENAME
#define BB_CAT #define BB_CAT
#define BB_CHGRP #define BB_CHGRP
@ -51,6 +52,7 @@
#define BB_HEAD #define BB_HEAD
//#define BB_HOSTID //#define BB_HOSTID
//#define BB_HOSTNAME //#define BB_HOSTNAME
//#define BB_HUSH
#define BB_ID #define BB_ID
//#define BB_IFCONFIG //#define BB_IFCONFIG
#define BB_INIT #define BB_INIT
@ -58,6 +60,7 @@
#define BB_KILL #define BB_KILL
#define BB_KILLALL #define BB_KILLALL
#define BB_KLOGD #define BB_KLOGD
//#define BB_LASH
//#define BB_LENGTH //#define BB_LENGTH
#define BB_LN #define BB_LN
//#define BB_LOADACM //#define BB_LOADACM
@ -78,6 +81,7 @@
//#define BB_NC //#define BB_NC
#define BB_MORE #define BB_MORE
#define BB_MOUNT #define BB_MOUNT
//#define BB_MSH
//#define BB_MT //#define BB_MT
#define BB_MV #define BB_MV
//#define BB_NSLOOKUP //#define BB_NSLOOKUP
@ -99,7 +103,6 @@
//#define BB_RPM2CPIO //#define BB_RPM2CPIO
#define BB_SED #define BB_SED
//#define BB_SETKEYCODES //#define BB_SETKEYCODES
//#define BB_SH
#define BB_SLEEP #define BB_SLEEP
#define BB_SORT #define BB_SORT
//#define BB_STTY //#define BB_STTY
@ -143,40 +146,12 @@
// pretty/useful). // pretty/useful).
// //
// //
// If you enabled BB_SH above, you may select one of the following shells. // If you enabled one or more of the shells, you may select which one
// You can only select ONE of the following shells. Sorry. // should be run when sh is invoked:
// //#define BB_FEATURE_SH_IS_ASH
// lash is the very smallest shell (adds just 10k) and it is quite usable as a //#define BB_FEATURE_SH_IS_HUSH
// command prompt, but it is not suitable for any but the most trivial scripting //#define BB_FEATURE_SH_IS_LASH
// (such as an initrd that calls insmod a few times) since it does not #define BB_FEATURE_SH_IS_MSH
// 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
// //
// BusyBox will, by default, malloc space for its buffers. This costs code // 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 // size for the call to xmalloc. You can use the following feature to have
@ -283,11 +258,11 @@
#define BB_FEATURE_SORT_UNIQUE #define BB_FEATURE_SORT_UNIQUE
// //
// Enable command line editing in the shell. // 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 #define BB_FEATURE_COMMAND_EDITING
// //
// Enable tab completion in the shell. This is now working quite nicely. // 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 #define BB_FEATURE_COMMAND_TAB_COMPLETION
// //
// Attempts to match usernames in a ~-prefixed path // 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 //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, //were shell builtins. Nice for staticly linking an emergency rescue shell,
//among other things. Off by default. //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 //#define BB_FEATURE_SH_STANDALONE_SHELL
// //
//When this is enabled, busybox shell applets can be called using full path //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_ //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 //busybox. Some systems want this, others do not. Choose wisely. :-) This
//only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled. //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 //#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
// //
// Uncomment this option for a fancy shell prompt that includes the // Uncomment this option for a fancy shell prompt that includes the
// current username and hostname. On systems that don't have usernames // current username and hostname. On systems that don't have usernames
// or hostnames, this can look hideous. // 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 //#define BB_FEATURE_SH_FANCY_PROMPT
// //
//Turn on extra fbset options //Turn on extra fbset options
@ -416,8 +391,8 @@
// Nothing beyond this point should ever be touched by // Nothing beyond this point should ever be touched by
// mere mortals so leave this stuff alone. // mere mortals so leave this stuff alone.
// //
#if defined BB_SH #if defined BB_ASH || defined BB_HUSH || defined BB_LASH || defined BB_MSH
#if defined BB_FEATURE_COMMAND_EDITING #if defined BB_FEATURE_COMMAND_EDITING
#define BB_CMDEDIT #define BB_CMDEDIT
#else #else
#undef BB_FEATURE_COMMAND_EDITING #undef BB_FEATURE_COMMAND_EDITING
@ -482,3 +457,17 @@
#define BB_LOGREAD #define BB_LOGREAD
#endif #endif
#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

8
hush.c
View File

@ -112,7 +112,7 @@
#else #else
#define applet_name "hush" #define applet_name "hush"
#include "standalone.h" #include "standalone.h"
#define shell_main main #define hush_main main
#undef BB_FEATURE_SH_FANCY_PROMPT #undef BB_FEATURE_SH_FANCY_PROMPT
#endif #endif
@ -2562,7 +2562,7 @@ static void setup_job_control()
tcsetpgrp(shell_terminal, shell_pgrp); tcsetpgrp(shell_terminal, shell_pgrp);
} }
int shell_main(int argc, char **argv) int hush_main(int argc, char **argv)
{ {
int opt; int opt;
FILE *input; FILE *input;
@ -2572,8 +2572,8 @@ int shell_main(int argc, char **argv)
global_argc = argc; global_argc = argc;
global_argv = argv; global_argv = argv;
/* (re?) initialize globals. Sometimes shell_main() ends up calling /* (re?) initialize globals. Sometimes hush_main() ends up calling
* shell_main(), therefore we cannot rely on the BSS to zero out this * hush_main(), therefore we cannot rely on the BSS to zero out this
* stuff. Reset these to 0 every time. */ * stuff. Reset these to 0 every time. */
ifs = NULL; ifs = NULL;
/* map[] is taken care of with call to update_ifs_map() */ /* map[] is taken care of with call to update_ifs_map() */

View File

@ -52,6 +52,9 @@
#ifdef BB_AR #ifdef BB_AR
APPLET(ar, ar_main, _BB_DIR_USR_BIN) APPLET(ar, ar_main, _BB_DIR_USR_BIN)
#endif #endif
#ifdef BB_ASH
APPLET_NOUSAGE("ash", ash_main, _BB_DIR_BIN)
#endif
#ifdef BB_BASENAME #ifdef BB_BASENAME
APPLET(basename, basename_main, _BB_DIR_USR_BIN) APPLET(basename, basename_main, _BB_DIR_USR_BIN)
#endif #endif
@ -185,6 +188,9 @@
#ifdef BB_HOSTNAME #ifdef BB_HOSTNAME
APPLET(hostname, hostname_main, _BB_DIR_BIN) APPLET(hostname, hostname_main, _BB_DIR_BIN)
#endif #endif
#ifdef BB_HUSH
APPLET_NOUSAGE("hush", hush_main, _BB_DIR_BIN)
#endif
#ifdef BB_ID #ifdef BB_ID
APPLET(id, id_main, _BB_DIR_USR_BIN) APPLET(id, id_main, _BB_DIR_USR_BIN)
#endif #endif
@ -206,6 +212,9 @@
#ifdef BB_KLOGD #ifdef BB_KLOGD
APPLET(klogd, klogd_main, _BB_DIR_SBIN) APPLET(klogd, klogd_main, _BB_DIR_SBIN)
#endif #endif
#ifdef BB_LASH
APPLET(lash, lash_main, _BB_DIR_BIN)
#endif
#ifdef BB_LENGTH #ifdef BB_LENGTH
APPLET(length, length_main, _BB_DIR_USR_BIN) APPLET(length, length_main, _BB_DIR_USR_BIN)
#endif #endif
@ -272,6 +281,9 @@
#ifdef BB_MOUNT #ifdef BB_MOUNT
APPLET(mount, mount_main, _BB_DIR_BIN) APPLET(mount, mount_main, _BB_DIR_BIN)
#endif #endif
#ifdef BB_MSH
APPLET_NOUSAGE("msh", msh_main, _BB_DIR_BIN)
#endif
#ifdef BB_MT #ifdef BB_MT
APPLET(mt, mt_main, _BB_DIR_BIN) APPLET(mt, mt_main, _BB_DIR_BIN)
#endif #endif
@ -344,8 +356,14 @@
#ifdef BB_SETKEYCODES #ifdef BB_SETKEYCODES
APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN) APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN)
#endif #endif
#ifdef BB_SH #ifdef BB_FEATURE_SH_IS_ASH
APPLET(sh, shell_main, _BB_DIR_BIN) 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 #endif
#ifdef BB_SLEEP #ifdef BB_SLEEP
APPLET(sleep, sleep_main, _BB_DIR_BIN) APPLET(sleep, sleep_main, _BB_DIR_BIN)

View File

@ -1365,12 +1365,12 @@
#define setkeycodes_example_usage \ #define setkeycodes_example_usage \
"$ setkeycodes e030 127\n" "$ setkeycodes e030 127\n"
#define sh_trivial_usage \ #define lash_trivial_usage \
"[FILE]...\n" \ "[FILE]...\n" \
"or: sh -c command [args]..." "or: sh -c command [args]..."
#define sh_full_usage \ #define lash_full_usage \
"lash: The BusyBox LAme SHell (command interpreter)" "lash: The BusyBox LAme SHell (command interpreter)"
#define sh_notes_usage \ #define lash_notes_usage \
"This command does not yet have proper documentation.\n" \ "This command does not yet have proper documentation.\n" \
"\n" \ "\n" \
"Use lash just as you would use any other shell. It properly handles pipes,\n" \ "Use lash just as you would use any other shell. It properly handles pipes,\n" \

2
lash.c
View File

@ -1545,7 +1545,7 @@ static void setup_job_control()
tcsetpgrp(shell_terminal, shell_pgrp); 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; int opt, interactive=FALSE;
FILE *input = stdin; FILE *input = stdin;

4
msh.c
View File

@ -143,7 +143,7 @@ static int newfile(char *s);
static char *findeq(char *cp); static char *findeq(char *cp);
static char *cclass(char *p, int sub); static char *cclass(char *p, int sub);
static void initarea(void); static void initarea(void);
extern int shell_main(int argc, char **argv); extern int msh_main(int argc, char **argv);
struct brkcon { 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 int f;
register char *s; register char *s;

48
sh.c
View File

@ -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:
*/

View File

@ -7638,7 +7638,7 @@ static void procargs (int, char **);
*/ */
int int
shell_main(argc, argv) ash_main(argc, argv)
int argc; int argc;
char **argv; char **argv;
{ {
@ -12874,7 +12874,7 @@ findvar(struct var **vpp, const char *name)
/* /*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org> * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* This file contains code for the times builtin. * 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) static int timescmd (int argc, char **argv)
{ {

View File

@ -112,7 +112,7 @@
#else #else
#define applet_name "hush" #define applet_name "hush"
#include "standalone.h" #include "standalone.h"
#define shell_main main #define hush_main main
#undef BB_FEATURE_SH_FANCY_PROMPT #undef BB_FEATURE_SH_FANCY_PROMPT
#endif #endif
@ -2562,7 +2562,7 @@ static void setup_job_control()
tcsetpgrp(shell_terminal, shell_pgrp); tcsetpgrp(shell_terminal, shell_pgrp);
} }
int shell_main(int argc, char **argv) int hush_main(int argc, char **argv)
{ {
int opt; int opt;
FILE *input; FILE *input;
@ -2572,8 +2572,8 @@ int shell_main(int argc, char **argv)
global_argc = argc; global_argc = argc;
global_argv = argv; global_argv = argv;
/* (re?) initialize globals. Sometimes shell_main() ends up calling /* (re?) initialize globals. Sometimes hush_main() ends up calling
* shell_main(), therefore we cannot rely on the BSS to zero out this * hush_main(), therefore we cannot rely on the BSS to zero out this
* stuff. Reset these to 0 every time. */ * stuff. Reset these to 0 every time. */
ifs = NULL; ifs = NULL;
/* map[] is taken care of with call to update_ifs_map() */ /* map[] is taken care of with call to update_ifs_map() */

View File

@ -1545,7 +1545,7 @@ static void setup_job_control()
tcsetpgrp(shell_terminal, shell_pgrp); 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; int opt, interactive=FALSE;
FILE *input = stdin; FILE *input = stdin;

View File

@ -143,7 +143,7 @@ static int newfile(char *s);
static char *findeq(char *cp); static char *findeq(char *cp);
static char *cclass(char *p, int sub); static char *cclass(char *p, int sub);
static void initarea(void); static void initarea(void);
extern int shell_main(int argc, char **argv); extern int msh_main(int argc, char **argv);
struct brkcon { 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 int f;
register char *s; register char *s;

View File

@ -1365,12 +1365,12 @@
#define setkeycodes_example_usage \ #define setkeycodes_example_usage \
"$ setkeycodes e030 127\n" "$ setkeycodes e030 127\n"
#define sh_trivial_usage \ #define lash_trivial_usage \
"[FILE]...\n" \ "[FILE]...\n" \
"or: sh -c command [args]..." "or: sh -c command [args]..."
#define sh_full_usage \ #define lash_full_usage \
"lash: The BusyBox LAme SHell (command interpreter)" "lash: The BusyBox LAme SHell (command interpreter)"
#define sh_notes_usage \ #define lash_notes_usage \
"This command does not yet have proper documentation.\n" \ "This command does not yet have proper documentation.\n" \
"\n" \ "\n" \
"Use lash just as you would use any other shell. It properly handles pipes,\n" \ "Use lash just as you would use any other shell. It properly handles pipes,\n" \