aboutsummaryrefslogtreecommitdiff
path: root/shell/hush.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/hush.c')
-rw-r--r--shell/hush.c68
1 files changed, 15 insertions, 53 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 22d71cb07..9e508fc6d 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -99,8 +99,6 @@
99//config: bool "bash-compatible extensions" 99//config: bool "bash-compatible extensions"
100//config: default y 100//config: default y
101//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 101//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
102//config: help
103//config: Enable bash-compatible extensions.
104//config: 102//config:
105//config:config HUSH_BRACE_EXPANSION 103//config:config HUSH_BRACE_EXPANSION
106//config: bool "Brace expansion" 104//config: bool "Brace expansion"
@@ -123,8 +121,6 @@
123//config: bool "Save command history to .hush_history" 121//config: bool "Save command history to .hush_history"
124//config: default y 122//config: default y
125//config: depends on HUSH_INTERACTIVE && FEATURE_EDITING_SAVEHISTORY 123//config: depends on HUSH_INTERACTIVE && FEATURE_EDITING_SAVEHISTORY
126//config: help
127//config: Enable history saving in hush.
128//config: 124//config:
129//config:config HUSH_JOB 125//config:config HUSH_JOB
130//config: bool "Job control" 126//config: bool "Job control"
@@ -138,39 +134,35 @@
138//config: but no separate process group is formed. 134//config: but no separate process group is formed.
139//config: 135//config:
140//config:config HUSH_TICK 136//config:config HUSH_TICK
141//config: bool "Process substitution" 137//config: bool "Support process substitution"
142//config: default y 138//config: default y
143//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 139//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
144//config: help 140//config: help
145//config: Enable process substitution `command` and $(command) in hush. 141//config: Enable `command` and $(command).
146//config: 142//config:
147//config:config HUSH_IF 143//config:config HUSH_IF
148//config: bool "Support if/then/elif/else/fi" 144//config: bool "Support if/then/elif/else/fi"
149//config: default y 145//config: default y
150//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 146//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
151//config: help
152//config: Enable if/then/elif/else/fi in hush.
153//config: 147//config:
154//config:config HUSH_LOOPS 148//config:config HUSH_LOOPS
155//config: bool "Support for, while and until loops" 149//config: bool "Support for, while and until loops"
156//config: default y 150//config: default y
157//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 151//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
158//config: help
159//config: Enable for, while and until loops in hush.
160//config: 152//config:
161//config:config HUSH_CASE 153//config:config HUSH_CASE
162//config: bool "Support case ... esac statement" 154//config: bool "Support case ... esac statement"
163//config: default y 155//config: default y
164//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 156//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
165//config: help 157//config: help
166//config: Enable case ... esac statement in hush. +400 bytes. 158//config: Enable case ... esac statement. +400 bytes.
167//config: 159//config:
168//config:config HUSH_FUNCTIONS 160//config:config HUSH_FUNCTIONS
169//config: bool "Support funcname() { commands; } syntax" 161//config: bool "Support funcname() { commands; } syntax"
170//config: default y 162//config: default y
171//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 163//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
172//config: help 164//config: help
173//config: Enable support for shell functions in hush. +800 bytes. 165//config: Enable support for shell functions. +800 bytes.
174//config: 166//config:
175//config:config HUSH_LOCAL 167//config:config HUSH_LOCAL
176//config: bool "local builtin" 168//config: bool "local builtin"
@@ -199,22 +191,21 @@
199//config: bool "echo builtin" 191//config: bool "echo builtin"
200//config: default y 192//config: default y
201//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 193//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
202//config: help
203//config: Enable echo builtin in hush.
204//config: 194//config:
205//config:config HUSH_PRINTF 195//config:config HUSH_PRINTF
206//config: bool "printf builtin" 196//config: bool "printf builtin"
207//config: default y 197//config: default y
208//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 198//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
209//config: help 199//config:
210//config: Enable printf builtin in hush. 200//config:config HUSH_HELP
201//config: bool "help builtin"
202//config: default y
203//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
211//config: 204//config:
212//config:config HUSH_EXPORT 205//config:config HUSH_EXPORT
213//config: bool "export builtin" 206//config: bool "export builtin"
214//config: default y 207//config: default y
215//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 208//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
216//config: help
217//config: Enable export builtin in hush.
218//config: 209//config:
219//config:config HUSH_EXPORT_N 210//config:config HUSH_EXPORT_N
220//config: bool "Support 'export -n' option" 211//config: bool "Support 'export -n' option"
@@ -223,82 +214,55 @@
223//config: help 214//config: help
224//config: export -n unexports variables. It is a bash extension. 215//config: export -n unexports variables. It is a bash extension.
225//config: 216//config:
226//config:config HUSH_HELP
227//config: bool "help builtin"
228//config: default y
229//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
230//config: help
231//config: Enable help builtin in hush. Code size + ~1 kbyte.
232//config:
233//config:config HUSH_KILL 217//config:config HUSH_KILL
234//config: bool "kill builtin (for kill %jobspec)" 218//config: bool "kill builtin (supports kill %jobspec)"
235//config: default y 219//config: default y
236//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 220//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
237//config: help
238//config: Enable kill builtin in hush.
239//config: 221//config:
240//config:config HUSH_WAIT 222//config:config HUSH_WAIT
241//config: bool "wait builtin" 223//config: bool "wait builtin"
242//config: default y 224//config: default y
243//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 225//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
244//config: help
245//config: Enable wait builtin in hush.
246//config: 226//config:
247//config:config HUSH_TRAP 227//config:config HUSH_TRAP
248//config: bool "trap builtin" 228//config: bool "trap builtin"
249//config: default y 229//config: default y
250//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 230//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
251//config: help
252//config: Enable trap builtin in hush.
253//config:
254//config:config HUSH_ULIMIT
255//config: bool "ulimit builtin"
256//config: default y
257//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
258//config: help
259//config: Enable ulimit builtin in hush.
260//config: 231//config:
261//config:config HUSH_TYPE 232//config:config HUSH_TYPE
262//config: bool "type builtin" 233//config: bool "type builtin"
263//config: default y 234//config: default y
264//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 235//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
265//config: help
266//config: Enable type builtin in hush.
267//config: 236//config:
268//config:config HUSH_READ 237//config:config HUSH_READ
269//config: bool "read builtin" 238//config: bool "read builtin"
270//config: default y 239//config: default y
271//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 240//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
272//config: help
273//config: Enable read builtin in hush.
274//config: 241//config:
275//config:config HUSH_SET 242//config:config HUSH_SET
276//config: bool "set builtin" 243//config: bool "set builtin"
277//config: default y 244//config: default y
278//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 245//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
279//config: help
280//config: Enable set builtin in hush.
281//config: 246//config:
282//config:config HUSH_UNSET 247//config:config HUSH_UNSET
283//config: bool "unset builtin" 248//config: bool "unset builtin"
284//config: default y 249//config: default y
285//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 250//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
286//config: help 251//config:
287//config: Enable unset builtin in hush. 252//config:config HUSH_ULIMIT
253//config: bool "ulimit builtin"
254//config: default y
255//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
288//config: 256//config:
289//config:config HUSH_UMASK 257//config:config HUSH_UMASK
290//config: bool "umask builtin" 258//config: bool "umask builtin"
291//config: default y 259//config: default y
292//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 260//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
293//config: help
294//config: Enable umask builtin in hush.
295//config: 261//config:
296//config:config HUSH_MEMLEAK 262//config:config HUSH_MEMLEAK
297//config: bool "memleak builtin (debugging)" 263//config: bool "memleak builtin (debugging)"
298//config: default n 264//config: default n
299//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 265//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
300//config: help
301//config: Enable memleak builtin in hush.
302//config: 266//config:
303//config:config MSH 267//config:config MSH
304//config: bool "msh (deprecated: aliased to hush)" 268//config: bool "msh (deprecated: aliased to hush)"
@@ -1096,8 +1060,6 @@ static const struct built_in_command bltins1[] = {
1096 BLTIN("wait" , builtin_wait , "Wait for process"), 1060 BLTIN("wait" , builtin_wait , "Wait for process"),
1097#endif 1061#endif
1098}; 1062};
1099/* For now, echo and test are unconditionally enabled.
1100 * Maybe make it configurable? */
1101static const struct built_in_command bltins2[] = { 1063static const struct built_in_command bltins2[] = {
1102 BLTIN("[" , builtin_test , NULL), 1064 BLTIN("[" , builtin_test , NULL),
1103#if ENABLE_HUSH_ECHO 1065#if ENABLE_HUSH_ECHO