about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-06 09:03:35 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-06 09:03:35 +0000
commite2409e0649ac61e938624ba349988f58f873bf54 (patch)
treee99b837be4afc237f3275c74ae3001172e3abfd8
parent2f9d4a9e4602e822c0b29877bf14c8ec07b75ee8 (diff)
downloadzsh-e2409e0649ac61e938624ba349988f58f873bf54.tar.gz
zsh-e2409e0649ac61e938624ba349988f58f873bf54.tar.xz
zsh-e2409e0649ac61e938624ba349988f58f873bf54.zip
zsh-workers/7649
-rw-r--r--Src/pattern.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/Src/pattern.c b/Src/pattern.c
index 975ecc888..832d8fda0 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -427,7 +427,7 @@ patcompswitch(int paren, int *flagp)
 #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 @@ patcompswitch(int paren, int *flagp)
 	    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 @@ patcompswitch(int paren, int *flagp)
 	    }
 	}
 	newbr = patcompbranch(&flags);
-	patflags = savflags;
+	if (tilde == 2) {
+	    /* restore special treatment of / */
+	    patendseg--;
+	    patendseglen++;
+	    patendstr--;
+	    patendstrlen++;
+	}
 	if (!newbr)
 	    return 0;
 	if (gfnode)