blob: 766857e14c26996c2a07e13c964192a1f9711bbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/* $Id$
*
*/
#include <pj/types.h>
#include <pj/compat/string.h>
#include <pj/ctype.h>
PJ_DEF(int) strcasecmp(const char *s1, const char *s2)
{
while ((*s1==*s2) || (pj_tolower(*s1)==pj_tolower(*s2))) {
if (!*s1++)
return 0;
++s2;
}
return (pj_tolower(*s1) < pj_tolower(*s2)) ? -1 : 1;
}
PJ_DEF(int) strncasecmp(const char *s1, const char *s2, int len)
{
if (!len) return 0;
while ((*s1==*s2) || (pj_tolower(*s1)==pj_tolower(*s2))) {
if (!*s1++ || --len <= 0)
return 0;
++s2;
}
return (pj_tolower(*s1) < pj_tolower(*s2)) ? -1 : 1;
}
|