diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-09 17:10:04 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-01-09 17:10:04 +0100 |
commit | 1cc6804f6980d2732df97f15933c93d34041dd83 (patch) | |
tree | 4a8c43e645df9271c2bb3a6019cab65f1ff7a8ad | |
parent | 53487a8d221d9568b6d2ea81e729456b084dcdf9 (diff) | |
download | busybox-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>
-rw-r--r-- | coreutils/Kbuild.src | 12 | ||||
-rw-r--r-- | shell/hush.c | 29 |
2 files changed, 24 insertions, 17 deletions
diff --git a/coreutils/Kbuild.src b/coreutils/Kbuild.src index 9ac6b9e78..d0b3f629b 100644 --- a/coreutils/Kbuild.src +++ b/coreutils/Kbuild.src | |||
@@ -14,15 +14,11 @@ lib-$(CONFIG_MORE) += cat.o # more uses it if stdout isn't a tty | |||
14 | lib-$(CONFIG_LESS) += cat.o # less too | 14 | lib-$(CONFIG_LESS) += cat.o # less too |
15 | lib-$(CONFIG_CRONTAB) += cat.o # crontab -l | 15 | lib-$(CONFIG_CRONTAB) += cat.o # crontab -l |
16 | lib-$(CONFIG_ADDUSER) += chown.o # used by adduser | 16 | lib-$(CONFIG_ADDUSER) += chown.o # used by adduser |
17 | lib-$(CONFIG_ADDGROUP) += chown.o # used by adduser | 17 | lib-$(CONFIG_ADDGROUP) += chown.o # used by addgroup |
18 | lib-$(CONFIG_FTPD) += ls.o # used by ftpd | 18 | lib-$(CONFIG_FTPD) += ls.o # used by ftpd |
19 | 19 | ||
20 | lib-$(CONFIG_ASH) += echo.o # used by ash | 20 | lib-$(CONFIG_ASH_BUILTIN_ECHO) += echo.o |
21 | lib-$(CONFIG_SH_IS_ASH) += echo.o # used by ash | 21 | lib-$(CONFIG_HUSH_ECHO) += echo.o |
22 | lib-$(CONFIG_BASH_IS_ASH) += echo.o # used by ash | ||
23 | lib-$(CONFIG_HUSH) += echo.o # used by hush | ||
24 | lib-$(CONFIG_SH_IS_HUSH) += echo.o # used by hush | ||
25 | lib-$(CONFIG_BASH_IS_HUSH) += echo.o # used by hush | ||
26 | 22 | ||
27 | lib-$(CONFIG_ASH_BUILTIN_PRINTF) += printf.o | 23 | lib-$(CONFIG_ASH_BUILTIN_PRINTF) += printf.o |
28 | lib-$(CONFIG_HUSH_PRINTF) += printf.o | 24 | lib-$(CONFIG_HUSH_PRINTF) += printf.o |
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 */ |
936 | static int builtin_cd(char **argv) FAST_FUNC; | 943 | static int builtin_cd(char **argv) FAST_FUNC; |
944 | #if ENABLE_HUSH_ECHO | ||
937 | static int builtin_echo(char **argv) FAST_FUNC; | 945 | static int builtin_echo(char **argv) FAST_FUNC; |
946 | #endif | ||
938 | static int builtin_eval(char **argv) FAST_FUNC; | 947 | static int builtin_eval(char **argv) FAST_FUNC; |
939 | static int builtin_exec(char **argv) FAST_FUNC; | 948 | static int builtin_exec(char **argv) FAST_FUNC; |
940 | static int builtin_exit(char **argv) FAST_FUNC; | 949 | static 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? */ |
1092 | static const struct built_in_command bltins2[] = { | 1101 | static 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 | |
8836 | static int FAST_FUNC builtin_echo(char **argv) | 8847 | static 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 |
8842 | static int FAST_FUNC builtin_printf(char **argv) | 8853 | static int FAST_FUNC builtin_printf(char **argv) |
8843 | { | 8854 | { |