k-tana-zero/libs/libc/strncasecmp.c
Julien CLEMENT 7178dbb6a7 feat: add given files
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
2021-07-12 15:57:08 +02:00

12 lines
233 B
C

#include <stddef.h>
#include <ctype.h>
int strncasecmp(const char *s1, const char *s2, size_t n)
{
for (; *s1 && n > 0; s1++, s2++, n--)
if (tolower(*s1) != tolower(*s2))
break;
return n ? tolower(*s1) - tolower(*s2) : 0;
}