sdcc.dsw: Added some dependencies on project config.dsp
[fw/sdcc] / as / hc08 / strcmpi.c
1 /* strcmpi.c */
2
3 /*
4  * Compare two strings ignoring case.
5  *
6  * Taken from GLIBC 2.2.5. Original code is copyrighted "Free
7  * Software Foundation" and published under the GNU Lesser General
8  * Public License.
9  * 
10  */
11
12 #include <ctype.h>
13 #include "strcmpi.h"
14
15 int as_strcmpi (const char *s1, const char *s2)
16 {
17   const unsigned char *p1 = (const unsigned char *) s1;
18   const unsigned char *p2 = (const unsigned char *) s2;
19   unsigned char c1, c2;
20
21   if (p1 == p2)
22     return 0;
23
24   do
25     {
26       c1 = tolower (*p1++);
27       c2 = tolower (*p2++);
28       if (c1 == '\0')
29         break;
30     }
31   while (c1 == c2);
32   
33   return c1 - c2;
34 }
35