aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 13:18:33 +1000
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 13:18:33 +1000
commitb5139d7cd8982d9b683cb1babf0bd759076aaab0 (patch)
treeeecdeb00ff226d1ff3da7844aee2a68f41b28ff5
parent6a6efd31038d7afe977e3059508ae863e65cbdf5 (diff)
parent771f1995a99e63600a513f97ce35cbb9f6865138 (diff)
downloadbusybox-w32-b5139d7cd8982d9b683cb1babf0bd759076aaab0.tar.gz
busybox-w32-b5139d7cd8982d9b683cb1babf0bd759076aaab0.tar.bz2
busybox-w32-b5139d7cd8982d9b683cb1babf0bd759076aaab0.zip
Merge branch 'origin/master' (early part)
Conflicts: shell/ash.c
-rw-r--r--include/applets.src.h3
-rw-r--r--include/usage.src.h7
-rw-r--r--shell/Config.src114
-rw-r--r--shell/Kbuild.src3
-rw-r--r--shell/ash.c117
-rw-r--r--shell/hush.c2
6 files changed, 126 insertions, 120 deletions
diff --git a/include/applets.src.h b/include/applets.src.h
index 5d84597b0..6ca0c3230 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))
72IF_AR(APPLET(ar, _BB_DIR_USR_BIN, _BB_SUID_DROP)) 72IF_AR(APPLET(ar, _BB_DIR_USR_BIN, _BB_SUID_DROP))
73IF_ARP(APPLET(arp, _BB_DIR_SBIN, _BB_SUID_DROP)) 73IF_ARP(APPLET(arp, _BB_DIR_SBIN, _BB_SUID_DROP))
74IF_ARPING(APPLET(arping, _BB_DIR_USR_BIN, _BB_SUID_DROP)) 74IF_ARPING(APPLET(arping, _BB_DIR_USR_BIN, _BB_SUID_DROP))
75IF_ASH(APPLET(ash, _BB_DIR_BIN, _BB_SUID_DROP))
76IF_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_DROP, awk)) 75IF_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_DROP, awk))
77IF_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_DROP, basename)) 76IF_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_DROP, basename))
78IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, _BB_DIR_BIN, _BB_SUID_DROP, bash))
79IF_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_DROP)) 77IF_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_DROP))
80//IF_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_DROP)) 78//IF_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_DROP))
81IF_BEEP(APPLET(beep, _BB_DIR_USR_BIN, _BB_SUID_DROP)) 79IF_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))
344IF_SETSEBOOL(APPLET(setsebool, _BB_DIR_USR_SBIN, _BB_SUID_DROP)) 342IF_SETSEBOOL(APPLET(setsebool, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
345IF_SETSID(APPLET(setsid, _BB_DIR_USR_BIN, _BB_SUID_DROP)) 343IF_SETSID(APPLET(setsid, _BB_DIR_USR_BIN, _BB_SUID_DROP))
346IF_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_DROP, setuidgid)) 344IF_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_DROP, setuidgid))
347IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, _BB_DIR_BIN, _BB_SUID_DROP, sh))
348IF_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha1sum)) 345IF_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha1sum))
349IF_SHA256SUM(APPLET_ODDNAME(sha256sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha256sum)) 346IF_SHA256SUM(APPLET_ODDNAME(sha256sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha256sum))
350IF_SHA512SUM(APPLET_ODDNAME(sha512sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, sha512sum)) 347IF_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 b3396006f..46d64c135 100644
--- a/include/usage.src.h
+++ b/include/usage.src.h
@@ -115,13 +115,6 @@ INSERT
115 "\n -s SRC_IP Sender IP address" \ 115 "\n -s SRC_IP Sender IP address" \
116 "\n DST_IP Target IP address" \ 116 "\n DST_IP Target IP address" \
117 117
118#define sh_trivial_usage NOUSAGE_STR
119#define sh_full_usage ""
120#define ash_trivial_usage NOUSAGE_STR
121#define ash_full_usage ""
122#define bash_trivial_usage NOUSAGE_STR
123#define bash_full_usage ""
124
125#define awk_trivial_usage \ 118#define awk_trivial_usage \
126 "[OPTIONS] [AWK_PROGRAM] [FILE]..." 119 "[OPTIONS] [AWK_PROGRAM] [FILE]..."
127#define awk_full_usage "\n\n" \ 120#define awk_full_usage "\n\n" \
diff --git a/shell/Config.src b/shell/Config.src
index f415a5fa6..6389d943a 100644
--- a/shell/Config.src
+++ b/shell/Config.src
@@ -7,109 +7,6 @@ menu "Shells"
7 7
8INSERT 8INSERT
9 9
10config ASH
11 bool "ash"
12 default y
13 depends on !NOMMU
14 help
15 Tha 'ash' shell adds about 60k in the default configuration and is
16 the most complete and most pedantically correct shell included with
17 busybox. This shell is actually a derivative of the Debian 'dash'
18 shell (by Herbert Xu), which was created by porting the 'ash' shell
19 (written by Kenneth Almquist) from NetBSD.
20
21config ASH_BASH_COMPAT
22 bool "bash-compatible extensions"
23 default y
24 depends on ASH
25 help
26 Enable bash-compatible extensions.
27
28config ASH_JOB_CONTROL
29 bool "Job control"
30 default y
31 depends on ASH
32 help
33 Enable job control in the ash shell.
34
35config ASH_ALIAS
36 bool "alias support"
37 default y
38 depends on ASH
39 help
40 Enable alias support in the ash shell.
41
42config ASH_GETOPTS
43 bool "Builtin getopt to parse positional parameters"
44 default y
45 depends on ASH
46 help
47 Enable getopts builtin in the ash shell.
48
49config ASH_BUILTIN_ECHO
50 bool "Builtin version of 'echo'"
51 default y
52 depends on ASH
53 help
54 Enable support for echo, builtin to ash.
55
56config ASH_BUILTIN_PRINTF
57 bool "Builtin version of 'printf'"
58 default y
59 depends on ASH
60 help
61 Enable support for printf, builtin to ash.
62
63config ASH_BUILTIN_TEST
64 bool "Builtin version of 'test'"
65 default y
66 depends on ASH
67 help
68 Enable support for test, builtin to ash.
69
70config ASH_CMDCMD
71 bool "'command' command to override shell builtins"
72 default y
73 depends on ASH
74 help
75 Enable support for the ash 'command' builtin, which allows
76 you to run the specified command with the specified arguments,
77 even when there is an ash builtin command with the same name.
78
79config ASH_MAIL
80 bool "Check for new mail on interactive shells"
81 default n
82 depends on ASH
83 help
84 Enable "check for new mail" in the ash shell.
85
86config ASH_OPTIMIZE_FOR_SIZE
87 bool "Optimize for size instead of speed"
88 default y
89 depends on ASH
90 help
91 Compile ash for reduced size at the price of speed.
92
93config ASH_RANDOM_SUPPORT
94 bool "Pseudorandom generator and $RANDOM variable"
95 default y
96 depends on ASH
97 help
98 Enable pseudorandom generator and dynamic variable "$RANDOM".
99 Each read of "$RANDOM" will generate a new pseudorandom value.
100 You can reset the generator by using a specified start value.
101 After "unset RANDOM" the generator will switch off and this
102 variable will no longer have special treatment.
103
104config ASH_EXPAND_PRMT
105 bool "Expand prompt string"
106 default y
107 depends on ASH
108 help
109 "PS#" may contain volatile content, such as backquote commands.
110 This option recreates the prompt string from the environment
111 variable each time it is displayed.
112
113 10
114choice 11choice
115 prompt "Choose which shell is aliased to 'sh' name" 12 prompt "Choose which shell is aliased to 'sh' name"
@@ -284,12 +181,17 @@ config CTTYHACK
284 181
285 ::respawn:/bin/cttyhack /bin/sh 182 ::respawn:/bin/cttyhack /bin/sh
286 183
184 Starting an interactive shell from boot shell script:
185
186 setsid cttyhack sh
187
287 Giving controlling tty to shell running with PID 1: 188 Giving controlling tty to shell running with PID 1:
288 189
289 $ exec cttyhack sh 190 # exec cttyhack sh
290 191
291 Starting an interactive shell from boot shell script: 192 Without cttyhack, you need to know exact tty name,
193 and do something like this:
292 194
293 setsid cttyhack sh 195 # exec setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1'
294 196
295endmenu 197endmenu
diff --git a/shell/Kbuild.src b/shell/Kbuild.src
index c7eb5b61a..bce99240f 100644
--- a/shell/Kbuild.src
+++ b/shell/Kbuild.src
@@ -8,8 +8,5 @@ lib-y:=
8 8
9INSERT 9INSERT
10 10
11lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o
12lib-$(CONFIG_CTTYHACK) += cttyhack.o 11lib-$(CONFIG_CTTYHACK) += cttyhack.o
13
14lib-$(CONFIG_SH_MATH_SUPPORT) += math.o 12lib-$(CONFIG_SH_MATH_SUPPORT) += math.o
15lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
diff --git a/shell/ash.c b/shell/ash.c
index e0b15e343..2cee0c42f 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -84,6 +84,123 @@
84# error "Do not even bother, ash will not run on NOMMU machine" 84# error "Do not even bother, ash will not run on NOMMU machine"
85#endif 85#endif
86 86
87//applet:IF_ASH(APPLET(ash, _BB_DIR_BIN, _BB_SUID_DROP))
88//applet:IF_FEATURE_SH_IS_ASH(APPLET_ODDNAME(sh, ash, _BB_DIR_BIN, _BB_SUID_DROP, sh))
89//applet:IF_FEATURE_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, _BB_DIR_BIN, _BB_SUID_DROP, bash))
90
91//kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o
92//kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
93
94//config:config ASH
95//config: bool "ash"
96//config: default y
97//config: depends on !NOMMU
98//config: help
99//config: Tha 'ash' shell adds about 60k in the default configuration and is
100//config: the most complete and most pedantically correct shell included with
101//config: busybox. This shell is actually a derivative of the Debian 'dash'
102//config: shell (by Herbert Xu), which was created by porting the 'ash' shell
103//config: (written by Kenneth Almquist) from NetBSD.
104//config:
105//config:config ASH_BASH_COMPAT
106//config: bool "bash-compatible extensions"
107//config: default y
108//config: depends on ASH
109//config: help
110//config: Enable bash-compatible extensions.
111//config:
112//config:config ASH_JOB_CONTROL
113//config: bool "Job control"
114//config: default y
115//config: depends on ASH
116//config: help
117//config: Enable job control in the ash shell.
118//config:
119//config:config ASH_ALIAS
120//config: bool "alias support"
121//config: default y
122//config: depends on ASH
123//config: help
124//config: Enable alias support in the ash shell.
125//config:
126//config:config ASH_GETOPTS
127//config: bool "Builtin getopt to parse positional parameters"
128//config: default y
129//config: depends on ASH
130//config: help
131//config: Enable getopts builtin in the ash shell.
132//config:
133//config:config ASH_BUILTIN_ECHO
134//config: bool "Builtin version of 'echo'"
135//config: default y
136//config: depends on ASH
137//config: help
138//config: Enable support for echo, builtin to ash.
139//config:
140//config:config ASH_BUILTIN_PRINTF
141//config: bool "Builtin version of 'printf'"
142//config: default y
143//config: depends on ASH
144//config: help
145//config: Enable support for printf, builtin to ash.
146//config:
147//config:config ASH_BUILTIN_TEST
148//config: bool "Builtin version of 'test'"
149//config: default y
150//config: depends on ASH
151//config: help
152//config: Enable support for test, builtin to ash.
153//config:
154//config:config ASH_CMDCMD
155//config: bool "'command' command to override shell builtins"
156//config: default y
157//config: depends on ASH
158//config: help
159//config: Enable support for the ash 'command' builtin, which allows
160//config: you to run the specified command with the specified arguments,
161//config: even when there is an ash builtin command with the same name.
162//config:
163//config:config ASH_MAIL
164//config: bool "Check for new mail on interactive shells"
165//config: default n
166//config: depends on ASH
167//config: help
168//config: Enable "check for new mail" in the ash shell.
169//config:
170//config:config ASH_OPTIMIZE_FOR_SIZE
171//config: bool "Optimize for size instead of speed"
172//config: default y
173//config: depends on ASH
174//config: help
175//config: Compile ash for reduced size at the price of speed.
176//config:
177//config:config ASH_RANDOM_SUPPORT
178//config: bool "Pseudorandom generator and $RANDOM variable"
179//config: default y
180//config: depends on ASH
181//config: help
182//config: Enable pseudorandom generator and dynamic variable "$RANDOM".
183//config: Each read of "$RANDOM" will generate a new pseudorandom value.
184//config: You can reset the generator by using a specified start value.
185//config: After "unset RANDOM" the generator will switch off and this
186//config: variable will no longer have special treatment.
187//config:
188//config:config ASH_EXPAND_PRMT
189//config: bool "Expand prompt string"
190//config: default y
191//config: depends on ASH
192//config: help
193//config: "PS#" may contain volatile content, such as backquote commands.
194//config: This option recreates the prompt string from the environment
195//config: variable each time it is displayed.
196
197//usage:#define ash_trivial_usage NOUSAGE_STR
198//usage:#define ash_full_usage ""
199//usage:#define sh_trivial_usage NOUSAGE_STR
200//usage:#define sh_full_usage ""
201//usage:#define bash_trivial_usage NOUSAGE_STR
202//usage:#define bash_full_usage ""
203
87#if ENABLE_PLATFORM_MINGW32 204#if ENABLE_PLATFORM_MINGW32
88struct forkshell; 205struct forkshell;
89union node; 206union node;
diff --git a/shell/hush.c b/shell/hush.c
index c5a8ea617..56a3f4b14 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -114,7 +114,7 @@
114//config: bool "hush" 114//config: bool "hush"
115//config: default y 115//config: default y
116//config: help 116//config: help
117//config: hush is a small shell (22k). It handles the normal flow control 117//config: hush is a small shell (25k). It handles the normal flow control
118//config: constructs such as if/then/elif/else/fi, for/in/do/done, while loops, 118//config: constructs such as if/then/elif/else/fi, for/in/do/done, while loops,
119//config: case/esac. Redirections, here documents, $((arithmetic)) 119//config: case/esac. Redirections, here documents, $((arithmetic))
120//config: and functions are supported. 120//config: and functions are supported.