zsh-workers
 help / color / mirror / code / Atom feed
* Re: ls $PWD/<TAB>
@ 2000-02-29 16:02 Sven Wischnowsky
  2000-03-01  4:04 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 2000-02-29 16:02 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> I found that filenames are not completed when a variable is used.
> 
> is27e1u11% bindkey -e; autoload -U compinit; compinit -D
> is27e1u11% ls $PWD/<TAB>
> 
> is27e1u11% a=.
> is27e1u11% ls $a/<TAB>
> 
> They copmletes nothing.

parse_subst_string() modified the value of a parameter if that wasn't
copied yet.

The hunk in strcatsub() is just a bit of cleanup... I first thought
the bug were there.

Bye
 Sven

--- ../z.old/Src/subst.c	Tue Feb 29 13:11:04 2000
+++ Src/subst.c	Tue Feb 29 16:59:08 2000
@@ -428,7 +428,7 @@
     int pl = pe - pb;
 
     if (!pl && (!s || !*s)) {
-	dest = (*d = (copied ? src : dupstring(src)));
+	*d = dest = (copied ? src : dupstring(src));
 	if (glbsub)
 	    tokenize(dest);
     } else {
@@ -701,9 +701,13 @@
 
 /* Parsing for the (e) flag. */
 
-static int
-subst_parse_str(char *s, int single)
+static char *
+subst_parse_str(char **sp, int single)
 {
+    char *s;
+
+    *sp = s = dupstring(*sp);
+
     if (!parsestr(s)) {
 	if (!single) {
 	    for (; *s; s++)
@@ -1788,7 +1792,7 @@
 		if (prenum || postnum)
 		    x = dopadding(x, prenum, postnum, preone, postone,
 				  premul, postmul);
-		if (eval && subst_parse_str(x, (qt && !nojoin)))
+		if (eval && subst_parse_str(&x, (qt && !nojoin)))
 		    return NULL;
 		xlen = strlen(x);
 		for (tn = firstnode(&tl);
@@ -1824,7 +1828,7 @@
 	    if (prenum || postnum)
 		x = dopadding(x, prenum, postnum, preone, postone,
 			      premul, postmul);
-	    if (eval && subst_parse_str(x, (qt && !nojoin)))
+	    if (eval && subst_parse_str(&x, (qt && !nojoin)))
 		return NULL;
 	    xlen = strlen(x);
 	    strcatsub(&y, ostr, aptr, x, xlen, NULL, globsubst, copied);
@@ -1839,7 +1843,7 @@
 		if (prenum || postnum)
 		    x = dopadding(x, prenum, postnum, preone, postone,
 				  premul, postmul);
-		if (eval && subst_parse_str(x, (qt && !nojoin)))
+		if (eval && subst_parse_str(&x, (qt && !nojoin)))
 		    return NULL;
 		if (qt && !*x && isarr != 2)
 		    y = dupstring(nulstring);
@@ -1855,7 +1859,7 @@
 	    if (prenum || postnum)
 		x = dopadding(x, prenum, postnum, preone, postone,
 			      premul, postmul);
-	    if (eval && subst_parse_str(x, (qt && !nojoin)))
+	    if (eval && subst_parse_str(&x, (qt && !nojoin)))
 		return NULL;
 	    xlen = strlen(x);
 	    *str = strcatsub(&y, aptr, aptr, x, xlen, fstr, globsubst, copied);
@@ -1874,7 +1878,7 @@
 	if (prenum || postnum)
 	    x = dopadding(x, prenum, postnum, preone, postone,
 			  premul, postmul);
-	if (eval && subst_parse_str(x, (qt && !nojoin)))
+	if (eval && subst_parse_str(&x, (qt && !nojoin)))
 	    return NULL;
 	xlen = strlen(x);
 	*str = strcatsub(&y, ostr, aptr, x, xlen, fstr, globsubst, copied);

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ls $PWD/<TAB>
  2000-02-29 16:02 ls $PWD/<TAB> Sven Wischnowsky
@ 2000-03-01  4:04 ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2000-03-01  4:04 UTC (permalink / raw)
  To: zsh-workers

On Feb 29,  5:02pm, Sven Wischnowsky wrote:
} Subject: Re: ls $PWD/<TAB>
}
} -static int
} -subst_parse_str(char *s, int single)
} +static char *
} +subst_parse_str(char **sp, int single)

This doesn't return (char *), it still returns 0 or 1.

Index: Src/subst.c
===================================================================
@@ -701,7 +701,7 @@
 
 /* Parsing for the (e) flag. */
 
-static char *
+static int
 subst_parse_str(char **sp, int single)
 {
     char *s;

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* ls $PWD/<TAB>
@ 2000-02-29 15:02 Tanaka Akira
  0 siblings, 0 replies; 3+ messages in thread
From: Tanaka Akira @ 2000-02-29 15:02 UTC (permalink / raw)
  To: zsh-workers

I found that filenames are not completed when a variable is used.

is27e1u11% bindkey -e; autoload -U compinit; compinit -D
is27e1u11% ls $PWD/<TAB>

is27e1u11% a=.
is27e1u11% ls $a/<TAB>

They copmletes nothing.
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-03-01  4:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-29 16:02 ls $PWD/<TAB> Sven Wischnowsky
2000-03-01  4:04 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2000-02-29 15:02 Tanaka Akira

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).