source:
trunk/sys/dietlibc/strncasecmp.c
@
335
Last change on this file since 335 was 1, checked in by , 8 years ago | |
---|---|
File size: 491 bytes |
Rev | Line | |
---|---|---|
[1] | 1 | #include <strings.h> |
2 | ||
3 | int strncasecmp ( const char* s1, const char* s2, size_t len ) | |
4 | { | |
5 | register unsigned int x2; | |
6 | register unsigned int x1; | |
7 | register const char* end = s1 + len; | |
8 | ||
9 | while (1) { | |
10 | if (s1 >= end) | |
11 | return 0; | |
12 | x2 = *s2 - 'A'; if (x2 < 26u) x2 += 32; | |
13 | x1 = *s1 - 'A'; if (x1 < 26u) x1 += 32; | |
14 | s1++; s2++; | |
15 | if (x2 != x1) | |
16 | break; | |
17 | if (x1 == (unsigned int)-'A') | |
18 | break; | |
19 | } | |
20 | ||
21 | return x1 - x2; | |
22 | } |
Note: See TracBrowser
for help on using the repository browser.