summaryrefslogtreecommitdiff
path: root/Src/pattern.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/pattern.c')
-rw-r--r--Src/pattern.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/Src/pattern.c b/Src/pattern.c
index 04452187d..528c48d5e 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -399,7 +399,7 @@ patcompile(char *exp, int inflags, char **endexp)
patendstr++;
patendseglen--;
patendstrlen--;
- remnulargs(exp);
+ remnulargs(patparse);
patglobflags = 0;
}
/*
@@ -419,10 +419,20 @@ patcompile(char *exp, int inflags, char **endexp)
|| (!(patglobflags & ~GF_IGNCASE) && (patflags & PAT_FILE))
#endif
)
+ {
+ /*
+ * Waah! I wish I understood this.
+ * Empty metafied strings have an initial Nularg.
+ * This never corresponds to a real character in
+ * a glob pattern or string, so skip it.
+ */
+ if (*exp == Nularg)
+ exp++;
for (strp = exp; *strp &&
(!(patflags & PAT_FILE) || *strp != '/') && !itok(*strp);
strp++)
;
+ }
if (!strp || (*strp && *strp != '/')) {
/* No, do normal compilation. */
strp = NULL;
@@ -1010,6 +1020,9 @@ patcomppiece(int *flagp)
/* Get length of string without metafication. */
nmeta = 0;
+ /* inherited from domatch, but why, exactly? */
+ if (*str0 == Nularg)
+ str0++;
for (ptr = str0; ptr < patparse; ptr++) {
if (*ptr == Meta) {
nmeta++;