Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions match.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ extern bool match(char *p, char *m, char *s) {
continue;
}
break;
case '[': {
int r = 1 + rangematch(p+1, *s);
if (r > 0) {
p += r, m += r, s++;
continue;
case '[':
if (*s) {
int r = 1 + rangematch(p+1, *s);
if (r > 0) {
p += r, m += r, s++;
continue;
}
}
break;
}
case '*':
next.p = p++;
next.m = m++;
Expand All @@ -42,7 +43,6 @@ extern bool match(char *p, char *m, char *s) {
default:
panic("bad metacharacter in match");
/* NOTREACHED */
return FALSE; /* hush up gcc -Wall */
}
}
if (next.s != NULL) {
Expand Down
4 changes: 4 additions & 0 deletions trip.rc
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ if (~ x [y])
fail rangematch out of range
if (~ x x?)
fail too many characters in pattern
if (~ . .[~.])
fail matched nul terminator
if (~ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab a*a*a*a*a*a*a*a)
fail this should finish in linear time

sh -c 'test -f /////$tmpdir//////a?c.'^$pid || fail glob with many slashes
if (!~ /////$tmpdir//////a*.$pid /////$tmpdir//////a?c.$pid)
Expand Down