xref: /plan9-contrib/sys/src/ape/lib/bsd/strcasecmp.c (revision 7dd7cddf99dd7472612f1413b4da293630e6b1bc)
1 #include <string.h>
2 #include <ctype.h>
3 #include <stdlib.h>
4 
5 #include <bsd.h>
6 
7 int
8 strcasecmp(char *a, char *b)
9 {
10 	int i;
11 	char *p;
12 
13 	a = strdup(a);
14 	b = strdup(b);
15 
16 	p = a;
17 	while(*p)
18 		*p++ = tolower(*p);
19 	p = b;
20 	while(*p)
21 		*p++ = tolower(*p);
22 	i = strcmp(a, b);
23 	free(a);
24 	free(b);
25 	return i;
26 }
27