summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2001-07-06 19:24:27 +0000
committerEric Andersen2001-07-06 19:24:27 +0000
commit00e56ada9cd67851d8ff3a9660c6e4fd7816a266 (patch)
tree77c9698acecbb239a4ee16d472fcc985c79b6d01
parent3bbcc95ac939f50e4319a1dcc0db9e1ba548ba70 (diff)
downloadbusybox-00e56ada9cd67851d8ff3a9660c6e4fd7816a266.zip
busybox-00e56ada9cd67851d8ff3a9660c6e4fd7816a266.tar.gz
Let people select their shell at compile time.
-rw-r--r--Config.h55
-rw-r--r--sh.c39
2 files changed, 94 insertions, 0 deletions
diff --git a/Config.h b/Config.h
index 55792b4..cc02a5e 100644
--- a/Config.h
+++ b/Config.h
@@ -144,6 +144,41 @@
// 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
+//
// 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
// them put on the stack. For some very small machines with limited stack
@@ -391,6 +426,26 @@
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
#undef BB_FEATURE_SH_FANCY_PROMPT
#endif
+ #if ! defined BB_FEATURE_LASH && ! defined BB_FEATURE_HUSH && ! defined BB_FEATURE_MSH && ! defined BB_FEATURE_ASH
+ #define BB_FEATURE_MSH
+ #endif
+ #if defined BB_FEATURE_ASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
+ #undef BB_FEATURE_LASH
+ #undef BB_FEATURE_HUSH
+ #undef BB_FEATURE_MSH
+ #elif defined BB_FEATURE_MSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
+ #undef BB_FEATURE_LASH
+ #undef BB_FEATURE_HUSH
+ #undef BB_FEATURE_ASH
+ #elif defined BB_FEATURE_HUSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
+ #undef BB_FEATURE_LASH
+ #undef BB_FEATURE_MSH
+ #undef BB_FEATURE_ASH
+ #elif defined BB_FEATURE_LASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
+ #undef BB_FEATURE_HUSH
+ #undef BB_FEATURE_MSH
+ #undef BB_FEATURE_ASH
+ #endif
#else
#undef BB_FEATURE_SH_APPLETS_ALWAYS_WIN
#undef BB_FEATURE_SH_STANDALONE_SHELL
diff --git a/sh.c b/sh.c
new file mode 100644
index 0000000..e763436
--- /dev/null
+++ b/sh.c
@@ -0,0 +1,39 @@
+/* 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 "busybox.h"
+
+#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:
+*/