+1998-07-22 23:47 Ulrich Drepper <drepper@cygnus.com>
+
+ * posix/fnmatch.c: Fix completely broken range matching.
+
1998-07-22 23:19 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/bits/siginfo.h: Fix typo.
# include <strings.h>
#endif
-#ifdef STDC_HEADERS
+#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
#endif
/* Nonzero if the sense of the character class is inverted. */
static int posixly_correct;
register int not;
+ char cold;
if (posixly_correct == 0)
posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;
if (c == fn)
goto matched;
}
+ else if ((flags & FNM_FILE_NAME) && c == '/')
+ /* [/] can never match. */
+ return FNM_NOMATCH;
else if (c == '[' && *p == ':')
{
/* Leave room for the null. */
else if (FOLD (c) == fn)
goto matched;
+ cold = c;
c = *p++;
+ if (c == '-' && *p != ']')
+ {
+ /* It is a range. */
+ char cend = *p++;
+ if (!(flags & FNM_NOESCAPE) && cend == '\\')
+ cend = *p++;
+ if (cend == '\0')
+ return FNM_NOMATCH;
+
+ if (cold <= fn && fn <= FOLD (cend))
+ goto matched;
+
+ c = *p++;
+ }
if (c == ']')
break;
}