users/17046: don't count too many elements when splitting quoted parameter

substitution on null parameter
interrupt_abort
Peter Stephenson 12 years ago
parent 8da652f6ae
commit cd1b5d86e0

@ -1,3 +1,9 @@
2012-05-01 Peter Stephenson <p.w.stephenson@ntlworld.com>
* users/17046: Src/utils.c, Test/D04parameter.ztst: don't
count too many elements when splitting quoted parameter
substitution on null separator.
2012-05-01 Mikael Magnusson <mikachu@gmail.com>
* 30456: Completion/Unix/Command/_getconf: Use new array syntax.
@ -16254,5 +16260,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.5644 $
* $Revision: 1.5645 $
*****************************************************

@ -3114,7 +3114,7 @@ wordcount(char *s, char *sep, int mul)
r = 1;
sl = strlen(sep);
for (; (c = findsep(&s, sep, 0)) >= 0; s += sl)
if ((c && *(s + sl)) || mul)
if ((c || mul) && (sl || *(s + sl)))
r++;
} else {
char *t = s;

@ -1292,7 +1292,7 @@
>in
>it
foo="line:with::missing::fields:in:it"
foo="line:with::missing::fields:in:it:"
print -l "${(@s.:.)foo}"
0:Retention of empty fields in quoted splitting with "@"
>line
@ -1303,6 +1303,20 @@
>fields
>in
>it
>
str=abcd
print -l ${(s..)str}
print -l "${(s..)str}"
0:splitting of strings into characters
>a
>b
>c
>d
>a
>b
>c
>d
array=('%' '$' 'j' '*' '$foo')
print ${array[(i)*]} "${array[(i)*]}"

Loading…
Cancel
Save