summaryrefslogtreecommitdiff
path: root/src/flstring.c
diff options
context:
space:
mode:
authorFabien Costantini <fabien@onepost.net>2012-04-21 17:21:11 +0000
committerFabien Costantini <fabien@onepost.net>2012-04-21 17:21:11 +0000
commit56a184d529d446bdff375fadeb9c0352a342f989 (patch)
tree0233739da2775987c4d4437ddee774fe6e6114a1 /src/flstring.c
parent157a96aa4b074d07e4391a1731d75d4eb594087f (diff)
STR 2771 fix: introduce a new ascii strcasecmp that does not rely on locale sensitive toupper tolower.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9368 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/flstring.c')
-rw-r--r--src/flstring.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/flstring.c b/src/flstring.c
index abfdcefd3..fcab1a765 100644
--- a/src/flstring.c
+++ b/src/flstring.c
@@ -90,6 +90,21 @@ fl_strlcpy(char *dst, /* O - Destination string */
return (srclen);
}
+/**
+* locale independent ascii oriented case cmp
+* returns 0 if string successfully compare, non zero otherwise
+*/
+int fl_ascii_strcasecmp(const char *s, const char *t) {
+ if (!s || !t) return (s!=t);
+ if (strlen(s) != strlen(t)) return -1;
+ for(;*s; s++,t++) {
+ if ( *s != *t) {
+ if (*s<*t && (*s+0x20)!=*t ) return -1;
+ if (*s>*t && *s!=(*t+0x20) ) return +1;
+ }
+ }
+ return 0;
+}
/*
* End of "$Id$".