clib

strncasecmp2.c

Go to the documentation of this file.
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: strncasecmp2_8c-source.html,v 1.1 2008年06月08日 10:22:19 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 strncasecmp(const char *str1, const char *str2, int n)
00020 {
00021 if (!str1 && !str2)
00022 return 0;
00023 if (!str1)
00024 return 1;
00025 if (!str2)
00026 return -1;
00027 if (n < 0)
00028 return 0;
00029 while (n &&
00030 *str1 &&
00031 *str2 &&
00032 tolower((unsigned char)*str1) == tolower((unsigned char)*str2))
00033 {
00034 str1++;
00035 str2++;
00036 n--;
00037 }
00038 
00039 return n == 0 ? 0 :
00040 tolower((unsigned char)*str1) - tolower((unsigned char)*str2);
00041 }

Generated on Sun Jun 8 10:56:34 2008 for GNUmifluz by doxygen 1.5.5

AltStyle によって変換されたページ (->オリジナル) /