From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10928 invoked from network); 29 Feb 2000 16:02:29 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 29 Feb 2000 16:02:29 -0000 Received: (qmail 17196 invoked by alias); 29 Feb 2000 16:02:23 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9937 Received: (qmail 17187 invoked from network); 29 Feb 2000 16:02:23 -0000 Date: Tue, 29 Feb 2000 17:02:17 +0100 (MET) Message-Id: <200002291602.RAA21423@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Tanaka Akira's message of 01 Mar 2000 00:02:13 +0900 Subject: Re: ls $PWD/ 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/ > > is27e1u11% a=. > is27e1u11% ls $a/ > > 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