diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-12 12:58:20 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-12 12:58:20 +0000 |
commit | 76db5adbf70046dec92309a9785da08d1acf4e9d (patch) | |
tree | 17af552a8734448ca55f501e3df8e3e2ac018e00 /shell/hush.c | |
parent | bd1aeeb850e441e3fa4f9e1f8aedd804a48b9cb1 (diff) | |
download | busybox-w32-76db5adbf70046dec92309a9785da08d1acf4e9d.tar.gz busybox-w32-76db5adbf70046dec92309a9785da08d1acf4e9d.tar.bz2 busybox-w32-76db5adbf70046dec92309a9785da08d1acf4e9d.zip |
hush: fix for nested $()s with escapes + testsuite
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c index 735526a1d..77a305191 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -3498,6 +3498,13 @@ static void add_till_closing_curly_brace(o_string *dest, struct in_str *input) | |||
3498 | o_addqchr(dest, ch, 1); | 3498 | o_addqchr(dest, ch, 1); |
3499 | continue; | 3499 | continue; |
3500 | } | 3500 | } |
3501 | if (ch == '\\') { /* \x. Copy verbatim. Important for \(, \) */ | ||
3502 | ch = i_getch(input); | ||
3503 | if (ch == EOF) | ||
3504 | break; | ||
3505 | o_addqchr(dest, ch, 1); | ||
3506 | continue; | ||
3507 | } | ||
3501 | } | 3508 | } |
3502 | } | 3509 | } |
3503 | #endif /* ENABLE_HUSH_TICK */ | 3510 | #endif /* ENABLE_HUSH_TICK */ |
@@ -3556,13 +3563,16 @@ static int handle_dollar(o_string *dest, struct in_str *input) | |||
3556 | o_addchr(dest, SPECIAL_VAR_SYMBOL); | 3563 | o_addchr(dest, SPECIAL_VAR_SYMBOL); |
3557 | break; | 3564 | break; |
3558 | #if ENABLE_HUSH_TICK | 3565 | #if ENABLE_HUSH_TICK |
3559 | case '(': | 3566 | case '(': { |
3567 | //int pos = dest->length; | ||
3560 | i_getch(input); | 3568 | i_getch(input); |
3561 | o_addchr(dest, SPECIAL_VAR_SYMBOL); | 3569 | o_addchr(dest, SPECIAL_VAR_SYMBOL); |
3562 | o_addchr(dest, quote_mask | '`'); | 3570 | o_addchr(dest, quote_mask | '`'); |
3563 | add_till_closing_curly_brace(dest, input); | 3571 | add_till_closing_curly_brace(dest, input); |
3572 | //bb_error_msg("RES '%s'", dest->data + pos); | ||
3564 | o_addchr(dest, SPECIAL_VAR_SYMBOL); | 3573 | o_addchr(dest, SPECIAL_VAR_SYMBOL); |
3565 | break; | 3574 | break; |
3575 | } | ||
3566 | #endif | 3576 | #endif |
3567 | case '-': | 3577 | case '-': |
3568 | case '_': | 3578 | case '_': |