aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-07-09 13:10:58 +0100
committerRon Yorston <rmy@pobox.com>2020-07-09 13:10:58 +0100
commit9c0b2f7020d7c30b21a930ef54be632e092e533b (patch)
treeb2187c40bd2fd9f49f73599fb08e52cb7a596de0 /shell
parenta8c6e20e332a9e11a9d28cd6770eadb9c9d73cb7 (diff)
parentd21a63f9fca8eb16f79de9b72d4a3484dfaec1fc (diff)
downloadbusybox-w32-9c0b2f7020d7c30b21a930ef54be632e092e533b.tar.gz
busybox-w32-9c0b2f7020d7c30b21a930ef54be632e092e533b.tar.bz2
busybox-w32-9c0b2f7020d7c30b21a930ef54be632e092e533b.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'shell')
-rw-r--r--shell/Config.src20
-rw-r--r--shell/ash.c41
-rw-r--r--shell/hush.c75
3 files changed, 77 insertions, 59 deletions
diff --git a/shell/Config.src b/shell/Config.src
index d7623f774..5efbf9995 100644
--- a/shell/Config.src
+++ b/shell/Config.src
@@ -17,6 +17,7 @@ choice
17config SH_IS_ASH 17config SH_IS_ASH
18 depends on !NOMMU 18 depends on !NOMMU
19 bool "ash" 19 bool "ash"
20 select SHELL_ASH
20 help 21 help
21 Choose ash to be the shell executed by 'sh' name. 22 Choose ash to be the shell executed by 'sh' name.
22 The ash code will be built into busybox. If you don't select 23 The ash code will be built into busybox. If you don't select
@@ -25,6 +26,7 @@ config SH_IS_ASH
25 26
26config SH_IS_HUSH 27config SH_IS_HUSH
27 bool "hush" 28 bool "hush"
29 select SHELL_HUSH
28 help 30 help
29 Choose hush to be the shell executed by 'sh' name. 31 Choose hush to be the shell executed by 'sh' name.
30 The hush code will be built into busybox. If you don't select 32 The hush code will be built into busybox. If you don't select
@@ -57,6 +59,7 @@ choice
57config BASH_IS_ASH 59config BASH_IS_ASH
58 depends on !NOMMU 60 depends on !NOMMU
59 bool "ash" 61 bool "ash"
62 select SHELL_ASH
60 help 63 help
61 Choose ash to be the shell executed by 'bash' name. 64 Choose ash to be the shell executed by 'bash' name.
62 The ash code will be built into busybox. If you don't select 65 The ash code will be built into busybox. If you don't select
@@ -65,6 +68,7 @@ config BASH_IS_ASH
65 68
66config BASH_IS_HUSH 69config BASH_IS_HUSH
67 bool "hush" 70 bool "hush"
71 select SHELL_HUSH
68 help 72 help
69 Choose hush to be the shell executed by 'bash' name. 73 Choose hush to be the shell executed by 'bash' name.
70 The hush code will be built into busybox. If you don't select 74 The hush code will be built into busybox. If you don't select
@@ -81,12 +85,12 @@ INSERT
81 85
82 86
83comment "Options common to all shells" 87comment "Options common to all shells"
84if ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH 88if SHELL_ASH || SHELL_HUSH
85 89
86config FEATURE_SH_MATH 90config FEATURE_SH_MATH
87 bool "POSIX math support" 91 bool "POSIX math support"
88 default y 92 default y
89 depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH 93 depends on SHELL_ASH || SHELL_HUSH
90 help 94 help
91 Enable math support in the shell via $((...)) syntax. 95 Enable math support in the shell via $((...)) syntax.
92 96
@@ -107,14 +111,14 @@ config FEATURE_SH_MATH_BASE
107config FEATURE_SH_EXTRA_QUIET 111config FEATURE_SH_EXTRA_QUIET
108 bool "Hide message on interactive shell startup" 112 bool "Hide message on interactive shell startup"
109 default y 113 default y
110 depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH 114 depends on SHELL_ASH || SHELL_HUSH
111 help 115 help
112 Remove the busybox introduction when starting a shell. 116 Remove the busybox introduction when starting a shell.
113 117
114config FEATURE_SH_STANDALONE 118config FEATURE_SH_STANDALONE
115 bool "Standalone shell" 119 bool "Standalone shell"
116 default n 120 default n
117 depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH 121 depends on SHELL_ASH || SHELL_HUSH
118 help 122 help
119 This option causes busybox shells to use busybox applets 123 This option causes busybox shells to use busybox applets
120 in preference to executables in the PATH whenever possible. For 124 in preference to executables in the PATH whenever possible. For
@@ -135,7 +139,7 @@ config FEATURE_SH_STANDALONE
135config FEATURE_SH_NOFORK 139config FEATURE_SH_NOFORK
136 bool "Run 'nofork' applets directly" 140 bool "Run 'nofork' applets directly"
137 default n 141 default n
138 depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH 142 depends on SHELL_ASH || SHELL_HUSH
139 help 143 help
140 This option causes busybox shells to not execute typical 144 This option causes busybox shells to not execute typical
141 fork/exec/wait sequence, but call <applet>_main directly, 145 fork/exec/wait sequence, but call <applet>_main directly,
@@ -153,14 +157,14 @@ config FEATURE_SH_NOFORK
153config FEATURE_SH_READ_FRAC 157config FEATURE_SH_READ_FRAC
154 bool "read -t N.NNN support (+110 bytes)" 158 bool "read -t N.NNN support (+110 bytes)"
155 default y 159 default y
156 depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH 160 depends on SHELL_ASH || SHELL_HUSH
157 help 161 help
158 Enable support for fractional second timeout in read builtin. 162 Enable support for fractional second timeout in read builtin.
159 163
160config FEATURE_SH_HISTFILESIZE 164config FEATURE_SH_HISTFILESIZE
161 bool "Use $HISTFILESIZE" 165 bool "Use $HISTFILESIZE"
162 default y 166 default y
163 depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH 167 depends on SHELL_ASH || SHELL_HUSH
164 help 168 help
165 This option makes busybox shells to use $HISTFILESIZE variable 169 This option makes busybox shells to use $HISTFILESIZE variable
166 to set shell history size. Note that its max value is capped 170 to set shell history size. Note that its max value is capped
@@ -169,7 +173,7 @@ config FEATURE_SH_HISTFILESIZE
169config FEATURE_SH_EMBEDDED_SCRIPTS 173config FEATURE_SH_EMBEDDED_SCRIPTS
170 bool "Embed scripts in the binary" 174 bool "Embed scripts in the binary"
171 default y 175 default y
172 depends on ASH || HUSH || SH_IS_ASH || BASH_IS_ASH || SH_IS_HUSH || BASH_IS_HUSH 176 depends on SHELL_ASH || SHELL_HUSH
173 help 177 help
174 Allow scripts to be compressed and embedded in the busybox 178 Allow scripts to be compressed and embedded in the busybox
175 binary. The scripts should be placed in the 'embed' directory 179 binary. The scripts should be placed in the 'embed' directory
diff --git a/shell/ash.c b/shell/ash.c
index 9c5fbf5ff..d35ae027f 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -29,10 +29,15 @@
29 * - fake $PPID 29 * - fake $PPID
30 */ 30 */
31 31
32//config:config SHELL_ASH
33//config: bool #hidden option
34//config: depends on !NOMMU
35//config:
32//config:config ASH 36//config:config ASH
33//config: bool "ash (78 kb)" 37//config: bool "ash (78 kb)"
34//config: default y 38//config: default y
35//config: depends on !NOMMU 39//config: depends on !NOMMU
40//config: select SHELL_ASH
36//config: help 41//config: help
37//config: The most complete and most pedantically correct shell included with 42//config: The most complete and most pedantically correct shell included with
38//config: busybox. This shell is actually a derivative of the Debian 'dash' 43//config: busybox. This shell is actually a derivative of the Debian 'dash'
@@ -42,17 +47,17 @@
42//config:# ash options 47//config:# ash options
43//config:# note: Don't remove !NOMMU part in the next line; it would break 48//config:# note: Don't remove !NOMMU part in the next line; it would break
44//config:# menuconfig's indenting. 49//config:# menuconfig's indenting.
45//config:if !NOMMU && (ASH || SH_IS_ASH || BASH_IS_ASH) 50//config:if !NOMMU && (SHELL_ASH || ASH || SH_IS_ASH || BASH_IS_ASH)
46//config: 51//config:
47//config:config ASH_OPTIMIZE_FOR_SIZE 52//config:config ASH_OPTIMIZE_FOR_SIZE
48//config: bool "Optimize for size instead of speed" 53//config: bool "Optimize for size instead of speed"
49//config: default y 54//config: default y
50//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 55//config: depends on SHELL_ASH
51//config: 56//config:
52//config:config ASH_INTERNAL_GLOB 57//config:config ASH_INTERNAL_GLOB
53//config: bool "Use internal glob() implementation" 58//config: bool "Use internal glob() implementation"
54//config: default y # Y is bigger, but because of uclibc glob() bug, let Y be default for now 59//config: default y # Y is bigger, but because of uclibc glob() bug, let Y be default for now
55//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 60//config: depends on SHELL_ASH
56//config: help 61//config: help
57//config: Do not use glob() function from libc, use internal implementation. 62//config: Do not use glob() function from libc, use internal implementation.
58//config: Use this if you are getting "glob.h: No such file or directory" 63//config: Use this if you are getting "glob.h: No such file or directory"
@@ -63,7 +68,7 @@
63//config:config ASH_BASH_COMPAT 68//config:config ASH_BASH_COMPAT
64//config: bool "bash-compatible extensions" 69//config: bool "bash-compatible extensions"
65//config: default y 70//config: default y
66//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 71//config: depends on SHELL_ASH
67//config: 72//config:
68//config:config ASH_BASH_SOURCE_CURDIR 73//config:config ASH_BASH_SOURCE_CURDIR
69//config: bool "'source' and '.' builtins search current directory after $PATH" 74//config: bool "'source' and '.' builtins search current directory after $PATH"
@@ -84,17 +89,17 @@
84//config:config ASH_JOB_CONTROL 89//config:config ASH_JOB_CONTROL
85//config: bool "Job control" 90//config: bool "Job control"
86//config: default y 91//config: default y
87//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 92//config: depends on SHELL_ASH
88//config: 93//config:
89//config:config ASH_ALIAS 94//config:config ASH_ALIAS
90//config: bool "Alias support" 95//config: bool "Alias support"
91//config: default y 96//config: default y
92//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 97//config: depends on SHELL_ASH
93//config: 98//config:
94//config:config ASH_RANDOM_SUPPORT 99//config:config ASH_RANDOM_SUPPORT
95//config: bool "Pseudorandom generator and $RANDOM variable" 100//config: bool "Pseudorandom generator and $RANDOM variable"
96//config: default y 101//config: default y
97//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 102//config: depends on SHELL_ASH
98//config: help 103//config: help
99//config: Enable pseudorandom generator and dynamic variable "$RANDOM". 104//config: Enable pseudorandom generator and dynamic variable "$RANDOM".
100//config: Each read of "$RANDOM" will generate a new pseudorandom value. 105//config: Each read of "$RANDOM" will generate a new pseudorandom value.
@@ -105,7 +110,7 @@
105//config:config ASH_EXPAND_PRMT 110//config:config ASH_EXPAND_PRMT
106//config: bool "Expand prompt string" 111//config: bool "Expand prompt string"
107//config: default y 112//config: default y
108//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 113//config: depends on SHELL_ASH
109//config: help 114//config: help
110//config: $PS# may contain volatile content, such as backquote commands. 115//config: $PS# may contain volatile content, such as backquote commands.
111//config: This option recreates the prompt string from the environment 116//config: This option recreates the prompt string from the environment
@@ -114,14 +119,14 @@
114//config:config ASH_IDLE_TIMEOUT 119//config:config ASH_IDLE_TIMEOUT
115//config: bool "Idle timeout variable $TMOUT" 120//config: bool "Idle timeout variable $TMOUT"
116//config: default y 121//config: default y
117//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 122//config: depends on SHELL_ASH
118//config: help 123//config: help
119//config: Enable bash-like auto-logout after $TMOUT seconds of idle time. 124//config: Enable bash-like auto-logout after $TMOUT seconds of idle time.
120//config: 125//config:
121//config:config ASH_MAIL 126//config:config ASH_MAIL
122//config: bool "Check for new mail in interactive shell" 127//config: bool "Check for new mail in interactive shell"
123//config: default y 128//config: default y
124//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 129//config: depends on SHELL_ASH
125//config: help 130//config: help
126//config: Enable "check for new mail" function: 131//config: Enable "check for new mail" function:
127//config: if set, $MAIL file and $MAILPATH list of files 132//config: if set, $MAIL file and $MAILPATH list of files
@@ -131,32 +136,32 @@
131//config:config ASH_ECHO 136//config:config ASH_ECHO
132//config: bool "echo builtin" 137//config: bool "echo builtin"
133//config: default y 138//config: default y
134//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 139//config: depends on SHELL_ASH
135//config: 140//config:
136//config:config ASH_PRINTF 141//config:config ASH_PRINTF
137//config: bool "printf builtin" 142//config: bool "printf builtin"
138//config: default y 143//config: default y
139//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 144//config: depends on SHELL_ASH
140//config: 145//config:
141//config:config ASH_TEST 146//config:config ASH_TEST
142//config: bool "test builtin" 147//config: bool "test builtin"
143//config: default y 148//config: default y
144//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 149//config: depends on SHELL_ASH
145//config: 150//config:
146//config:config ASH_HELP 151//config:config ASH_HELP
147//config: bool "help builtin" 152//config: bool "help builtin"
148//config: default y 153//config: default y
149//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 154//config: depends on SHELL_ASH
150//config: 155//config:
151//config:config ASH_GETOPTS 156//config:config ASH_GETOPTS
152//config: bool "getopts builtin" 157//config: bool "getopts builtin"
153//config: default y 158//config: default y
154//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 159//config: depends on SHELL_ASH
155//config: 160//config:
156//config:config ASH_CMDCMD 161//config:config ASH_CMDCMD
157//config: bool "command builtin" 162//config: bool "command builtin"
158//config: default y 163//config: default y
159//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 164//config: depends on SHELL_ASH
160//config: help 165//config: help
161//config: Enable support for the 'command' builtin, which allows 166//config: Enable support for the 'command' builtin, which allows
162//config: you to run the specified command or builtin, 167//config: you to run the specified command or builtin,
@@ -188,9 +193,7 @@
188//applet:IF_SH_IS_ASH( APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, ash)) 193//applet:IF_SH_IS_ASH( APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
189//applet:IF_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, ash)) 194//applet:IF_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
190 195
191//kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o 196//kbuild:lib-$(CONFIG_SHELL_ASH) += ash.o ash_ptr_hack.o shell_common.o
192//kbuild:lib-$(CONFIG_SH_IS_ASH) += ash.o ash_ptr_hack.o shell_common.o
193//kbuild:lib-$(CONFIG_BASH_IS_ASH) += ash.o ash_ptr_hack.o shell_common.o
194//kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o 197//kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
195 198
196/* 199/*
diff --git a/shell/hush.c b/shell/hush.c
index cab7ea5b0..e9cec1cc9 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -95,6 +95,7 @@
95//config:config HUSH 95//config:config HUSH
96//config: bool "hush (68 kb)" 96//config: bool "hush (68 kb)"
97//config: default y 97//config: default y
98//config: select SHELL_HUSH
98//config: help 99//config: help
99//config: hush is a small shell. It handles the normal flow control 100//config: hush is a small shell. It handles the normal flow control
100//config: constructs such as if/then/elif/else/fi, for/in/do/done, while loops, 101//config: constructs such as if/then/elif/else/fi, for/in/do/done, while loops,
@@ -106,10 +107,20 @@
106//config: It does not handle select, aliases, tilde expansion, 107//config: It does not handle select, aliases, tilde expansion,
107//config: &>file and >&file redirection of stdout+stderr. 108//config: &>file and >&file redirection of stdout+stderr.
108//config: 109//config:
110// This option is visible (has a description) to make it possible to select
111// a "scripted" applet (such as NOLOGIN) but avoid selecting any shells:
112//config:config SHELL_HUSH
113//config: bool "Internal shell for embedded script support"
114//config: default n
115//config:
116//config:# hush options
117//config:# It's only needed to get "nice" menuconfig indenting.
118//config:if SHELL_HUSH || HUSH || SH_IS_HUSH || BASH_IS_HUSH
119//config:
109//config:config HUSH_BASH_COMPAT 120//config:config HUSH_BASH_COMPAT
110//config: bool "bash-compatible extensions" 121//config: bool "bash-compatible extensions"
111//config: default y 122//config: default y
112//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 123//config: depends on SHELL_HUSH
113//config: 124//config:
114//config:config HUSH_BRACE_EXPANSION 125//config:config HUSH_BRACE_EXPANSION
115//config: bool "Brace expansion" 126//config: bool "Brace expansion"
@@ -133,7 +144,7 @@
133//config:config HUSH_INTERACTIVE 144//config:config HUSH_INTERACTIVE
134//config: bool "Interactive mode" 145//config: bool "Interactive mode"
135//config: default y 146//config: default y
136//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 147//config: depends on SHELL_HUSH
137//config: help 148//config: help
138//config: Enable interactive mode (prompt and command editing). 149//config: Enable interactive mode (prompt and command editing).
139//config: Without this, hush simply reads and executes commands 150//config: Without this, hush simply reads and executes commands
@@ -159,31 +170,31 @@
159//config:config HUSH_TICK 170//config:config HUSH_TICK
160//config: bool "Support command substitution" 171//config: bool "Support command substitution"
161//config: default y 172//config: default y
162//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 173//config: depends on SHELL_HUSH
163//config: help 174//config: help
164//config: Enable `command` and $(command). 175//config: Enable `command` and $(command).
165//config: 176//config:
166//config:config HUSH_IF 177//config:config HUSH_IF
167//config: bool "Support if/then/elif/else/fi" 178//config: bool "Support if/then/elif/else/fi"
168//config: default y 179//config: default y
169//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 180//config: depends on SHELL_HUSH
170//config: 181//config:
171//config:config HUSH_LOOPS 182//config:config HUSH_LOOPS
172//config: bool "Support for, while and until loops" 183//config: bool "Support for, while and until loops"
173//config: default y 184//config: default y
174//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 185//config: depends on SHELL_HUSH
175//config: 186//config:
176//config:config HUSH_CASE 187//config:config HUSH_CASE
177//config: bool "Support case ... esac statement" 188//config: bool "Support case ... esac statement"
178//config: default y 189//config: default y
179//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 190//config: depends on SHELL_HUSH
180//config: help 191//config: help
181//config: Enable case ... esac statement. +400 bytes. 192//config: Enable case ... esac statement. +400 bytes.
182//config: 193//config:
183//config:config HUSH_FUNCTIONS 194//config:config HUSH_FUNCTIONS
184//config: bool "Support funcname() { commands; } syntax" 195//config: bool "Support funcname() { commands; } syntax"
185//config: default y 196//config: default y
186//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 197//config: depends on SHELL_HUSH
187//config: help 198//config: help
188//config: Enable support for shell functions. +800 bytes. 199//config: Enable support for shell functions. +800 bytes.
189//config: 200//config:
@@ -197,7 +208,7 @@
197//config:config HUSH_RANDOM_SUPPORT 208//config:config HUSH_RANDOM_SUPPORT
198//config: bool "Pseudorandom generator and $RANDOM variable" 209//config: bool "Pseudorandom generator and $RANDOM variable"
199//config: default y 210//config: default y
200//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 211//config: depends on SHELL_HUSH
201//config: help 212//config: help
202//config: Enable pseudorandom generator and dynamic variable "$RANDOM". 213//config: Enable pseudorandom generator and dynamic variable "$RANDOM".
203//config: Each read of "$RANDOM" will generate a new pseudorandom value. 214//config: Each read of "$RANDOM" will generate a new pseudorandom value.
@@ -205,7 +216,7 @@
205//config:config HUSH_MODE_X 216//config:config HUSH_MODE_X
206//config: bool "Support 'hush -x' option and 'set -x' command" 217//config: bool "Support 'hush -x' option and 'set -x' command"
207//config: default y 218//config: default y
208//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 219//config: depends on SHELL_HUSH
209//config: help 220//config: help
210//config: This instructs hush to print commands before execution. 221//config: This instructs hush to print commands before execution.
211//config: Adds ~300 bytes. 222//config: Adds ~300 bytes.
@@ -213,27 +224,27 @@
213//config:config HUSH_ECHO 224//config:config HUSH_ECHO
214//config: bool "echo builtin" 225//config: bool "echo builtin"
215//config: default y 226//config: default y
216//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 227//config: depends on SHELL_HUSH
217//config: 228//config:
218//config:config HUSH_PRINTF 229//config:config HUSH_PRINTF
219//config: bool "printf builtin" 230//config: bool "printf builtin"
220//config: default y 231//config: default y
221//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 232//config: depends on SHELL_HUSH
222//config: 233//config:
223//config:config HUSH_TEST 234//config:config HUSH_TEST
224//config: bool "test builtin" 235//config: bool "test builtin"
225//config: default y 236//config: default y
226//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 237//config: depends on SHELL_HUSH
227//config: 238//config:
228//config:config HUSH_HELP 239//config:config HUSH_HELP
229//config: bool "help builtin" 240//config: bool "help builtin"
230//config: default y 241//config: default y
231//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 242//config: depends on SHELL_HUSH
232//config: 243//config:
233//config:config HUSH_EXPORT 244//config:config HUSH_EXPORT
234//config: bool "export builtin" 245//config: bool "export builtin"
235//config: default y 246//config: default y
236//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 247//config: depends on SHELL_HUSH
237//config: 248//config:
238//config:config HUSH_EXPORT_N 249//config:config HUSH_EXPORT_N
239//config: bool "Support 'export -n' option" 250//config: bool "Support 'export -n' option"
@@ -245,83 +256,83 @@
245//config:config HUSH_READONLY 256//config:config HUSH_READONLY
246//config: bool "readonly builtin" 257//config: bool "readonly builtin"
247//config: default y 258//config: default y
248//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 259//config: depends on SHELL_HUSH
249//config: help 260//config: help
250//config: Enable support for read-only variables. 261//config: Enable support for read-only variables.
251//config: 262//config:
252//config:config HUSH_KILL 263//config:config HUSH_KILL
253//config: bool "kill builtin (supports kill %jobspec)" 264//config: bool "kill builtin (supports kill %jobspec)"
254//config: default y 265//config: default y
255//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 266//config: depends on SHELL_HUSH
256//config: 267//config:
257//config:config HUSH_WAIT 268//config:config HUSH_WAIT
258//config: bool "wait builtin" 269//config: bool "wait builtin"
259//config: default y 270//config: default y
260//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 271//config: depends on SHELL_HUSH
261//config: 272//config:
262//config:config HUSH_COMMAND 273//config:config HUSH_COMMAND
263//config: bool "command builtin" 274//config: bool "command builtin"
264//config: default y 275//config: default y
265//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 276//config: depends on SHELL_HUSH
266//config: 277//config:
267//config:config HUSH_TRAP 278//config:config HUSH_TRAP
268//config: bool "trap builtin" 279//config: bool "trap builtin"
269//config: default y 280//config: default y
270//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 281//config: depends on SHELL_HUSH
271//config: 282//config:
272//config:config HUSH_TYPE 283//config:config HUSH_TYPE
273//config: bool "type builtin" 284//config: bool "type builtin"
274//config: default y 285//config: default y
275//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 286//config: depends on SHELL_HUSH
276//config: 287//config:
277//config:config HUSH_TIMES 288//config:config HUSH_TIMES
278//config: bool "times builtin" 289//config: bool "times builtin"
279//config: default y 290//config: default y
280//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 291//config: depends on SHELL_HUSH
281//config: 292//config:
282//config:config HUSH_READ 293//config:config HUSH_READ
283//config: bool "read builtin" 294//config: bool "read builtin"
284//config: default y 295//config: default y
285//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 296//config: depends on SHELL_HUSH
286//config: 297//config:
287//config:config HUSH_SET 298//config:config HUSH_SET
288//config: bool "set builtin" 299//config: bool "set builtin"
289//config: default y 300//config: default y
290//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 301//config: depends on SHELL_HUSH
291//config: 302//config:
292//config:config HUSH_UNSET 303//config:config HUSH_UNSET
293//config: bool "unset builtin" 304//config: bool "unset builtin"
294//config: default y 305//config: default y
295//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 306//config: depends on SHELL_HUSH
296//config: 307//config:
297//config:config HUSH_ULIMIT 308//config:config HUSH_ULIMIT
298//config: bool "ulimit builtin" 309//config: bool "ulimit builtin"
299//config: default y 310//config: default y
300//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 311//config: depends on SHELL_HUSH
301//config: 312//config:
302//config:config HUSH_UMASK 313//config:config HUSH_UMASK
303//config: bool "umask builtin" 314//config: bool "umask builtin"
304//config: default y 315//config: default y
305//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 316//config: depends on SHELL_HUSH
306//config: 317//config:
307//config:config HUSH_GETOPTS 318//config:config HUSH_GETOPTS
308//config: bool "getopts builtin" 319//config: bool "getopts builtin"
309//config: default y 320//config: default y
310//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 321//config: depends on SHELL_HUSH
311//config: 322//config:
312//config:config HUSH_MEMLEAK 323//config:config HUSH_MEMLEAK
313//config: bool "memleak builtin (debugging)" 324//config: bool "memleak builtin (debugging)"
314//config: default n 325//config: default n
315//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 326//config: depends on SHELL_HUSH
327//config:
328//config:endif # hush options
316 329
317//applet:IF_HUSH(APPLET(hush, BB_DIR_BIN, BB_SUID_DROP)) 330//applet:IF_HUSH(APPLET(hush, BB_DIR_BIN, BB_SUID_DROP))
318// APPLET_ODDNAME:name main location suid_type help 331// APPLET_ODDNAME:name main location suid_type help
319//applet:IF_SH_IS_HUSH( APPLET_ODDNAME(sh, hush, BB_DIR_BIN, BB_SUID_DROP, hush)) 332//applet:IF_SH_IS_HUSH( APPLET_ODDNAME(sh, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
320//applet:IF_BASH_IS_HUSH(APPLET_ODDNAME(bash, hush, BB_DIR_BIN, BB_SUID_DROP, hush)) 333//applet:IF_BASH_IS_HUSH(APPLET_ODDNAME(bash, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
321 334
322//kbuild:lib-$(CONFIG_HUSH) += hush.o match.o shell_common.o 335//kbuild:lib-$(CONFIG_SHELL_HUSH) += hush.o match.o shell_common.o
323//kbuild:lib-$(CONFIG_SH_IS_HUSH) += hush.o match.o shell_common.o
324//kbuild:lib-$(CONFIG_BASH_IS_HUSH) += hush.o match.o shell_common.o
325//kbuild:lib-$(CONFIG_HUSH_RANDOM_SUPPORT) += random.o 336//kbuild:lib-$(CONFIG_HUSH_RANDOM_SUPPORT) += random.o
326 337
327/* -i (interactive) is also accepted, 338/* -i (interactive) is also accepted,
@@ -7917,7 +7928,7 @@ static const struct built_in_command *find_builtin(const char *name)
7917 return find_builtin_helper(name, bltins2, &bltins2[ARRAY_SIZE(bltins2)]); 7928 return find_builtin_helper(name, bltins2, &bltins2[ARRAY_SIZE(bltins2)]);
7918} 7929}
7919 7930
7920#if EDITING_HAS_get_exe_name 7931#if ENABLE_HUSH_JOB && EDITING_HAS_get_exe_name
7921static const char * FAST_FUNC get_builtin_name(int i) 7932static const char * FAST_FUNC get_builtin_name(int i)
7922{ 7933{
7923 if (/*i >= 0 && */ i < ARRAY_SIZE(bltins1)) { 7934 if (/*i >= 0 && */ i < ARRAY_SIZE(bltins1)) {