diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-07-05 21:37:12 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-07-05 21:37:12 +0200 |
commit | 9297dbc9d285e823af59c443e0123cb99577569a (patch) | |
tree | 134bb16eaaa4f0a7148aed3a78c7c797108e6568 /shell/hush.c | |
parent | 08f0b784fd4351929090c877605762d664e70098 (diff) | |
download | busybox-w32-9297dbc9d285e823af59c443e0123cb99577569a.tar.gz busybox-w32-9297dbc9d285e823af59c443e0123cb99577569a.tar.bz2 busybox-w32-9297dbc9d285e823af59c443e0123cb99577569a.zip |
randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/shell/hush.c b/shell/hush.c index 831443e2e..31ca22a2e 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -117,6 +117,10 @@ | |||
117 | * and therefore waitpid will return the same result as last time) | 117 | * and therefore waitpid will return the same result as last time) |
118 | */ | 118 | */ |
119 | #define ENABLE_HUSH_FAST 0 | 119 | #define ENABLE_HUSH_FAST 0 |
120 | /* TODO: implement simplified code for users which do not need ${var%...} ops | ||
121 | * So far ${var%...} ops are always enabled: | ||
122 | */ | ||
123 | #define ENABLE_HUSH_DOLLAR_OPS 1 | ||
120 | 124 | ||
121 | 125 | ||
122 | #if BUILD_AS_NOMMU | 126 | #if BUILD_AS_NOMMU |
@@ -2681,7 +2685,7 @@ static NOINLINE int expand_vars_to_list(o_string *output, int n, char *arg, char | |||
2681 | } | 2685 | } |
2682 | } | 2686 | } |
2683 | } else if (exp_op == ':') { | 2687 | } else if (exp_op == ':') { |
2684 | #if ENABLE_HUSH_BASH_COMPAT | 2688 | #if ENABLE_HUSH_BASH_COMPAT && ENABLE_SH_MATH_SUPPORT |
2685 | /* It's ${var:N[:M]} bashism. | 2689 | /* It's ${var:N[:M]} bashism. |
2686 | * Note that in encoded form it has TWO parts: | 2690 | * Note that in encoded form it has TWO parts: |
2687 | * var:N<SPECIAL_VAR_SYMBOL>M<SPECIAL_VAR_SYMBOL> | 2691 | * var:N<SPECIAL_VAR_SYMBOL>M<SPECIAL_VAR_SYMBOL> |
@@ -5820,7 +5824,7 @@ static int parse_group(o_string *dest, struct parse_context *ctx, | |||
5820 | /* command remains "open", available for possible redirects */ | 5824 | /* command remains "open", available for possible redirects */ |
5821 | } | 5825 | } |
5822 | 5826 | ||
5823 | #if ENABLE_HUSH_TICK || ENABLE_SH_MATH_SUPPORT | 5827 | #if ENABLE_HUSH_TICK || ENABLE_SH_MATH_SUPPORT || ENABLE_HUSH_DOLLAR_OPS |
5824 | /* Subroutines for copying $(...) and `...` things */ | 5828 | /* Subroutines for copying $(...) and `...` things */ |
5825 | static void add_till_backquote(o_string *dest, struct in_str *input); | 5829 | static void add_till_backquote(o_string *dest, struct in_str *input); |
5826 | /* '...' */ | 5830 | /* '...' */ |
@@ -5921,9 +5925,9 @@ static int add_till_closing_bracket(o_string *dest, struct in_str *input, unsign | |||
5921 | { | 5925 | { |
5922 | int ch; | 5926 | int ch; |
5923 | char dbl = end_ch & DOUBLE_CLOSE_CHAR_FLAG; | 5927 | char dbl = end_ch & DOUBLE_CLOSE_CHAR_FLAG; |
5924 | #if ENABLE_HUSH_BASH_COMPAT | 5928 | # if ENABLE_HUSH_BASH_COMPAT |
5925 | char end_char2 = end_ch >> 8; | 5929 | char end_char2 = end_ch >> 8; |
5926 | #endif | 5930 | # endif |
5927 | end_ch &= (DOUBLE_CLOSE_CHAR_FLAG - 1); | 5931 | end_ch &= (DOUBLE_CLOSE_CHAR_FLAG - 1); |
5928 | 5932 | ||
5929 | while (1) { | 5933 | while (1) { |
@@ -5976,7 +5980,7 @@ static int add_till_closing_bracket(o_string *dest, struct in_str *input, unsign | |||
5976 | } | 5980 | } |
5977 | return ch; | 5981 | return ch; |
5978 | } | 5982 | } |
5979 | #endif /* ENABLE_HUSH_TICK || ENABLE_SH_MATH_SUPPORT */ | 5983 | #endif /* ENABLE_HUSH_TICK || ENABLE_SH_MATH_SUPPORT || ENABLE_HUSH_DOLLAR_OPS */ |
5980 | 5984 | ||
5981 | /* Return code: 0 for OK, 1 for syntax error */ | 5985 | /* Return code: 0 for OK, 1 for syntax error */ |
5982 | #if BB_MMU | 5986 | #if BB_MMU |
@@ -6082,7 +6086,11 @@ static int parse_dollar(o_string *as_string, | |||
6082 | again: | 6086 | again: |
6083 | if (!BB_MMU) | 6087 | if (!BB_MMU) |
6084 | pos = dest->length; | 6088 | pos = dest->length; |
6089 | #if ENABLE_HUSH_DOLLAR_OPS | ||
6085 | last_ch = add_till_closing_bracket(dest, input, end_ch); | 6090 | last_ch = add_till_closing_bracket(dest, input, end_ch); |
6091 | #else | ||
6092 | #error Simple code to only allow ${var} is not implemented | ||
6093 | #endif | ||
6086 | if (as_string) { | 6094 | if (as_string) { |
6087 | o_addstr(as_string, dest->data + pos); | 6095 | o_addstr(as_string, dest->data + pos); |
6088 | o_addchr(as_string, last_ch); | 6096 | o_addchr(as_string, last_ch); |