about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2002-01-27 18:19:17 +0000
committerBart Schaefer <barts@users.sourceforge.net>2002-01-27 18:19:17 +0000
commitf40c3dc74a31eb5cbf73a5c4878f28c08d843efa (patch)
tree64b603d269ef3217146c25c334e062b5386638e7 /Src
parentf3eaa04740857b9771c6e1ca3f4e86e6696b461e (diff)
downloadzsh-f40c3dc74a31eb5cbf73a5c4878f28c08d843efa.tar.gz
zsh-f40c3dc74a31eb5cbf73a5c4878f28c08d843efa.tar.xz
zsh-f40c3dc74a31eb5cbf73a5c4878f28c08d843efa.zip
16400, 16401: preserve empty words that result from brace expansion.
Diffstat (limited to 'Src')
-rw-r--r--Src/subst.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/Src/subst.c b/Src/subst.c
index 2e1c05849..3533c1417 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -49,8 +49,8 @@ char nulstring[] = {Nularg, '\0'};
 mod_export void
 prefork(LinkList list, int flags)
 {
-    LinkNode node;
-    int asssub = (flags & PF_TYPESET) && isset(KSHTYPESET);
+    LinkNode node, stop = 0;
+    int keep = 0, asssub = (flags & PF_TYPESET) && isset(KSHTYPESET);
 
     queue_signals();
     for (node = firstnode(list); node; incnode(node)) {
@@ -78,15 +78,22 @@ prefork(LinkList list, int flags)
 	}
     }
     for (node = firstnode(list); node; incnode(node)) {
+	if (node == stop)
+	    keep = 0;
 	if (*(char *)getdata(node)) {
 	    remnulargs(getdata(node));
-	    if (unset(IGNOREBRACES) && !(flags & PF_SINGLE))
-		while (hasbraces(getdata(node)))
+	    if (unset(IGNOREBRACES) && !(flags & PF_SINGLE)) {
+		if (!keep)
+		    stop = nextnode(node);
+		while (hasbraces(getdata(node))) {
+		    keep = 1;
 		    xpandbraces(list, &node);
+		}
+	    }
 	    if (unset(SHFILEEXPANSION))
 		filesub((char **)getaddrdata(node),
 			flags & (PF_TYPESET|PF_ASSIGN));
-	} else if (!(flags & PF_SINGLE))
+	} else if (!(flags & PF_SINGLE) && !keep)
 	    uremnode(list, node);
 	if (errflag) {
 	    unqueue_signals();