libsent/src/util/strcasecmp.c

Go to the documentation of this file.
00001 
00023 /*
00024  * Copyright (c) 1991-2006 Kawahara Lab., Kyoto University
00025  * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
00026  * Copyright (c) 2005-2006 Julius project team, Nagoya Institute of Technology
00027  * All rights reserved
00028  */
00029 
00030 #include <sent/stddefs.h>
00031 
00032 #ifndef HAVE_STRCASECMP
00033 
00042 int
00043 strcasecmp(char *s1, char *s2)
00044 {
00045   int c1, c2;
00046 
00047   do {
00048     c1 = (*s1 >= 'a' && *s1 <= 'z') ? *s1 - 040 : *s1;
00049     c2 = (*s2 >= 'a' && *s2 <= 'z') ? *s2 - 040 : *s2;
00050     if (c1 != c2) break;
00051   }  while (*(s1++) && *(s2++));
00052   return(c1 - c2);
00053 }
00054 
00064 int
00065 strncasecmp(char *s1, char *s2, size_t n)
00066 {
00067   int c1, c2;
00068   do {
00069     c1 = (*s1 >= 'a' && *s1 <= 'z') ? *s1 - 040 : *s1;
00070     c2 = (*s2 >= 'a' && *s2 <= 'z') ? *s2 - 040 : *s2;
00071     if (c1 != c2) break;
00072   }  while (*(s1++) && *(s2++) && (--n));
00073   return(c1 - c2);
00074 }
00075 
00076 #endif /* ~HAVE_STRCASECMP */

Generated on Tue Dec 26 16:16:33 2006 for Julius by  doxygen 1.5.0