summaryrefslogtreecommitdiff
path: root/src/strings/strncasecmp.c
blob: 7942be88eacd871511275163d5ca5a642cfa9eb9 (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
30
31
32
33
34
35
36
#if 0

#include <strings.h>
#include <ctype.h>

int strncasecmp(const char *s1, const char *s2, size_t n)
{
	while (n > 0 && *s1 && *s2) {
		char c1 = tolower(*s1);
		char c2 = tolower(*s2);
		if (c1 != c2) {
			return c1 - c2;
		}
		n--;
	}

	if (n == 0) {
		return 0;
	}

	if (*s1) {
		return -1;
	} else if (*s2) {
		return 1;
	}

	return 0;
}

/*
XOPEN(400)
POSIX(200809)
*/


#endif