libspf2
1.2.11
src
libreplace
strncasecmp.c
Go to the documentation of this file.
1
#ifdef HAVE_CONFIG_H
2
#include "config.h"
3
#endif
4
5
// #ifndef HAVE_STRNCASECMP
6
7
#include <string.h>
8
#include <ctype.h>
9
10
int
11
strncasecmp
(
const
char
*s1,
const
char
*s2,
size_t
n)
12
{
13
if
(n == 0)
14
return
0;
15
16
while
((n-- != 0)
17
&& (tolower(*(
unsigned
char
*) s1) ==
18
tolower(*(
unsigned
char
*) s2))) {
19
if
(n == 0 || *s1 ==
'\0'
|| *s2 ==
'\0'
)
20
return
0;
21
s1++;
22
s2++;
23
}
24
25
return
tolower(*(
unsigned
char
*) s1) - tolower(*(
unsigned
char
*) s2);
26
}
27
28
// #endif /* HAVE_STRNCASECMP */
strncasecmp
int strncasecmp(const char *s1, const char *s2, size_t n)
Definition
strncasecmp.c:11
Generated by
1.9.7