aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-01 22:36:39 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-01 22:36:39 +0000
commitcd2663f15e74274619dd97dc382bb858ac255872 (patch)
treef86565e574c3488794383b910b9f3fa3ae27df48 /shell
parentd78920675f31d6ec87dc883c4edc0f3862b22f6a (diff)
downloadbusybox-cd2663f15e74274619dd97dc382bb858ac255872.tar.gz
ash: optional printf builtin. +25 bytes if off, +35 if on.
by Cristian Ionescu-Idbohrn.
Diffstat (limited to 'shell')
-rw-r--r--shell/Config.in7
-rw-r--r--shell/ash.c14
2 files changed, 16 insertions, 5 deletions
diff --git a/shell/Config.in b/shell/Config.in
index 94ffa09f8..a6701622c 100644
--- a/shell/Config.in
+++ b/shell/Config.in
@@ -114,6 +114,13 @@ config ASH_BUILTIN_ECHO
help
Enable support for echo, builtin to ash.
+config ASH_BUILTIN_PRINTF
+ bool "Builtin version of 'printf'"
+ default y
+ depends on ASH
+ help
+ Enable support for printf, builtin to ash.
+
config ASH_BUILTIN_TEST
bool "Builtin version of 'test'"
default y
diff --git a/shell/ash.c b/shell/ash.c
index 20b93f326..31beb8671 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8488,17 +8488,18 @@ static int ulimitcmd(int, char **);
* Apart from the above, [[ expr ]] should work as [ expr ]
*/
-#define testcmd test_main
-#define echocmd echo_main
+#define echocmd echo_main
+#define printfcmd printf_main
+#define testcmd test_main
/* Keep these in proper order since it is searched via bsearch() */
static const struct builtincmd builtintab[] = {
{ BUILTIN_SPEC_REG ".", dotcmd },
{ BUILTIN_SPEC_REG ":", truecmd },
#if ENABLE_ASH_BUILTIN_TEST
- { BUILTIN_REGULAR "[", testcmd },
+ { BUILTIN_REGULAR "[", testcmd },
#if ENABLE_ASH_BASH_COMPAT
- { BUILTIN_REGULAR "[[", testcmd },
+ { BUILTIN_REGULAR "[[", testcmd },
#endif
#endif
#if ENABLE_ASH_ALIAS
@@ -8540,6 +8541,9 @@ static const struct builtincmd builtintab[] = {
{ BUILTIN_NOSPEC "let", letcmd },
#endif
{ BUILTIN_ASSIGN "local", localcmd },
+#if ENABLE_ASH_BUILTIN_PRINTF
+ { BUILTIN_REGULAR "printf", printfcmd },
+#endif
{ BUILTIN_NOSPEC "pwd", pwdcmd },
{ BUILTIN_REGULAR "read", readcmd },
{ BUILTIN_SPEC_REG_ASSG "readonly", exportcmd },
@@ -8548,7 +8552,7 @@ static const struct builtincmd builtintab[] = {
{ BUILTIN_SPEC_REG "shift", shiftcmd },
{ BUILTIN_SPEC_REG "source", dotcmd },
#if ENABLE_ASH_BUILTIN_TEST
- { BUILTIN_REGULAR "test", testcmd },
+ { BUILTIN_REGULAR "test", testcmd },
#endif
{ BUILTIN_SPEC_REG "times", timescmd },
{ BUILTIN_SPEC_REG "trap", trapcmd },