zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: ls $PWD/<TAB>
Date: Tue, 29 Feb 2000 17:02:17 +0100 (MET)	[thread overview]
Message-ID: <200002291602.RAA21423@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Tanaka Akira's message of 01 Mar 2000 00:02:13 +0900


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


             reply	other threads:[~2000-02-29 16:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-29 16:02 Sven Wischnowsky [this message]
2000-03-01  4:04 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2000-02-29 15:02 Tanaka Akira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200002291602.RAA21423@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).