00001 // 00002 // Part of the ht://Dig package <http://www.htdig.org/> 00003 // Copyright (c) 1999, 2000, 2001 The ht://Dig Group 00004 // For copyright details, see the file COPYING in your distribution 00005 // or the GNU General Public License version 2 or later 00006 // <http://www.gnu.org/copyleft/gpl.html> 00007 // 00008 // $Id: strcasecmp2_8c-source.html,v 1.1 2008年06月08日 10:22:18 sebdiaz Exp $ 00009 // 00010 00011 #ifdef HAVE_CONFIG_H 00012 #include "config.h" 00013 #endif /* HAVE_CONFIG_H */ 00014 00015 #include <ctype.h> 00016 00017 //***************************************************************************** 00018 // 00019 int strcasecmp(const char *str1, const char *str2) 00020 { 00021 if (!str1 && !str2) 00022 return 0; 00023 if (!str1) 00024 return 1; 00025 if (!str2) 00026 return -1; 00027 while (*str1 && 00028 *str2 && 00029 tolower((unsigned char)*str1) == tolower((unsigned char)*str2)) 00030 { 00031 str1++; 00032 str2++; 00033 } 00034 00035 return tolower((unsigned char)*str1) - tolower((unsigned char)*str2); 00036 }