Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / string / strcasecmp.c
blobc75a3e20d25330abab68c988efdfe4cfe3cb86a6
1 /*
2 FUNCTION
3 <<strcasecmp>>---case-insensitive character string compare
5 INDEX
6 strcasecmp
8 SYNOPSIS
9 #include <strings.h>
10 int strcasecmp(const char *<[a]>, const char *<[b]>);
12 DESCRIPTION
13 <<strcasecmp>> compares the string at <[a]> to
14 the string at <[b]> in a case-insensitive manner.
16 RETURNS
18 If <<*<[a]>>> sorts lexicographically after <<*<[b]>>> (after
19 both are converted to lowercase), <<strcasecmp>> returns a
20 number greater than zero. If the two strings match,
21 <<strcasecmp>> returns zero. If <<*<[a]>>> sorts
22 lexicographically before <<*<[b]>>>, <<strcasecmp>> returns a
23 number less than zero.
25 PORTABILITY
26 <<strcasecmp>> is in the Berkeley Software Distribution.
28 <<strcasecmp>> requires no supporting OS subroutines. It uses
29 tolower() from elsewhere in this library.
31 QUICKREF
32 strcasecmp
35 #include <strings.h>
36 #include <ctype.h>
38 int
39 strcasecmp (const char *s1,
40 const char *s2)
42 int d = 0;
43 for ( ; ; )
45 const int c1 = tolower(*s1++);
46 const int c2 = tolower(*s2++);
47 if (((d = c1 - c2) != 0) || (c2 == '\0'))
48 break;
50 return d;