]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - gnu/libexec/uucp/libuucp/strcas.c
This commit was generated by cvs2svn to compensate for changes in r56160,
[FreeBSD/FreeBSD.git] / gnu / libexec / uucp / libuucp / strcas.c
1 /* strcas.c
2    Compare two strings case insensitively.  */
3
4 #include "uucp.h"
5 #include <ctype.h>
6
7 int
8 strcasecmp (z1, z2)
9      const char *z1;
10      const char *z2;
11 {
12   char b1, b2;
13
14   while ((b1 = *z1++) != '\0')
15     {
16       b2 = *z2++;
17       if (b2 == '\0')
18         return 1;
19       if (b1 != b2)
20         {
21           if (isupper (BUCHAR (b1)))
22             b1 = tolower (BUCHAR (b1));
23           if (isupper (BUCHAR (b2)))
24             b2 = tolower (BUCHAR (b2));
25           if (b1 != b2)
26             return b1 - b2;
27         }
28     }
29   if (*z2 == '\0')
30     return 0;
31   else
32     return -1;
33 }