diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-09-29 16:59:06 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-09-29 16:59:06 +0200 |
commit | 8286513838beaf9ccaab15bb5905248c3b7b8a69 (patch) | |
tree | b7d72f0867668509260ea6b074c416702fb6fa2b /shell/hush_test/hush-vars | |
parent | 3b4d04b77eb5cfdb8ac6a799a3f3ccf1e455d0e7 (diff) | |
download | busybox-w32-8286513838beaf9ccaab15bb5905248c3b7b8a69.tar.gz busybox-w32-8286513838beaf9ccaab15bb5905248c3b7b8a69.tar.bz2 busybox-w32-8286513838beaf9ccaab15bb5905248c3b7b8a69.zip |
hush: rework input char buffering to allow more than one-deep peek
This fixes backslash+newline continuation in
$VAR\
NAME
construct. (ash has a bug there as well).
function old new delta
file_peek2 - 74 +74
parse_dollar 746 773 +27
expand_vars_to_list 1143 1167 +24
setup_string_in_str 32 46 +14
setup_file_in_str 33 47 +14
file_get 264 278 +14
static_peek2 - 7 +7
file_peek 91 72 -19
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 5/1 up/down: 174/-19) Total: 155 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test/hush-vars')
-rw-r--r-- | shell/hush_test/hush-vars/var_unbackslash1.right | 3 | ||||
-rwxr-xr-x | shell/hush_test/hush-vars/var_unbackslash1.tests | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/shell/hush_test/hush-vars/var_unbackslash1.right b/shell/hush_test/hush-vars/var_unbackslash1.right new file mode 100644 index 000000000..8d4eca34e --- /dev/null +++ b/shell/hush_test/hush-vars/var_unbackslash1.right | |||
@@ -0,0 +1,3 @@ | |||
1 | Ok | ||
2 | Ba d | ||
3 | Ok | ||
diff --git a/shell/hush_test/hush-vars/var_unbackslash1.tests b/shell/hush_test/hush-vars/var_unbackslash1.tests new file mode 100755 index 000000000..8a9f2e249 --- /dev/null +++ b/shell/hush_test/hush-vars/var_unbackslash1.tests | |||
@@ -0,0 +1,15 @@ | |||
1 | ad="Ok" | ||
2 | a="Ba" | ||
3 | |||
4 | # "Ok" | ||
5 | echo $a\ | ||
6 | d | ||
7 | |||
8 | # This variable contains backslash+newline! | ||
9 | e='echo $a\ | ||
10 | d' | ||
11 | |||
12 | # "Ba d" | ||
13 | eval $e | ||
14 | # "Ok" | ||
15 | eval "$e" | ||