mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-09 10:01:16 +02:00
Made ${(A)=name:=word} (which is an array assignment) not split on
quoted whitespace, just like the new ${1+"$@"} handling.
This commit is contained in:
parent
0dd130df0d
commit
803fa9872f
1 changed files with 10 additions and 14 deletions
24
Src/subst.c
24
Src/subst.c
|
@ -2070,27 +2070,23 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
|
||||||
case '=':
|
case '=':
|
||||||
case Equals:
|
case Equals:
|
||||||
if (vunset) {
|
if (vunset) {
|
||||||
|
int ws = opts[SHWORDSPLIT];
|
||||||
char sav = *idend;
|
char sav = *idend;
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
*idend = '\0';
|
*idend = '\0';
|
||||||
val = dupstring(s);
|
val = dupstring(s);
|
||||||
/*
|
if (spsep || !arrasg) {
|
||||||
* TODO: this is one of those places where I don't
|
opts[SHWORDSPLIT] = 0;
|
||||||
* think we want to do the joining until later on.
|
|
||||||
* We also need to handle spbreak and spsep at this
|
|
||||||
* point and unset them.
|
|
||||||
*/
|
|
||||||
if (spsep || spbreak || !arrasg)
|
|
||||||
multsub(&val, 0, NULL, &isarr, NULL);
|
multsub(&val, 0, NULL, &isarr, NULL);
|
||||||
else
|
} else {
|
||||||
multsub(&val, 0, &aval, &isarr, NULL);
|
opts[SHWORDSPLIT] = spbreak;
|
||||||
|
multsub(&val, spbreak, &aval, &isarr, NULL);
|
||||||
|
spbreak = 0;
|
||||||
|
}
|
||||||
|
opts[SHWORDSPLIT] = ws;
|
||||||
if (arrasg) {
|
if (arrasg) {
|
||||||
/*
|
/* This is an array assignment. */
|
||||||
* This is an array assignment in a context
|
|
||||||
* where we have no syntactic way of finding
|
|
||||||
* out what an array element is. So we just guess.
|
|
||||||
*/
|
|
||||||
char *arr[2], **t, **a, **p;
|
char *arr[2], **t, **a, **p;
|
||||||
if (spsep || spbreak) {
|
if (spsep || spbreak) {
|
||||||
aval = sepsplit(val, spsep, 0, 1);
|
aval = sepsplit(val, spsep, 0, 1);
|
||||||
|
|
Loading…
Reference in a new issue