diff options
author | Denys Vlasenko | 2017-01-09 17:10:04 +0100 |
---|---|---|
committer | Denys Vlasenko | 2017-01-09 17:10:04 +0100 |
commit | 1cc6804f6980d2732df97f15933c93d34041dd83 (patch) | |
tree | 4a8c43e645df9271c2bb3a6019cab65f1ff7a8ad /shell | |
parent | 53487a8d221d9568b6d2ea81e729456b084dcdf9 (diff) | |
download | busybox-1cc6804f6980d2732df97f15933c93d34041dd83.zip busybox-1cc6804f6980d2732df97f15933c93d34041dd83.tar.gz |
hush: make echo builtin optional
It's a bit overkill (who would want it off?) but ash already has it
configurable. Let's be symmetric.
Also tweak kbuild logic to use ASH_BUILTIN_ECHO to select echo.o,
not ASH.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/hush.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/shell/hush.c b/shell/hush.c index 5c5715b..22d71cb 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -195,6 +195,20 @@ //config: This instructs hush to print commands before execution. //config: Adds ~300 bytes. //config: +//config:config HUSH_ECHO +//config: bool "echo builtin" +//config: default y +//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH +//config: help +//config: Enable echo builtin in hush. +//config: +//config:config HUSH_PRINTF +//config: bool "printf builtin" +//config: default y +//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH +//config: help +//config: Enable printf builtin in hush. +//config: //config:config HUSH_EXPORT //config: bool "export builtin" //config: default y @@ -216,13 +230,6 @@ //config: help //config: Enable help builtin in hush. Code size + ~1 kbyte. //config: -//config:config HUSH_PRINTF -//config: bool "printf builtin" -//config: default y -//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH -//config: help -//config: Enable printf builtin in hush. -//config: //config:config HUSH_KILL //config: bool "kill builtin (for kill %jobspec)" //config: default y @@ -934,7 +941,9 @@ struct globals { /* Function prototypes for builtins */ static int builtin_cd(char **argv) FAST_FUNC; +#if ENABLE_HUSH_ECHO static int builtin_echo(char **argv) FAST_FUNC; +#endif static int builtin_eval(char **argv) FAST_FUNC; static int builtin_exec(char **argv) FAST_FUNC; static int builtin_exit(char **argv) FAST_FUNC; @@ -1091,7 +1100,9 @@ static const struct built_in_command bltins1[] = { * Maybe make it configurable? */ static const struct built_in_command bltins2[] = { BLTIN("[" , builtin_test , NULL), +#if ENABLE_HUSH_ECHO BLTIN("echo" , builtin_echo , NULL), +#endif #if ENABLE_HUSH_PRINTF BLTIN("printf" , builtin_printf , NULL), #endif @@ -8832,12 +8843,12 @@ static int FAST_FUNC builtin_test(char **argv) { return run_applet_main(argv, test_main); } - +#if ENABLE_HUSH_ECHO static int FAST_FUNC builtin_echo(char **argv) { return run_applet_main(argv, echo_main); } - +#endif #if ENABLE_HUSH_PRINTF static int FAST_FUNC builtin_printf(char **argv) { |