coar 98/06/28 07:43:19
Modified: src CHANGES
src/include fnmatch.h
src/main fnmatch.c
Log:
ap_fnmatch() only did case-exact matching. With the addition of
the FNM_CASE_BLIND flag bit, it can now be told to ignore case.
Considering the case-sensitivity issues cropping up on Win32,
this seemed an appropriate addition even though nothing uses it yet.
Reviewed by: Dean Guadet
Revision Changes Path
1.936 +3 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.935
retrieving revision 1.936
diff -u -r1.935 -r1.936
--- CHANGES 1998/06/27 17:58:38 1.935
+++ CHANGES 1998/06/28 14:43:16 1.936
@@ -1,5 +1,8 @@
Changes with Apache 1.3.1
+ *) Add a flag so ap_fnmatch() can be used for case-blind pattern matching.
+ [Ken Coar, Dean Gaudet]
+
*) Win32: Don't collapse multiple slashes in PATH_INFO.
[Ben Laurie, Bill Stoddard <[EMAIL PROTECTED]>] PR#2274
1.6 +2 -0 apache-1.3/src/include/fnmatch.h
Index: fnmatch.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/fnmatch.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- fnmatch.h 1998/05/03 17:31:08 1.5
+++ fnmatch.h 1998/06/28 14:43:18 1.6
@@ -49,6 +49,8 @@
#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
#define FNM_PERIOD 0x04 /* Period must be matched by period. */
+/* This flag is an Apache addition */
+#define FNM_CASE_BLIND 0x08 /* Compare characters case-insensitively. */
API_EXPORT(int) ap_fnmatch(const char *, const char *, int);
1.11 +11 -3 apache-1.3/src/main/fnmatch.c
Index: fnmatch.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/fnmatch.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- fnmatch.c 1998/06/20 13:12:36 1.10
+++ fnmatch.c 1998/06/28 14:43:19 1.11
@@ -140,9 +140,12 @@
}
/* FALLTHROUGH */
default:
- if (c != *string++) {
+ if ((c != *string)
+ || ((flags & FNM_CASE_BLIND)
+ && (toupper(c) != toupper(*string)))) {
return (FNM_NOMATCH);
}
+ string++;
break;
}
/* NOTREACHED */
@@ -180,11 +183,16 @@
if (c2 == EOS) {
return (NULL);
}
- if (c <= test && test <= c2) {
+ if ((c <= test && test <= c2)
+ || ((flags & FNM_CASE_BLIND)
+ && ((toupper(c) <= toupper(test))
+ && (toupper(test) <= toupper(c2))))) {
ok = 1;
}
}
- else if (c == test) {
+ else if ((c == test)
+ || ((flags & FNM_CASE_BLIND)
+ && (toupper(c) == toupper(test)))) {
ok = 1;
}
}