about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2006-02-16 19:51:48 +0000
committerWayne Davison <wayned@users.sourceforge.net>2006-02-16 19:51:48 +0000
commit803fa9872f49f35cecd44ee7b60b150eb9e22327 (patch)
treee028cbda4f0c78de2d7774ff693487e8de3dcf6a
parent0dd130df0dbfe1887765b986ab5b98708ea5a47b (diff)
downloadzsh-803fa9872f49f35cecd44ee7b60b150eb9e22327.tar.gz
zsh-803fa9872f49f35cecd44ee7b60b150eb9e22327.tar.xz
zsh-803fa9872f49f35cecd44ee7b60b150eb9e22327.zip
Made ${(A)=name:=word} (which is an array assignment) not split on
quoted whitespace, just like the new ${1+"$@"} handling.
-rw-r--r--Src/subst.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/Src/subst.c b/Src/subst.c
index 0b04d19ed..e6e6cba5b 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2070,27 +2070,23 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 	case '=':
 	case Equals:
 	    if (vunset) {
+		int ws = opts[SHWORDSPLIT];
 		char sav = *idend;
 		int l;
 
 		*idend = '\0';
 		val = dupstring(s);
-		/*
-		 * TODO: this is one of those places where I don't
-		 * 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)
+		if (spsep || !arrasg) {
+		    opts[SHWORDSPLIT] = 0;
 		    multsub(&val, 0, NULL, &isarr, NULL);
-		else
-		    multsub(&val, 0, &aval, &isarr, NULL);
+		} else {
+		    opts[SHWORDSPLIT] = spbreak;
+		    multsub(&val, spbreak, &aval, &isarr, NULL);
+		    spbreak = 0;
+		}
+		opts[SHWORDSPLIT] = ws;
 		if (arrasg) {
-		    /*
-		     * 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.
-		     */
+		    /* This is an array assignment. */
 		    char *arr[2], **t, **a, **p;
 		    if (spsep || spbreak) {
 			aval = sepsplit(val, spsep, 0, 1);