summaryrefslogtreecommitdiff
path: root/src/strings/strcasecmp.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-15 15:42:58 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-15 15:42:58 -0400
commitf4478fca7deea454ae169e2d65db2114475a279d (patch)
treeb1acc198d4eb372ee1484f5f28be473d1decdcbe /src/strings/strcasecmp.c
parentf0a624cdb494275d3d0e5049eff07ceaa7ebe848 (diff)
implement
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;
}
/*