summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>1999-01-07 21:22:28 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>1999-01-07 21:22:28 +0000
commit27b224926616c42032aba0f7050efcf047e44322 (patch)
tree444962d7034ab58558aa8d826e5984aaf6e5d231
parent75e439ebbf0e3704fd8ffb12c5aeb03e0d97c3f5 (diff)
Updated file chooser and matching from Bill (better for WIN32).
git-svn-id: file:///fltk/svn/fltk/trunk@205 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-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 $".
//