Linus Torvalds | 3cbb90a | 2006-03-25 09:41:40 -0800 | [diff] [blame^] | 1 | #include <linux/types.h> |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 2 | #include <linux/ctype.h> |
Linus Torvalds | 3cbb90a | 2006-03-25 09:41:40 -0800 | [diff] [blame^] | 3 | #include <linux/string.h> |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 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 | |
Linus Torvalds | 3cbb90a | 2006-03-25 09:41:40 -0800 | [diff] [blame^] | 16 | int strncasecmp(const char *s1, const char *s2, size_t n) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 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 | } |