summaryrefslogtreecommitdiff
path: root/src/Fl_Native_File_Chooser_common.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fl_Native_File_Chooser_common.cxx')
-rw-r--r--src/Fl_Native_File_Chooser_common.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Fl_Native_File_Chooser_common.cxx b/src/Fl_Native_File_Chooser_common.cxx
index 7fec0a34e..1849ef50b 100644
--- a/src/Fl_Native_File_Chooser_common.cxx
+++ b/src/Fl_Native_File_Chooser_common.cxx
@@ -71,6 +71,26 @@ static void chrcat(char *s, char c) {
strcat(s, tmp);
}
+// COUNT OCCURANCES OF CHAR 'c' IN 'find'.
+int strcnt(const char *s, char c) {
+ int cnt = 0;
+ while ( *s ) { if (*s++ == c ) ++cnt; }
+ return cnt;
+}
+
+// COUNT OCCURANCES OF ANY CHARS FROM 'find' IN 's'.
+int strcnt(const char *s, const char *find) {
+ int cnt = 0;
+ const char *f;
+ while ( *s ) {
+ for (f=find; *f; f++) {
+ if (*s == *f) { ++cnt; break; }
+ }
+ ++s;
+ }
+ return cnt;
+}
+
//
// End of "$Id$".
//