aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-01-09 17:10:04 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2017-01-09 17:10:04 +0100
commit1cc6804f6980d2732df97f15933c93d34041dd83 (patch)
tree4a8c43e645df9271c2bb3a6019cab65f1ff7a8ad /shell
parent53487a8d221d9568b6d2ea81e729456b084dcdf9 (diff)
downloadbusybox-w32-1cc6804f6980d2732df97f15933c93d34041dd83.tar.gz
busybox-w32-1cc6804f6980d2732df97f15933c93d34041dd83.tar.bz2
busybox-w32-1cc6804f6980d2732df97f15933c93d34041dd83.zip
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.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 5c5715b3f..22d71cb07 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -195,6 +195,20 @@
195//config: This instructs hush to print commands before execution. 195//config: This instructs hush to print commands before execution.
196//config: Adds ~300 bytes. 196//config: Adds ~300 bytes.
197//config: 197//config:
198//config:config HUSH_ECHO
199//config: bool "echo builtin"
200//config: default y
201//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
202//config: help
203//config: Enable echo builtin in hush.
204//config:
205//config:config HUSH_PRINTF
206//config: bool "printf builtin"
207//config: default y
208//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
209//config: help
210//config: Enable printf builtin in hush.
211//config:
198//config:config HUSH_EXPORT 212//config:config HUSH_EXPORT
199//config: bool "export builtin" 213//config: bool "export builtin"
200//config: default y 214//config: default y
@@ -216,13 +230,6 @@
216//config: help 230//config: help
217//config: Enable help builtin in hush. Code size + ~1 kbyte. 231//config: Enable help builtin in hush. Code size + ~1 kbyte.
218//config: 232//config:
219//config:config HUSH_PRINTF
220//config: bool "printf builtin"
221//config: default y
222//config: depends on HUSH || SH_IS_HUSH || BASH_IS_HUSH
223//config: help
224//config: Enable printf builtin in hush.
225//config:
226//config:config HUSH_KILL 233//config:config HUSH_KILL
227//config: bool "kill builtin (for kill %jobspec)" 234//config: bool "kill builtin (for kill %jobspec)"
228//config: default y 235//config: default y
@@ -934,7 +941,9 @@ struct globals {
934 941
935/* Function prototypes for builtins */ 942/* Function prototypes for builtins */
936static int builtin_cd(char **argv) FAST_FUNC; 943static int builtin_cd(char **argv) FAST_FUNC;
944#if ENABLE_HUSH_ECHO
937static int builtin_echo(char **argv) FAST_FUNC; 945static int builtin_echo(char **argv) FAST_FUNC;
946#endif
938static int builtin_eval(char **argv) FAST_FUNC; 947static int builtin_eval(char **argv) FAST_FUNC;
939static int builtin_exec(char **argv) FAST_FUNC; 948static int builtin_exec(char **argv) FAST_FUNC;
940static int builtin_exit(char **argv) FAST_FUNC; 949static int builtin_exit(char **argv) FAST_FUNC;
@@ -1091,7 +1100,9 @@ static const struct built_in_command bltins1[] = {
1091 * Maybe make it configurable? */ 1100 * Maybe make it configurable? */
1092static const struct built_in_command bltins2[] = { 1101static const struct built_in_command bltins2[] = {
1093 BLTIN("[" , builtin_test , NULL), 1102 BLTIN("[" , builtin_test , NULL),
1103#if ENABLE_HUSH_ECHO
1094 BLTIN("echo" , builtin_echo , NULL), 1104 BLTIN("echo" , builtin_echo , NULL),
1105#endif
1095#if ENABLE_HUSH_PRINTF 1106#if ENABLE_HUSH_PRINTF
1096 BLTIN("printf" , builtin_printf , NULL), 1107 BLTIN("printf" , builtin_printf , NULL),
1097#endif 1108#endif
@@ -8832,12 +8843,12 @@ static int FAST_FUNC builtin_test(char **argv)
8832{ 8843{
8833 return run_applet_main(argv, test_main); 8844 return run_applet_main(argv, test_main);
8834} 8845}
8835 8846#if ENABLE_HUSH_ECHO
8836static int FAST_FUNC builtin_echo(char **argv) 8847static int FAST_FUNC builtin_echo(char **argv)
8837{ 8848{
8838 return run_applet_main(argv, echo_main); 8849 return run_applet_main(argv, echo_main);
8839} 8850}
8840 8851#endif
8841#if ENABLE_HUSH_PRINTF 8852#if ENABLE_HUSH_PRINTF
8842static int FAST_FUNC builtin_printf(char **argv) 8853static int FAST_FUNC builtin_printf(char **argv)
8843{ 8854{