]> Pileus Git - ~andy/linux/blob - arch/powerpc/lib/strcase.c
Merge branch 'upstream-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/linvil...
[~andy/linux] / arch / powerpc / lib / strcase.c
1 #include <linux/types.h>
2 #include <linux/ctype.h>
3 #include <linux/string.h>
4
5 int strcasecmp(const char *s1, const char *s2)
6 {
7         int c1, c2;
8
9         do {
10                 c1 = tolower(*s1++);
11                 c2 = tolower(*s2++);
12         } while (c1 == c2 && c1 != 0);
13         return c1 - c2;
14 }
15
16 int strncasecmp(const char *s1, const char *s2, size_t n)
17 {
18         int c1, c2;
19
20         do {
21                 c1 = tolower(*s1++);
22                 c2 = tolower(*s2++);
23         } while ((--n > 0) && c1 == c2 && c1 != 0);
24         return c1 - c2;
25 }