case-insensitive counted string comparison */ { aka strncasecmp }*/
| 714 | /* case-insensitive counted string comparison */ |
| 715 | /*{ aka strncasecmp }*/ |
| 716 | int |
| 717 | strncmpi( |
| 718 | const char *s1, const char *s2, |
| 719 | int n) /*(should probably be size_t, which is unsigned)*/ |
| 720 | { |
| 721 | char t1, t2; |
| 722 | |
| 723 | while (n--) { |
| 724 | if (!*s2) |
| 725 | return (*s1 != 0); /* s1 >= s2 */ |
| 726 | else if (!*s1) |
| 727 | return -1; /* s1 < s2 */ |
| 728 | t1 = lowc(*s1++); |
| 729 | t2 = lowc(*s2++); |
| 730 | if (t1 != t2) |
| 731 | return (t1 > t2) ? 1 : -1; |
| 732 | } |
| 733 | return 0; /* s1 == s2 */ |
| 734 | } |
| 735 | #endif /* STRNCMPI */ |
| 736 | |
| 737 | #ifndef STRSTRI |
no test coverage detected