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