diff options
author | Denys Vlasenko | 2016-09-29 16:59:06 +0200 |
---|---|---|
committer | Denys Vlasenko | 2016-09-29 16:59:06 +0200 |
commit | 8286513838beaf9ccaab15bb5905248c3b7b8a69 (patch) | |
tree | b7d72f0867668509260ea6b074c416702fb6fa2b /shell/ash_test/ash-vars/var_unbackslash.tests | |
parent | 3b4d04b77eb5cfdb8ac6a799a3f3ccf1e455d0e7 (diff) | |
download | busybox-8286513838beaf9ccaab15bb5905248c3b7b8a69.zip busybox-8286513838beaf9ccaab15bb5905248c3b7b8a69.tar.gz |
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/ash_test/ash-vars/var_unbackslash.tests')
-rwxr-xr-x | shell/ash_test/ash-vars/var_unbackslash.tests | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/shell/ash_test/ash-vars/var_unbackslash.tests b/shell/ash_test/ash-vars/var_unbackslash.tests new file mode 100755 index 0000000..bb52af3 --- /dev/null +++ b/shell/ash_test/ash-vars/var_unbackslash.tests @@ -0,0 +1,23 @@ +# Test for correct handling of backslashes +a=qwerty + +b=-$a-\t-\\-\"-\`-\--\z-\*-\?- +echo b1=$b +echo "b1=$b" +b="-$a-\t-\\-\"-\`-\--\z-\*-\?-" +echo b2=$b +echo "b2=$b" +b='-$a-\t-\\-\"-\`-\--\z-\*-\?-' +echo b3=$b +echo "b3=$b" + +c=$b +echo "c=$c" +c=${b} +echo "c=$c" +c="$b" +echo "c=$c" +c="${b}" +echo "c=$c" + +echo "Done: $?" |