summaryrefslogtreecommitdiff
path: root/shell/hush.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-06-12 12:58:20 +0000
committerDenis Vlasenko2008-06-12 12:58:20 +0000
commit76db5adbf70046dec92309a9785da08d1acf4e9d (patch)
tree17af552a8734448ca55f501e3df8e3e2ac018e00 /shell/hush.c
parentbd1aeeb850e441e3fa4f9e1f8aedd804a48b9cb1 (diff)
downloadbusybox-76db5adbf70046dec92309a9785da08d1acf4e9d.zip
busybox-76db5adbf70046dec92309a9785da08d1acf4e9d.tar.gz
hush: fix for nested $()s with escapes + testsuite
Diffstat (limited to 'shell/hush.c')
-rw-r--r--shell/hush.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 735526a..77a3051 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)
o_addqchr(dest, ch, 1);
continue;
}
+ if (ch == '\\') { /* \x. Copy verbatim. Important for \(, \) */
+ ch = i_getch(input);
+ if (ch == EOF)
+ break;
+ o_addqchr(dest, ch, 1);
+ continue;
+ }
}
}
#endif /* ENABLE_HUSH_TICK */
@@ -3556,13 +3563,16 @@ static int handle_dollar(o_string *dest, struct in_str *input)
o_addchr(dest, SPECIAL_VAR_SYMBOL);
break;
#if ENABLE_HUSH_TICK
- case '(':
+ case '(': {
+ //int pos = dest->length;
i_getch(input);
o_addchr(dest, SPECIAL_VAR_SYMBOL);
o_addchr(dest, quote_mask | '`');
add_till_closing_curly_brace(dest, input);
+ //bb_error_msg("RES '%s'", dest->data + pos);
o_addchr(dest, SPECIAL_VAR_SYMBOL);
break;
+ }
#endif
case '-':
case '_':