summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/filename_match.cxx17
-rw-r--r--src/fl_file_chooser.cxx12
2 files changed, 24 insertions, 5 deletions
diff --git a/src/filename_match.cxx b/src/filename_match.cxx
index 449db3b08..60bac1d83 100644
--- a/src/filename_match.cxx
+++ b/src/filename_match.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: filename_match.cxx,v 1.4 1999/01/07 19:17:35 mike Exp $"
+// "$Id: filename_match.cxx,v 1.5 1999/01/07 21:22:28 mike Exp $"
//
// Pattern matching routines for the Fast Light Tool Kit (FLTK).
//
@@ -25,6 +25,7 @@
/* Adapted from Rich Salz. */
#include <FL/filename.H>
+#include <ctype.h>
int filename_match(const char *s, const char *p) {
int matched;
@@ -88,15 +89,25 @@ int filename_match(const char *s, const char *p) {
case 0: // end of pattern
return !*s;
+#ifdef WIN32
case '\\': // quote next character
if (*p) p++;
- default : // other characters
if (*s++ != *(p-1)) return 0;
break;
+ default:
+ if (tolower(*s) != tolower(*(p-1))) return 0;
+ s++;
+#else
+ case '\\': // quote next character
+ if (*p) p++;
+ default :
+ if (*s++ != *(p-1)) return 0;
+ break;
+#endif
}
}
}
//
-// End of "$Id: filename_match.cxx,v 1.4 1999/01/07 19:17:35 mike Exp $".
+// End of "$Id: filename_match.cxx,v 1.5 1999/01/07 21:22:28 mike Exp $".
//
diff --git a/src/fl_file_chooser.cxx b/src/fl_file_chooser.cxx
index 68195c93a..3847e0c7a 100644
--- a/src/fl_file_chooser.cxx
+++ b/src/fl_file_chooser.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_file_chooser.cxx,v 1.9 1999/01/07 19:17:39 mike Exp $"
+// "$Id: fl_file_chooser.cxx,v 1.10 1999/01/07 21:22:28 mike Exp $"
//
// File chooser widget for the Fast Light Tool Kit (FLTK).
//
@@ -305,7 +305,11 @@ void FCB::set(const char* buf) {
any = 1;
const char* a = (*q)->d_name;
const char* b = buf+bufdirend;
+#ifdef WIN32
+ while (*b && tolower(*a)==tolower(*b)) {a++; b++;}
+#else
while (*b && *a==*b) {a++; b++;}
+#endif
if (!*b && (*a==0 || /* *a=='/' ||*/ *a==1)) break;
}
}
@@ -323,7 +327,11 @@ void FCB::set(const char* buf) {
any = 1;
const char* a = (*q)->d_name;
const char* b = buf+bufdirend;
+#ifdef WIN32
+ while (*b && tolower(*a)==tolower(*b)) {a++; b++;}
+#else
while (*b && *a==*b) {a++; b++;}
+#endif
if (!*b && (*a==0 || /* *a=='/' ||*/ *a==1)) break;
}
new_list();
@@ -614,5 +622,5 @@ char* fl_file_chooser(const char* message, const char* pat, const char* fname)
}
//
-// End of "$Id: fl_file_chooser.cxx,v 1.9 1999/01/07 19:17:39 mike Exp $".
+// End of "$Id: fl_file_chooser.cxx,v 1.10 1999/01/07 21:22:28 mike Exp $".
//