Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Another globbing problem



Tanaka Akira wrote:
> is27e1u11% echo ./*~./ChangeLog
> zsh: no matches found: ./*~./ChangeLog
> 
> This should be:
> 
> is27e1u11% echo ./*~./ChangeLog
> ./CVS ./ChangeLog.3.0 ./Completion ./Config ./Doc ./Etc ./Functions ./INSTALL
>  ./META-FAQ ./Makefile ./Makefile.in ./Misc ./README ./Src ./StartupFiles ./U
> til ./acconfig.h ./aclocal.m4 ./aczsh.m4 ./config.cache ./config.guess ./conf
> ig.h ./config.h.in ./config.log ./config.status ./config.sub ./configure ./co
> nfigure.in ./install-sh ./mkinstalldirs ./stamp-h ./stamp-h.in ./status

I forgot to update the special case for a top-level ~ in globbing to
use the end character arrays.

--- Src/pattern.c~	Thu Sep  2 10:22:55 1999
+++ Src/pattern.c	Mon Sep  6 09:26:06 1999
@@ -427,7 +427,7 @@
 #ifdef BACKREFERENCES
     int parno = 0;
 #endif
-    int flags, gfchanged = 0, savflags = patflags, savglobflags = patglobflags;
+    int flags, gfchanged = 0, savglobflags = patglobflags;
     Upat ptr;
 
     *flagp = 0;
@@ -491,8 +491,13 @@
 	    up.p = NULL;
 	    patadd((char *)&up, 0, sizeof(up), 0);
 	    /* / is not treated as special if we are at top level */
-	    if (!paren)
-		patflags &= ~PAT_FILE;
+	    if (!paren && *patendseg == '/') {
+		tilde++;
+		patendseg++;
+		patendseglen--;
+		patendstr++;
+		patendstrlen--;
+	    }
 	} else {
 	    excsync = 0;
 	    br = patnode(P_BRANCH);
@@ -529,7 +534,13 @@
 	    }
 	}
 	newbr = patcompbranch(&flags);
-	patflags = savflags;
+	if (tilde == 2) {
+	    /* restore special treatment of / */
+	    patendseg--;
+	    patendseglen++;
+	    patendstr--;
+	    patendstrlen++;
+	}
 	if (!newbr)
 	    return 0;
 	if (gfnode)

-- 
Peter Stephenson <pws@xxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56100 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author