chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
[PATCH] another patch for path problem
[elogind.git]
/
klibc
/
klibc
/
strncasecmp.c
1
/*
2
* strncasecmp.c
3
*/
4
5
#include <string.h>
6
#include <ctype.h>
7
8
int strncasecmp(const char *s1, const char *s2, size_t n)
9
{
10
char *n1, *n2;
11
int i, retval;
12
13
n1 = strndup(s1, n);
14
n2 = strndup(s2, n);
15
16
for (i = 0; i < strlen(n1); i++)
17
n1[i] = toupper(n1[i]);
18
for (i = 0; i < strlen(n2); i++)
19
n2[i] = toupper(n2[i]);
20
retval = strcmp(n1, n2);
21
free(n1);
22
free(n2);
23
return retval;
24
}