diff options
Diffstat (limited to 'sys/libkern')
-rw-r--r-- | sys/libkern/fnmatch.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/libkern/fnmatch.c b/sys/libkern/fnmatch.c index 542a528..c3312b4 100644 --- a/sys/libkern/fnmatch.c +++ b/sys/libkern/fnmatch.c @@ -170,11 +170,9 @@ rangematch(pattern, test, flags, newp) int flags; char **newp; { - int negate, ok, first; + int negate, ok; char c, c2; - first = 1; - /* * A bracket expression starting with an unquoted circumflex * character produces unspecified results (IEEE 1003.2-1992, @@ -193,8 +191,9 @@ rangematch(pattern, test, flags, newp) * itself in a bracket expression if it occurs first in the list. * -- POSIX.2 2.8.3.2 */ - for (ok = 0, c = *pattern++; c != ']' || first; c = *pattern++) { - first = 0; + ok = 0; + c = *pattern++; + do { if (c == '\\' && !(flags & FNM_NOESCAPE)) c = *pattern++; if (c == EOS) @@ -225,7 +224,8 @@ rangematch(pattern, test, flags, newp) ok = 1; } else if (c == test) ok = 1; - } + } while ((c = *pattern++) != ']'); + *newp = (char *)pattern; return (ok == negate ? RANGE_NOMATCH : RANGE_MATCH); } |