a0d732e883bb1ba8a72a5cc2293fd2ad3efe2271
[reactos.git] / lib / ntdll / string / strnicmp.c
1 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2 #include <string.h>
3 #include <ctype.h>
4
5 /*
6  * @implemented
7  */
8 int _strnicmp(const char *s1, const char *s2, size_t n)
9 {
10
11   if (n == 0)
12     return 0;
13   do {
14     if (toupper(*s1) != toupper(*s2++))
15       return toupper(*(unsigned const char *)s1) - toupper(*(unsigned const char *)--s2);
16     if (*s1++ == 0)
17       break;
18   } while (--n != 0);
19   return 0;
20 }