]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(internal_fnmatch): When matching [A-Z] and folding case, lower-case A too.
authorUlrich Drepper <drepper@redhat.com>
Wed, 26 Jan 2000 02:23:30 +0000 (02:23 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 26 Jan 2000 02:23:30 +0000 (02:23 +0000)
(internal_fnmatch): Use locale's collating sequence when deciding whether a
character falls within a character range.

posix/fnmatch.c

index 9617d336f43c6439579ceecb023f536e6c1f0253..dc4021ef0de5bf60147b06b381a87d996fd132f0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 96, 97, 98, 99 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993, 1996-1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This library is free software; you can redistribute it and/or
@@ -368,8 +368,9 @@ internal_fnmatch (const char *pattern, const char *string,
                  return FNM_NOMATCH;
                else
                  {
+                   c = FOLD (c);
                  normal_bracket:
-                   if (FOLD (c) == fn)
+                   if (c == fn)
                      goto matched;
 
                    cold = c;
@@ -378,14 +379,26 @@ internal_fnmatch (const char *pattern, const char *string,
                    if (c == '-' && *p != ']')
                      {
                        /* It is a range.  */
+                       char lo[2];
+                       char fc[2];
                        unsigned char cend = *p++;
                        if (!(flags & FNM_NOESCAPE) && cend == '\\')
                          cend = *p++;
                        if (cend == '\0')
                          return FNM_NOMATCH;
 
-                       if (cold <= fn && fn <= FOLD (cend))
-                         goto matched;
+                       lo[0] = cold;
+                       lo[1] = '\0';
+                       fc[0] = fn;
+                       fc[1] = '\0';
+                       if (strcoll (lo, fc) <= 0)
+                         {
+                           char hi[2];
+                           hi[0] = FOLD (cend);
+                           hi[1] = '\0';
+                           if (strcoll (fc, hi) <= 0)
+                             goto matched;
+                         }
 
                        c = *p++;
                      }