[git commit master 1/1] ash: move config stuff into ash.c, no code chages

Denys Vlasenko vda.linux at googlemail.com
Fri Jul 16 12:31:34 UTC 2010


commit: http://git.busybox.net/busybox/commit/?id=771f1995a99e63600a513f97ce35cbb9f6865138
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 include/applets.src.h |    3 -
 include/usage.src.h   |    7 ---
 shell/Config.src      |  114 +++--------------------------------------------
 shell/Kbuild.src      |    3 -
 shell/ash.c           |  117 +++++++++++++++++++++++++++++++++++++++++++++++++
 shell/hush.c          |    2 +-
 6 files changed, 126 insertions(+), 120 deletions(-)

diff --git a/include/applets.src.h b/include/applets.src.h
index 5d84597..6ca0c32 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -72,10 +72,8 @@ IF_ADJTIMEX(APPLET(adjtimex, _BB_DIR_SBIN, _BB_SUID_DROP))
 IF_AR(APPLET(ar, _BB_DIR_USR_BIN, _BB_SUID_DROP))
 IF_ARP(APPLET(arp, _BB_DIR_SBIN, _BB_SUID_DROP))
 IF_ARPING(APPLET(arping, _BB_DIR_USR_BIN, _BB_SUID_DROP))
-IF_ASH(APPLET(ash, _BB_DIR_BIN, _BB_SUID_DROP))
 IF_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_DROP, awk))
 IF_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_DROP, basename))
-IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, _BB_DIR_BIN, _BB_SUID_DROP, bash))
 IF_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_DROP))
 //IF_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_DROP))
 IF_BEEP(APPLET(beep, _BB_DIR_USR_BIN, _BB_SUID_DROP))
@@ -344,7 +342,6 @@ IF_SETLOGCONS(APPLET(setlogcons, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
 IF_SETSEBOOL(APPLET(setsebool, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
 IF_SETSID(APPLET(setsid, _BB_DIR_USR_BIN, _BB_SUID_DROP))
 IF_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_DROP, setuidgid))
-IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, _BB_DIR_BIN, _BB_SUID_DROP, sh))
 IF_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha1sum))
 IF_SHA256SUM(APPLET_ODDNAME(sha256sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha256sum))
 IF_SHA512SUM(APPLET_ODDNAME(sha512sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha512sum))
diff --git a/include/usage.src.h b/include/usage.src.h
index b339600..46d64c1 100644
--- a/include/usage.src.h
+++ b/include/usage.src.h
@@ -115,13 +115,6 @@ INSERT
      "\n	-s SRC_IP	Sender IP address" \
      "\n	DST_IP		Target IP address" \
 
-#define sh_trivial_usage NOUSAGE_STR
-#define sh_full_usage ""
-#define ash_trivial_usage NOUSAGE_STR
-#define ash_full_usage ""
-#define bash_trivial_usage NOUSAGE_STR
-#define bash_full_usage ""
-
 #define awk_trivial_usage \
        "[OPTIONS] [AWK_PROGRAM] [FILE]..."
 #define awk_full_usage "\n\n" \
diff --git a/shell/Config.src b/shell/Config.src
index f415a5f..6389d94 100644
--- a/shell/Config.src
+++ b/shell/Config.src
@@ -7,109 +7,6 @@ menu "Shells"
 
 INSERT
 
-config ASH
-	bool "ash"
-	default y
-	depends on !NOMMU
-	help
-	  Tha 'ash' shell adds about 60k in the default configuration and is
-	  the most complete and most pedantically correct shell included with
-	  busybox. This shell is actually a derivative of the Debian 'dash'
-	  shell (by Herbert Xu), which was created by porting the 'ash' shell
-	  (written by Kenneth Almquist) from NetBSD.
-
-config ASH_BASH_COMPAT
-	bool "bash-compatible extensions"
-	default y
-	depends on ASH
-	help
-	  Enable bash-compatible extensions.
-
-config ASH_JOB_CONTROL
-	bool "Job control"
-	default y
-	depends on ASH
-	help
-	  Enable job control in the ash shell.
-
-config ASH_ALIAS
-	bool "alias support"
-	default y
-	depends on ASH
-	help
-	  Enable alias support in the ash shell.
-
-config ASH_GETOPTS
-	bool "Builtin getopt to parse positional parameters"
-	default y
-	depends on ASH
-	help
-	  Enable getopts builtin in the ash shell.
-
-config ASH_BUILTIN_ECHO
-	bool "Builtin version of 'echo'"
-	default y
-	depends on ASH
-	help
-	  Enable support for echo, builtin to ash.
-
-config ASH_BUILTIN_PRINTF
-	bool "Builtin version of 'printf'"
-	default y
-	depends on ASH
-	help
-	  Enable support for printf, builtin to ash.
-
-config ASH_BUILTIN_TEST
-	bool "Builtin version of 'test'"
-	default y
-	depends on ASH
-	help
-	  Enable support for test, builtin to ash.
-
-config ASH_CMDCMD
-	bool "'command' command to override shell builtins"
-	default y
-	depends on ASH
-	help
-	  Enable support for the ash 'command' builtin, which allows
-	  you to run the specified command with the specified arguments,
-	  even when there is an ash builtin command with the same name.
-
-config ASH_MAIL
-	bool "Check for new mail on interactive shells"
-	default n
-	depends on ASH
-	help
-	  Enable "check for new mail" in the ash shell.
-
-config ASH_OPTIMIZE_FOR_SIZE
-	bool "Optimize for size instead of speed"
-	default y
-	depends on ASH
-	help
-	  Compile ash for reduced size at the price of speed.
-
-config ASH_RANDOM_SUPPORT
-	bool "Pseudorandom generator and $RANDOM variable"
-	default y
-	depends on ASH
-	help
-	  Enable pseudorandom generator and dynamic variable "$RANDOM".
-	  Each read of "$RANDOM" will generate a new pseudorandom value.
-	  You can reset the generator by using a specified start value.
-	  After "unset RANDOM" the generator will switch off and this
-	  variable will no longer have special treatment.
-
-config ASH_EXPAND_PRMT
-	bool "Expand prompt string"
-	default y
-	depends on ASH
-	help
-	  "PS#" may contain volatile content, such as backquote commands.
-	  This option recreates the prompt string from the environment
-	  variable each time it is displayed.
-
 
 choice
 	prompt "Choose which shell is aliased to 'sh' name"
@@ -284,12 +181,17 @@ config CTTYHACK
 
 	  ::respawn:/bin/cttyhack /bin/sh
 
+	  Starting an interactive shell from boot shell script:
+
+	  setsid cttyhack sh
+
 	  Giving controlling tty to shell running with PID 1:
 
-	  $ exec cttyhack sh
+	  # exec cttyhack sh
 
-	  Starting an interactive shell from boot shell script:
+	  Without cttyhack, you need to know exact tty name,
+	  and do something like this:
 
-	  setsid cttyhack sh
+	  # exec setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1'
 
 endmenu
diff --git a/shell/Kbuild.src b/shell/Kbuild.src
index c7eb5b6..bce9924 100644
--- a/shell/Kbuild.src
+++ b/shell/Kbuild.src
@@ -8,8 +8,5 @@ lib-y:=
 
 INSERT
 
-lib-$(CONFIG_ASH)      += ash.o ash_ptr_hack.o shell_common.o
 lib-$(CONFIG_CTTYHACK) += cttyhack.o
-
 lib-$(CONFIG_SH_MATH_SUPPORT) += math.o
-lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
diff --git a/shell/ash.c b/shell/ash.c
index 0337a55..9b33e78 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -70,6 +70,123 @@
 # error "Do not even bother, ash will not run on NOMMU machine"
 #endif
 
+//applet:IF_ASH(APPLET(ash, _BB_DIR_BIN, _BB_SUID_DROP))
+//applet:IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, _BB_DIR_BIN, _BB_SUID_DROP, sh))
+//applet:IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, _BB_DIR_BIN, _BB_SUID_DROP, bash))
+
+//kbuild:lib-$(CONFIG_ASH)      += ash.o ash_ptr_hack.o shell_common.o
+//kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
+
+//config:config ASH
+//config:	bool "ash"
+//config:	default y
+//config:	depends on !NOMMU
+//config:	help
+//config:	  Tha 'ash' shell adds about 60k in the default configuration and is
+//config:	  the most complete and most pedantically correct shell included with
+//config:	  busybox. This shell is actually a derivative of the Debian 'dash'
+//config:	  shell (by Herbert Xu), which was created by porting the 'ash' shell
+//config:	  (written by Kenneth Almquist) from NetBSD.
+//config:
+//config:config ASH_BASH_COMPAT
+//config:	bool "bash-compatible extensions"
+//config:	default y
+//config:	depends on ASH
+//config:	help
+//config:	  Enable bash-compatible extensions.
+//config:
+//config:config ASH_JOB_CONTROL
+//config:	bool "Job control"
+//config:	default y
+//config:	depends on ASH
+//config:	help
+//config:	  Enable job control in the ash shell.
+//config:
+//config:config ASH_ALIAS
+//config:	bool "alias support"
+//config:	default y
+//config:	depends on ASH
+//config:	help
+//config:	  Enable alias support in the ash shell.
+//config:
+//config:config ASH_GETOPTS
+//config:	bool "Builtin getopt to parse positional parameters"
+//config:	default y
+//config:	depends on ASH
+//config:	help
+//config:	  Enable getopts builtin in the ash shell.
+//config:
+//config:config ASH_BUILTIN_ECHO
+//config:	bool "Builtin version of 'echo'"
+//config:	default y
+//config:	depends on ASH
+//config:	help
+//config:	  Enable support for echo, builtin to ash.
+//config:
+//config:config ASH_BUILTIN_PRINTF
+//config:	bool "Builtin version of 'printf'"
+//config:	default y
+//config:	depends on ASH
+//config:	help
+//config:	  Enable support for printf, builtin to ash.
+//config:
+//config:config ASH_BUILTIN_TEST
+//config:	bool "Builtin version of 'test'"
+//config:	default y
+//config:	depends on ASH
+//config:	help
+//config:	  Enable support for test, builtin to ash.
+//config:
+//config:config ASH_CMDCMD
+//config:	bool "'command' command to override shell builtins"
+//config:	default y
+//config:	depends on ASH
+//config:	help
+//config:	  Enable support for the ash 'command' builtin, which allows
+//config:	  you to run the specified command with the specified arguments,
+//config:	  even when there is an ash builtin command with the same name.
+//config:
+//config:config ASH_MAIL
+//config:	bool "Check for new mail on interactive shells"
+//config:	default n
+//config:	depends on ASH
+//config:	help
+//config:	  Enable "check for new mail" in the ash shell.
+//config:
+//config:config ASH_OPTIMIZE_FOR_SIZE
+//config:	bool "Optimize for size instead of speed"
+//config:	default y
+//config:	depends on ASH
+//config:	help
+//config:	  Compile ash for reduced size at the price of speed.
+//config:
+//config:config ASH_RANDOM_SUPPORT
+//config:	bool "Pseudorandom generator and $RANDOM variable"
+//config:	default y
+//config:	depends on ASH
+//config:	help
+//config:	  Enable pseudorandom generator and dynamic variable "$RANDOM".
+//config:	  Each read of "$RANDOM" will generate a new pseudorandom value.
+//config:	  You can reset the generator by using a specified start value.
+//config:	  After "unset RANDOM" the generator will switch off and this
+//config:	  variable will no longer have special treatment.
+//config:
+//config:config ASH_EXPAND_PRMT
+//config:	bool "Expand prompt string"
+//config:	default y
+//config:	depends on ASH
+//config:	help
+//config:	  "PS#" may contain volatile content, such as backquote commands.
+//config:	  This option recreates the prompt string from the environment
+//config:	  variable each time it is displayed.
+
+//usage:#define ash_trivial_usage NOUSAGE_STR
+//usage:#define ash_full_usage ""
+//usage:#define sh_trivial_usage NOUSAGE_STR
+//usage:#define sh_full_usage ""
+//usage:#define bash_trivial_usage NOUSAGE_STR
+//usage:#define bash_full_usage ""
+
 
 /* ============ Hash table sizes. Configurable. */
 
diff --git a/shell/hush.c b/shell/hush.c
index c5a8ea6..56a3f4b 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -114,7 +114,7 @@
 //config:	bool "hush"
 //config:	default y
 //config:	help
-//config:	  hush is a small shell (22k). It handles the normal flow control
+//config:	  hush is a small shell (25k). It handles the normal flow control
 //config:	  constructs such as if/then/elif/else/fi, for/in/do/done, while loops,
 //config:	  case/esac. Redirections, here documents, $((arithmetic))
 //config:	  and functions are supported.
-- 
1.7.1



More information about the busybox-cvs mailing list