summaryrefslogtreecommitdiff
path: root/lib/glob/fnmatch.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1998-07-23 14:37:54 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:52 +0000
commitbc4cd23ce958feda898c618215f94d8a4e8f4ffa (patch)
tree32fc9a13b636cb4d29873feddc533d3dfb25a917 /lib/glob/fnmatch.c
parentcce855bc5b117cb7ae70064131120687bc69fac0 (diff)
downloadbash-bc4cd23ce958feda898c618215f94d8a4e8f4ffa.tar.gz
Imported from ../bash-2.02.1.tar.gz.
Diffstat (limited to 'lib/glob/fnmatch.c')
-rw-r--r--lib/glob/fnmatch.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/glob/fnmatch.c b/lib/glob/fnmatch.c
index b5fdcc16..134676ba 100644
--- a/lib/glob/fnmatch.c
+++ b/lib/glob/fnmatch.c
@@ -37,9 +37,6 @@ static int extmatch ();
/* Note that these evaluate C many times. */
-#define ISUPPER(c) (isascii (c) && isupper (c))
-#define ISLOWER(c) (isascii (c) && islower (c))
-
#ifndef isblank
# define isblank(c) ((c) == ' ' || (c) == '\t')
#endif
@@ -52,7 +49,10 @@ static int extmatch ();
# define isxdigit(c) (((c) >= '0' && (c) <= '9') || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
#endif
-# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
+/* The result of FOLD is an `unsigned char' */
+# define FOLD(c) ((flags & FNM_CASEFOLD) && isupper ((unsigned char)c) \
+ ? tolower ((unsigned char)c) \
+ : ((unsigned char)c))
#ifndef STREQ
#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
@@ -190,7 +190,7 @@ gmatch (string, se, pattern, pe, flags)
return FNM_NOMATCH;
c = FOLD (c);
}
- if (FOLD (sc) != c)
+ if (FOLD (sc) != (unsigned char)c)
return FNM_NOMATCH;
break;
@@ -240,9 +240,9 @@ gmatch (string, se, pattern, pe, flags)
/* General case, use recursion. */
{
- char c1;
+ unsigned char c1;
- c1 = ((flags & FNM_NOESCAPE) == 0 && c == '\\') ? *p : c;
+ c1 = (unsigned char)((flags & FNM_NOESCAPE) == 0 && c == '\\') ? *p : c;
c1 = FOLD (c1);
for (--p; n < se; ++n)
/* Only call fnmatch if the first character indicates a
@@ -272,7 +272,7 @@ gmatch (string, se, pattern, pe, flags)
break;
default:
- if (c != FOLD (sc))
+ if ((unsigned char)c != FOLD (sc))
return (FNM_NOMATCH);
}
@@ -378,7 +378,7 @@ brackmatch (p, test, flags)
else if (STREQN (p+1, "graph:]", 7))
{ pc = isgraph (test); p += 8; }
else if (STREQN (p+1, "lower:]", 7))
- { pc = ISLOWER (test); p += 8; }
+ { pc = islower (test); p += 8; }
else if (STREQN (p+1, "print:]", 7))
{ pc = isprint (test); p += 8; }
else if (STREQN (p+1, "punct:]", 7))
@@ -386,7 +386,7 @@ brackmatch (p, test, flags)
else if (STREQN (p+1, "space:]", 7))
{ pc = isspace (test); p += 8; }
else if (STREQN (p+1, "upper:]", 7))
- { pc = ISUPPER (test); p += 8; }
+ { pc = isupper (test); p += 8; }
else if (STREQN (p+1, "xdigit:]", 8))
{ pc = isxdigit (test); p += 9; }
else if (STREQN (p+1, "ascii:]", 7))