about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-05-01 09:29:35 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-05-01 09:29:35 +0000
commit19dccc355a3a6316a60abdb739bbec7f9ce9a362 (patch)
tree178e53164ba45e0a7d66ff4a3479d22483a92e4b /Src
parent5f13656d7f8529fa8989aef2351fef9e7f43857d (diff)
downloadzsh-19dccc355a3a6316a60abdb739bbec7f9ce9a362.tar.gz
zsh-19dccc355a3a6316a60abdb739bbec7f9ce9a362.tar.xz
zsh-19dccc355a3a6316a60abdb739bbec7f9ce9a362.zip
23363: fake-files now allows patterns
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/computil.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index f9c55296c..dbbaa61e2 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -4247,14 +4247,20 @@ cfp_add_sdirs(LinkList final, LinkList orig, char *skipped,
 	char *m, *f, *p, *t, *a, c;
 	int sl = strlen(skipped) + 1;
 	struct stat st1, st2;
+	Patprog pprog;
 
 	for (; (f = *fake); fake++) {
 	    f = dupstring(f);
 	    for (p = t = f; *p; p++) {
 		if (*p == ':')
 		    break;
-		else if (*p == '\\' && p[1])
+		else if (*p == '\\' && p[1] == ':') {
+		    /*
+		     * strip quoted colons here; rely
+		     * on tokenization to strip other backslashes
+		     */
 		    p++;
+		}
 		*t++ = *p;
 	    }
 	    if (*p) {
@@ -4262,9 +4268,12 @@ cfp_add_sdirs(LinkList final, LinkList orig, char *skipped,
 		if (!*p)
 		    continue;
 
+		tokenize(f);
+		pprog = patcompile(f, PAT_STATIC, NULL);
+		untokenize(f);
 		for (node = firstnode(orig); node; incnode(node)) {
 		    if ((m = (char *) getdata(node)) &&
-			(!strcmp(f, m) ||
+			((pprog ? pattry(pprog, m) : !strcmp(f, m)) ||
 			 (!stat(f, &st1) && !stat((*m ? m : "."), &st2) &&
 			  st1.st_dev == st2.st_dev &&
 			  st1.st_ino == st2.st_ino))) {