/misc/src/release/graphviz-2.18-1/src/graphviz-2.18/lib/common/strncasecmp.c

Go to the documentation of this file.
00001 /* $Id: strncasecmp.c,v 1.3 2005/07/20 02:39:16 ellson Exp $ $Revision: 1.3 $ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /**********************************************************
00005 *      This software is part of the graphviz package      *
00006 *                http://www.graphviz.org/                 *
00007 *                                                         *
00008 *            Copyright (c) 1994-2004 AT&T Corp.           *
00009 *                and is licensed under the                *
00010 *            Common Public License, Version 1.0           *
00011 *                      by AT&T Corp.                      *
00012 *                                                         *
00013 *        Information and Software Systems Research        *
00014 *              AT&T Research, Florham Park NJ             *
00015 **********************************************************/
00016 
00017 #ifdef HAVE_CONFIG_H
00018 #include "config.h"
00019 #endif
00020 
00021 #ifndef HAVE_STRNCASECMP
00022 
00023 #include <string.h>
00024 #include <ctype.h>
00025 
00026 int strncasecmp(const char *s1, const char *s2, unsigned int n)
00027 {
00028     if (n == 0)
00029         return 0;
00030 
00031     while ((n-- != 0)
00032            && (tolower(*(unsigned char *) s1) ==
00033                tolower(*(unsigned char *) s2))) {
00034         if (n == 0 || *s1 == '\0' || *s2 == '\0')
00035             return 0;
00036         s1++;
00037         s2++;
00038     }
00039 
00040     return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2);
00041 }
00042 
00043 #endif                          /* HAVE_STRNCASECMP */

Generated on Mon Mar 31 19:03:25 2008 for Graphviz by  doxygen 1.5.1