summaryrefslogtreecommitdiff
path: root/src/strings/strcasecmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/strings/strcasecmp.c')
-rw-r--r--src/strings/strcasecmp.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/strings/strcasecmp.c b/src/strings/strcasecmp.c
index e9006fe2..a5955f4e 100644
--- a/src/strings/strcasecmp.c
+++ b/src/strings/strcasecmp.c
@@ -1,8 +1,23 @@
#include <strings.h>
+#include <ctype.h>
int strcasecmp(const char *s1, const char *s2)
{
- return strcasecmp_l (s1, s2, (locale_t)0);
+ while (*s1 && *s2) {
+ char c1 = tolower(*s1);
+ char c2 = tolower(*s2);
+ if (c1 != c2) {
+ return c1 - c2;
+ }
+ }
+
+ if (*s1) {
+ return -1;
+ } else if (*s2) {
+ return 1;
+ }
+
+ return 0;
}
/*