Gmatch did not trim the characters inside a range.
authorChristos Zoulas <christos@ucbvax.Berkeley.EDU>
Tue, 25 Jun 1991 12:54:50 +0000 (04:54 -0800)
committerChristos Zoulas <christos@ucbvax.Berkeley.EDU>
Tue, 25 Jun 1991 12:54:50 +0000 (04:54 -0800)
SCCS-vsn: bin/csh/glob.c 5.21

usr/src/bin/csh/glob.c

index 7408419..51214df 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)glob.c     5.20 (Berkeley) %G%";
+static char sccsid[] = "@(#)glob.c     5.21 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -740,9 +740,9 @@ Gmatch(string, pattern)
                        return (0);
                if (match)
                    continue;
                        return (0);
                if (match)
                    continue;
-               if (rangec == '-') {
-                   match = (stringc <= *pattern &&
-                            *(pattern - 2) <= stringc);
+               if (rangec == '-' && *(pattern - 2) != '[' && *pattern != ']') {
+                   match = (stringc <= (*pattern & TRIM) &&
+                            (*(pattern - 2) & TRIM) <= stringc);
                    pattern++;
                }
                else
                    pattern++;
                }
                else