aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c85
-rw-r--r--shell/hush.c68
2 files changed, 51 insertions, 102 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 9c46a93e0..20ed9652c 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -35,8 +35,6 @@
35//config: bool "Optimize for size instead of speed" 35//config: bool "Optimize for size instead of speed"
36//config: default y 36//config: default y
37//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 37//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
38//config: help
39//config: Compile ash for reduced size at the price of speed.
40//config: 38//config:
41//config:config ASH_INTERNAL_GLOB 39//config:config ASH_INTERNAL_GLOB
42//config: bool "Use internal glob() implementation" 40//config: bool "Use internal glob() implementation"
@@ -46,6 +44,23 @@
46//config: Do not use glob() function from libc, use internal implementation. 44//config: Do not use glob() function from libc, use internal implementation.
47//config: Use this if you are getting "glob.h: No such file or directory" 45//config: Use this if you are getting "glob.h: No such file or directory"
48//config: or similar build errors. 46//config: or similar build errors.
47//config: Note that as of now (2017-01), uclibc and musl glob() both have bugs
48//config: which would break ash if you select N here.
49//config:
50//config:config ASH_BASH_COMPAT
51//config: bool "bash-compatible extensions"
52//config: default y
53//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
54//config:
55//config:config ASH_JOB_CONTROL
56//config: bool "Job control"
57//config: default y
58//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
59//config:
60//config:config ASH_ALIAS
61//config: bool "Alias support"
62//config: default y
63//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
49//config: 64//config:
50//config:config ASH_RANDOM_SUPPORT 65//config:config ASH_RANDOM_SUPPORT
51//config: bool "Pseudorandom generator and $RANDOM variable" 66//config: bool "Pseudorandom generator and $RANDOM variable"
@@ -63,88 +78,60 @@
63//config: default y 78//config: default y
64//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 79//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
65//config: help 80//config: help
66//config: "PS#" may contain volatile content, such as backquote commands. 81//config: $PS# may contain volatile content, such as backquote commands.
67//config: This option recreates the prompt string from the environment 82//config: This option recreates the prompt string from the environment
68//config: variable each time it is displayed. 83//config: variable each time it is displayed.
69//config: 84//config:
70//config:config ASH_BASH_COMPAT
71//config: bool "bash-compatible extensions"
72//config: default y
73//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
74//config: help
75//config: Enable bash-compatible extensions.
76//config:
77//config:config ASH_IDLE_TIMEOUT 85//config:config ASH_IDLE_TIMEOUT
78//config: bool "Idle timeout variable" 86//config: bool "Idle timeout variable $TMOUT"
79//config: default n
80//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
81//config: help
82//config: Enables bash-like auto-logout after $TMOUT seconds of idle time.
83//config:
84//config:config ASH_JOB_CONTROL
85//config: bool "Job control"
86//config: default y
87//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
88//config: help
89//config: Enable job control in the ash shell.
90//config:
91//config:config ASH_ALIAS
92//config: bool "Alias support"
93//config: default y 87//config: default y
94//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 88//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
95//config: help 89//config: help
96//config: Enable alias support in the ash shell. 90//config: Enable bash-like auto-logout after $TMOUT seconds of idle time.
97//config: 91//config:
98//config:config ASH_GETOPTS 92//config:config ASH_MAIL
99//config: bool "Builtin getopt to parse positional parameters" 93//config: bool "Check for new mail in interactive shell"
100//config: default y 94//config: default y
101//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 95//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
102//config: help 96//config: help
103//config: Enable support for getopts builtin in ash. 97//config: Enable "check for new mail" function:
98//config: if set, $MAIL file and $MAILPATH list of files
99//config: are checked for mtime changes, and "you have mail"
100//config: message is printed if change is detected.
104//config: 101//config:
105//config:config ASH_BUILTIN_ECHO 102//config:config ASH_BUILTIN_ECHO
106//config: bool "Builtin version of 'echo'" 103//config: bool "echo builtin"
107//config: default y 104//config: default y
108//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 105//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
109//config: help
110//config: Enable support for echo builtin in ash.
111//config: 106//config:
112//config:config ASH_BUILTIN_PRINTF 107//config:config ASH_BUILTIN_PRINTF
113//config: bool "Builtin version of 'printf'" 108//config: bool "printf builtin"
114//config: default y 109//config: default y
115//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 110//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
116//config: help
117//config: Enable support for printf builtin in ash.
118//config: 111//config:
119//config:config ASH_BUILTIN_TEST 112//config:config ASH_BUILTIN_TEST
120//config: bool "Builtin version of 'test'" 113//config: bool "test builtin"
121//config: default y 114//config: default y
122//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 115//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
123//config: help
124//config: Enable support for test builtin in ash.
125//config: 116//config:
126//config:config ASH_HELP 117//config:config ASH_HELP
127//config: bool "help builtin" 118//config: bool "help builtin"
128//config: default y 119//config: default y
129//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 120//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
130//config: help
131//config: Enable help builtin in ash.
132//config: 121//config:
133//config:config ASH_CMDCMD 122//config:config ASH_GETOPTS
134//config: bool "'command' command to override shell builtins" 123//config: bool "getopts builtin"
135//config: default y 124//config: default y
136//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 125//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
137//config: help
138//config: Enable support for the ash 'command' builtin, which allows
139//config: you to run the specified command with the specified arguments,
140//config: even when there is an ash builtin command with the same name.
141//config: 126//config:
142//config:config ASH_MAIL 127//config:config ASH_CMDCMD
143//config: bool "Check for new mail on interactive shells" 128//config: bool "command builtin"
144//config: default y 129//config: default y
145//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH 130//config: depends on ASH || SH_IS_ASH || BASH_IS_ASH
146//config: help 131//config: help
147//config: Enable "check for new mail" function in the ash shell. 132//config: Enable support for the 'command' builtin, which allows
133//config: you to run the specified command or builtin,
134//config: even when there is a function with the same name.
148//config: 135//config:
149//config:endif # ash options 136//config:endif # ash options
150 137
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