1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-07 23:51:14 +02:00

Partial sh emulation fixs for ${1+"$@"} and "${foo=$@}".

This commit is contained in:
Bart Schaefer 2001-02-16 08:43:46 +00:00
parent 12ef192f31
commit 04e1ef5b68
2 changed files with 23 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2001-02-16 Bart Schaefer <schaefer@brasslantern.com>
* 13492: Src/subst.c: Partial fix for ${1+"$@"} expanding to
an array (still doesn't handle shwordsplit properly); fix so
"${(A)foo=$@}" does *not* expand to an array, even though an
array is assigned to $foo.
2001-02-14 Clint Adams <schizo@debian.org>
* unposted: Src/params.c: remove unused variable declaration.

View file

@ -1379,7 +1379,14 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
case '-':
if (vunset) {
val = dupstring(s);
multsub(&val, NULL, &isarr, NULL);
/*
* This is not good enough for sh emulation! Sh would
* split unquoted substrings, yet not split quoted ones
* (except according to $@ rules); but this leaves the
* unquoted substrings unsplit, and other code below
* for spbreak splits even within the quoted substrings.
*/
multsub(&val, (aspar ? NULL : &aval), &isarr, NULL);
copied = 1;
}
break;
@ -1446,6 +1453,14 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
}
*idend = sav;
copied = 1;
if (isarr) {
if (nojoin)
isarr = -1;
if (qt && !getlen && isarr > 0) {
val = sepjoin(aval, sep, 1);
isarr = 0;
}
}
}
break;
case '?':