mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-23 04:30:24 +02:00
users/17046: don't count too many elements when splitting quoted parameter
substitution on null parameter
This commit is contained in:
parent
8da652f6ae
commit
cd1b5d86e0
3 changed files with 23 additions and 3 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue