Files
musl/src/string/strncasecmp.c
Rich Felker 7424ac58b1 consolidate str[n]casecmp_l into str[n]casecmp source files
this is mainly done for consistency with the ctype functions and to
declutter the src/locale directory.
2014-07-02 21:38:54 -04:00

19 lines
465 B
C

#include <strings.h>
#include <ctype.h>
#include "libc.h"
int strncasecmp(const char *_l, const char *_r, size_t n)
{
const unsigned char *l=(void *)_l, *r=(void *)_r;
if (!n--) return 0;
for (; *l && *r && n && (*l == *r || tolower(*l) == tolower(*r)); l++, r++, n--);
return tolower(*l) - tolower(*r);
}
int __strncasecmp_l(const char *l, const char *r, size_t n, locale_t loc)
{
return strncasecmp(l, r, n);
}
weak_alias(__strncasecmp_l, strncasecmp_l);