mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-26 05:51:08 +02:00
30439: ${...:*...} with nonexistent or non-array after *
should return no results
This commit is contained in:
parent
5eb53bf88d
commit
cb4ff5e970
3 changed files with 24 additions and 2 deletions
|
@ -1,7 +1,11 @@
|
|||
2012-04-22 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* Test/D04parameter.ztst: 30439: Src/subst.c,
|
||||
Test/D04parameter.ztst: ${...:*...} with nonexistent or
|
||||
non-array variable second should return no results.
|
||||
|
||||
* 30431 (typo in _typeset fixed):
|
||||
Completion/Zsh/Command/_typeset, Doc/Zsh/expn.yo, ASrc/params.c,
|
||||
Completion/Zsh/Command/_typeset, Doc/Zsh/expn.yo, Src/params.c,
|
||||
Src/subst.c, Test/D04parameter.ztst: add ${...:|...} and
|
||||
${...:*...} operators for removal or inclusion of results
|
||||
by array element.
|
||||
|
@ -16231,5 +16235,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.5637 $
|
||||
* $Revision: 1.5638 $
|
||||
*****************************************************
|
||||
|
|
13
Src/subst.c
13
Src/subst.c
|
@ -2918,6 +2918,19 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags)
|
|||
}
|
||||
}
|
||||
deletehashtable(ht);
|
||||
} else if (intersect) {
|
||||
/*
|
||||
* The intersection with nothing is nothing...
|
||||
* Seems a bit pointless complaining that the first
|
||||
* expression is unset here if the second is, too.
|
||||
*/
|
||||
if (!vunset) {
|
||||
if (isarr) {
|
||||
aval = mkarray(NULL);
|
||||
} else {
|
||||
val = dupstring("");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else { /* no ${...=...} or anything, but possible modifiers. */
|
||||
/*
|
||||
|
|
|
@ -182,6 +182,9 @@
|
|||
scalar='two words'
|
||||
print ${scalar:|mod}
|
||||
print ${scalar:*mod}
|
||||
print ${args:*nonexistent}
|
||||
empty=
|
||||
print ${args:*empty}
|
||||
0:"|" array exclusion and "*" array intersection
|
||||
>one two
|
||||
>#foo (bar 'three'
|
||||
|
@ -191,6 +194,8 @@
|
|||
>two words
|
||||
>
|
||||
>two words
|
||||
>
|
||||
>
|
||||
|
||||
str1='twocubed'
|
||||
array=(the number of protons in an oxygen nucleus)
|
||||
|
|
Loading…
Reference in a new issue