cuserid: support invocation with a null pointer argument
[musl.git] / src / string / strcasecmp.c
blob002c6aa15bcafcc2c20ea82795e761b99d558b49
1 #include <strings.h>
2 #include <ctype.h>
4 int strcasecmp(const char *_l, const char *_r)
6 const unsigned char *l=(void *)_l, *r=(void *)_r;
7 for (; *l && *r && (*l == *r || tolower(*l) == tolower(*r)); l++, r++);
8 return tolower(*l) - tolower(*r);
11 int __strcasecmp_l(const char *l, const char *r, locale_t loc)
13 return strcasecmp(l, r);
16 weak_alias(__strcasecmp_l, strcasecmp_l);