diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-01 22:36:39 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-01 22:36:39 +0000 |
commit | cd2663f15e74274619dd97dc382bb858ac255872 (patch) | |
tree | f86565e574c3488794383b910b9f3fa3ae27df48 /shell | |
parent | d78920675f31d6ec87dc883c4edc0f3862b22f6a (diff) | |
download | busybox-w32-cd2663f15e74274619dd97dc382bb858ac255872.tar.gz busybox-w32-cd2663f15e74274619dd97dc382bb858ac255872.tar.bz2 busybox-w32-cd2663f15e74274619dd97dc382bb858ac255872.zip |
ash: optional printf builtin. +25 bytes if off, +35 if on.
by Cristian Ionescu-Idbohrn.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/Config.in | 7 | ||||
-rw-r--r-- | shell/ash.c | 14 |
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 | |||
114 | help | 114 | help |
115 | Enable support for echo, builtin to ash. | 115 | Enable support for echo, builtin to ash. |
116 | 116 | ||
117 | config ASH_BUILTIN_PRINTF | ||
118 | bool "Builtin version of 'printf'" | ||
119 | default y | ||
120 | depends on ASH | ||
121 | help | ||
122 | Enable support for printf, builtin to ash. | ||
123 | |||
117 | config ASH_BUILTIN_TEST | 124 | config ASH_BUILTIN_TEST |
118 | bool "Builtin version of 'test'" | 125 | bool "Builtin version of 'test'" |
119 | default y | 126 | 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 **); | |||
8488 | * Apart from the above, [[ expr ]] should work as [ expr ] | 8488 | * Apart from the above, [[ expr ]] should work as [ expr ] |
8489 | */ | 8489 | */ |
8490 | 8490 | ||
8491 | #define testcmd test_main | 8491 | #define echocmd echo_main |
8492 | #define echocmd echo_main | 8492 | #define printfcmd printf_main |
8493 | #define testcmd test_main | ||
8493 | 8494 | ||
8494 | /* Keep these in proper order since it is searched via bsearch() */ | 8495 | /* Keep these in proper order since it is searched via bsearch() */ |
8495 | static const struct builtincmd builtintab[] = { | 8496 | static const struct builtincmd builtintab[] = { |
8496 | { BUILTIN_SPEC_REG ".", dotcmd }, | 8497 | { BUILTIN_SPEC_REG ".", dotcmd }, |
8497 | { BUILTIN_SPEC_REG ":", truecmd }, | 8498 | { BUILTIN_SPEC_REG ":", truecmd }, |
8498 | #if ENABLE_ASH_BUILTIN_TEST | 8499 | #if ENABLE_ASH_BUILTIN_TEST |
8499 | { BUILTIN_REGULAR "[", testcmd }, | 8500 | { BUILTIN_REGULAR "[", testcmd }, |
8500 | #if ENABLE_ASH_BASH_COMPAT | 8501 | #if ENABLE_ASH_BASH_COMPAT |
8501 | { BUILTIN_REGULAR "[[", testcmd }, | 8502 | { BUILTIN_REGULAR "[[", testcmd }, |
8502 | #endif | 8503 | #endif |
8503 | #endif | 8504 | #endif |
8504 | #if ENABLE_ASH_ALIAS | 8505 | #if ENABLE_ASH_ALIAS |
@@ -8540,6 +8541,9 @@ static const struct builtincmd builtintab[] = { | |||
8540 | { BUILTIN_NOSPEC "let", letcmd }, | 8541 | { BUILTIN_NOSPEC "let", letcmd }, |
8541 | #endif | 8542 | #endif |
8542 | { BUILTIN_ASSIGN "local", localcmd }, | 8543 | { BUILTIN_ASSIGN "local", localcmd }, |
8544 | #if ENABLE_ASH_BUILTIN_PRINTF | ||
8545 | { BUILTIN_REGULAR "printf", printfcmd }, | ||
8546 | #endif | ||
8543 | { BUILTIN_NOSPEC "pwd", pwdcmd }, | 8547 | { BUILTIN_NOSPEC "pwd", pwdcmd }, |
8544 | { BUILTIN_REGULAR "read", readcmd }, | 8548 | { BUILTIN_REGULAR "read", readcmd }, |
8545 | { BUILTIN_SPEC_REG_ASSG "readonly", exportcmd }, | 8549 | { BUILTIN_SPEC_REG_ASSG "readonly", exportcmd }, |
@@ -8548,7 +8552,7 @@ static const struct builtincmd builtintab[] = { | |||
8548 | { BUILTIN_SPEC_REG "shift", shiftcmd }, | 8552 | { BUILTIN_SPEC_REG "shift", shiftcmd }, |
8549 | { BUILTIN_SPEC_REG "source", dotcmd }, | 8553 | { BUILTIN_SPEC_REG "source", dotcmd }, |
8550 | #if ENABLE_ASH_BUILTIN_TEST | 8554 | #if ENABLE_ASH_BUILTIN_TEST |
8551 | { BUILTIN_REGULAR "test", testcmd }, | 8555 | { BUILTIN_REGULAR "test", testcmd }, |
8552 | #endif | 8556 | #endif |
8553 | { BUILTIN_SPEC_REG "times", timescmd }, | 8557 | { BUILTIN_SPEC_REG "times", timescmd }, |
8554 | { BUILTIN_SPEC_REG "trap", trapcmd }, | 8558 | { BUILTIN_SPEC_REG "trap", trapcmd }, |