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>
This commit is contained in:
40
shell/ash_test/ash-vars/var_subst_in_for.tests
Executable file
40
shell/ash_test/ash-vars/var_subst_in_for.tests
Executable file
@@ -0,0 +1,40 @@
|
||||
if test $# = 0; then
|
||||
exec "$THIS_SH" "$0" abc "d e"
|
||||
fi
|
||||
|
||||
echo 'Testing: in x y z'
|
||||
for a in x y z; do echo ".$a."; done
|
||||
|
||||
echo 'Testing: in u $empty v'
|
||||
empty=''
|
||||
for a in u $empty v; do echo ".$a."; done
|
||||
|
||||
echo 'Testing: in u " $empty" v'
|
||||
empty=''
|
||||
for a in u " $empty" v; do echo ".$a."; done
|
||||
|
||||
echo 'Testing: in u $empty $empty$a v'
|
||||
a='a'
|
||||
for a in u $empty $empty$a v; do echo ".$a."; done
|
||||
|
||||
echo 'Testing: in $a_b'
|
||||
a_b='a b'
|
||||
for a in $a_b; do echo ".$a."; done
|
||||
|
||||
echo 'Testing: in $*'
|
||||
for a in $*; do echo ".$a."; done
|
||||
|
||||
echo 'Testing: in $@'
|
||||
for a in $@; do echo ".$a."; done
|
||||
|
||||
echo 'Testing: in -$*-'
|
||||
for a in -$*-; do echo ".$a."; done
|
||||
|
||||
echo 'Testing: in -$@-'
|
||||
for a in -$@-; do echo ".$a."; done
|
||||
|
||||
echo 'Testing: in $a_b -$a_b-'
|
||||
a_b='a b'
|
||||
for a in $a_b -$a_b-; do echo ".$a."; done
|
||||
|
||||
echo Finished
|
Reference in New Issue
Block a user