about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/compctl.c8
-rw-r--r--Src/Zle/zle_tricky.c9
-rw-r--r--Src/exec.c8
-rw-r--r--Src/glob.c10
-rw-r--r--Src/subst.c4
5 files changed, 22 insertions, 17 deletions
diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index f3673df52..dc9f46b0f 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -2219,7 +2219,7 @@ gen_matches_files(int dirs, int execs, int all)
 			    /* Do the globbing... */
 			    remnulargs(p);
 			    addlinknode(l, p);
-			    globlist(l);
+			    globlist(l, 0);
 			    /* And see if that produced a filename. */
 			    tt = nonempty(l);
 			    while (ugetnode(l));
@@ -3334,7 +3334,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 		tokenize(p);
 		remnulargs(p);
 		addlinknode(l, p);
-		globlist(l);
+		globlist(l, 0);
 
 		if (nonempty(l)) {
 		    /* And add the resulting words. */
@@ -3483,7 +3483,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 				/* Do the globbing. */
 				ng = opts[NULLGLOB];
 				opts[NULLGLOB] = 1;
-				globlist(l);
+				globlist(l, 0);
 				opts[NULLGLOB] = ng;
 				/* Get the results. */
 				if (nonempty(l) && peekfirst(l)) {
@@ -3679,7 +3679,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 	/* Fine, now do full expansion. */
 	prefork(foo, 0);
 	if (!errflag) {
-	    globlist(foo);
+	    globlist(foo, 0);
 	    if (!errflag)
 		/* And add the resulting words as matches. */
 		for (n = firstnode(foo); n; incnode(n))
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 6964c9c04..079611015 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1612,11 +1612,11 @@ doexpansion(char *s, int lst, int olst, int explincmd)
 	prefork(vl, 0);
 	if (errflag)
 	    goto end;
-	if ((lst == COMP_LIST_EXPAND) || (lst == COMP_EXPAND)) {
+	if (lst == COMP_LIST_EXPAND || lst == COMP_EXPAND) {
 	    int ng = opts[NULLGLOB];
 
 	    opts[NULLGLOB] = 1;
-	    globlist(vl);
+	    globlist(vl, 1);
 	    opts[NULLGLOB] = ng;
 	}
 	if (errflag)
@@ -1645,11 +1645,14 @@ doexpansion(char *s, int lst, int olst, int explincmd)
 	foredel(we - wb);
 	while ((ss = (char *)ugetnode(vl))) {
 	    ret = 0;
-	    untokenize(ss);
 	    ss = quotename(ss, NULL);
+	    untokenize(ss);
 	    inststr(ss);
+#if 0
 	    if (olst != COMP_EXPAND_COMPLETE || nonempty(vl) ||
 		(cs && line[cs-1] != '/')) {
+#endif
+	    if (nonempty(vl)) {
 		spaceinline(1);
 		line[cs++] = ' ';
 	    }
diff --git a/Src/exec.c b/Src/exec.c
index cfcc9b9d8..5e530ae9a 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1419,7 +1419,7 @@ addvars(Estate state, Wordcode pc, int export)
 		return;
 	    }
 	    if (isset(GLOBASSIGN) || !isstr)
-		globlist(vl);
+		globlist(vl, 0);
 	    if (errflag) {
 		state->pc = opc;
 		return;
@@ -1520,7 +1520,7 @@ execsubst(LinkList strs)
 	prefork(strs, esprefork);
 	if (esglob) {
 	    LinkList ostrs = strs;
-	    globlist(strs);
+	    globlist(strs, 0);
 	    strs = ostrs;
 	}
     }
@@ -1644,7 +1644,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 	    if (!(cflags & BINF_NOGLOB))
 		while (!checked && !errflag && args && nonempty(args) &&
 		       has_token((char *) peekfirst(args)))
-		    glob(args, firstnode(args));
+		    glob(args, firstnode(args), 0);
 	    else if (!unglobbed) {
 		for (node = firstnode(args); node; incnode(node))
 		    untokenize((char *) getdata(node));
@@ -1927,7 +1927,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 
     if ((esglob = !(cflags & BINF_NOGLOB)) && args) {
 	LinkList oargs = args;
-	globlist(args);
+	globlist(args, 0);
 	args = oargs;
     }
     if (errflag) {
diff --git a/Src/glob.c b/Src/glob.c
index f7c67a00f..15fa446ee 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -872,7 +872,7 @@ gmatchcmp(Gmatch a, Gmatch b)
 
 /**/
 void
-glob(LinkList list, LinkNode np)
+glob(LinkList list, LinkNode np, int nountok)
 {
     struct qual *qo, *qn, *ql;
     LinkNode node = prevnode(np);
@@ -887,7 +887,8 @@ glob(LinkList list, LinkNode np)
 
     MUSTUSEHEAP("glob");
     if (unset(GLOBOPT) || !haswilds(ostr)) {
-	untokenize(ostr);
+	if (!nountok)
+	    untokenize(ostr);
 	return;
     }
     save_globstate(saved);
@@ -1339,7 +1340,8 @@ glob(LinkList list, LinkNode np)
     if (!q || errflag) {	/* if parsing failed */
 	restore_globstate(saved);
 	if (unset(BADPATTERN)) {
-	    untokenize(ostr);
+	    if (!nountok)
+		untokenize(ostr);
 	    insertlinknode(list, node, ostr);
 	    return;
 	}
@@ -1578,7 +1580,7 @@ xpandredir(struct redir *fn, LinkList tab)
     prefork(fake, isset(MULTIOS) ? 0 : PF_SINGLE);
     /* Globbing is only done for multios. */
     if (!errflag && isset(MULTIOS))
-	globlist(fake);
+	globlist(fake, 0);
     if (errflag)
 	return 0;
     if (nonempty(fake) && !nextnode(firstnode(fake))) {
diff --git a/Src/subst.c b/Src/subst.c
index 711ec167a..f92fd7d32 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -212,14 +212,14 @@ stringsubst(LinkList list, LinkNode node, int ssub)
 
 /**/
 mod_export void
-globlist(LinkList list)
+globlist(LinkList list, int nountok)
 {
     LinkNode node, next;
 
     badcshglob = 0;
     for (node = firstnode(list); !errflag && node; node = next) {
 	next = nextnode(node);
-	glob(list, node);
+	glob(list, node, nountok);
     }
     if (badcshglob == 1)
 	zerr("no match", NULL, 0);