aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-01-11 18:05:05 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-01-11 18:05:05 +0100
commit3bb3e1d0a1eed01306e22e59db8de6c2d945165a (patch)
treef2df470ae2de4417fad4c2f75f33bc544e92a454
parent1f1911239c0874d49a31d0ef2e618d0a1086a8df (diff)
downloadbusybox-w32-3bb3e1d0a1eed01306e22e59db8de6c2d945165a.tar.gz
busybox-w32-3bb3e1d0a1eed01306e22e59db8de6c2d945165a.tar.bz2
busybox-w32-3bb3e1d0a1eed01306e22e59db8de6c2d945165a.zip
hush: implement "command" builtin (no options are supported yet)
function old new delta pseudo_exec_argv 194 231 +37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c
index c2b987f49..93779ba1e 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -58,6 +58,7 @@
58 * (can use this to override standalone shell as well) 58 * (can use this to override standalone shell as well)
59 * -p: use default $PATH 59 * -p: use default $PATH
60 * command BLTIN: disables special-ness (e.g. errors do not abort) 60 * command BLTIN: disables special-ness (e.g. errors do not abort)
61 * NB: so far, only naked "command CMD" is implemented.
61 * fc -l[nr] [BEG] [END]: list range of commands in history 62 * fc -l[nr] [BEG] [END]: list range of commands in history
62 * fc [-e EDITOR] [BEG] [END]: edit/rerun range of commands 63 * fc [-e EDITOR] [BEG] [END]: edit/rerun range of commands
63 * fc -s [PAT=REP] [CMD]: rerun CMD, replacing PAT with REP 64 * fc -s [PAT=REP] [CMD]: rerun CMD, replacing PAT with REP
@@ -253,6 +254,11 @@
253//config: default y 254//config: default y
254//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH 255//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
255//config: 256//config:
257//config:config HUSH_COMMAND
258//config: bool "command builtin"
259//config: default y
260//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
261//config:
256//config:config HUSH_TRAP 262//config:config HUSH_TRAP
257//config: bool "trap builtin" 263//config: bool "trap builtin"
258//config: default y 264//config: default y
@@ -7406,11 +7412,20 @@ static NOINLINE void pseudo_exec_argv(nommu_save_t *nommu_save,
7406 * if this is one of those cases. 7412 * if this is one of those cases.
7407 */ 7413 */
7408 { 7414 {
7415 const struct built_in_command *x;
7416
7417#if ENABLE_HUSH_COMMAND
7418 /* This loop effectively makes "command BAR" run BAR without
7419 * looking it up among functions.
7420 */
7421 while (strcmp(argv[0], "command") == 0 && argv[1])
7422 argv++;
7423//TODO: implement -Vvp and "disable dying if BAR is a builtin" behavior
7424#endif
7409 /* On NOMMU, it is more expensive to re-execute shell 7425 /* On NOMMU, it is more expensive to re-execute shell
7410 * just in order to run echo or test builtin. 7426 * just in order to run echo or test builtin.
7411 * It's better to skip it here and run corresponding 7427 * It's better to skip it here and run corresponding
7412 * non-builtin later. */ 7428 * non-builtin later. */
7413 const struct built_in_command *x;
7414 x = BB_MMU ? find_builtin(argv[0]) : find_builtin1(argv[0]); 7429 x = BB_MMU ? find_builtin(argv[0]) : find_builtin1(argv[0]);
7415 if (x) { 7430 if (x) {
7416 exec_builtin(&nommu_save->argv_from_re_execing, x, argv); 7431 exec_builtin(&nommu_save->argv_from_re_execing, x, argv);