roentgen b75cab
/* $Id: strcasecmp.c,v 1.3 2009-01-22 20:53:07 fwarmerdam Exp $ */
roentgen b75cab
roentgen b75cab
/*
roentgen b75cab
 * Copyright (c) 1987, 1993
roentgen b75cab
 *	The Regents of the University of California.  All rights reserved.
roentgen b75cab
 *
roentgen b75cab
 * Redistribution and use in source and binary forms, with or without
roentgen b75cab
 * modification, are permitted provided that the following conditions
roentgen b75cab
 * are met:
roentgen b75cab
 * 1. Redistributions of source code must retain the above copyright
roentgen b75cab
 *    notice, this list of conditions and the following disclaimer.
roentgen b75cab
 * 2. Redistributions in binary form must reproduce the above copyright
roentgen b75cab
 *    notice, this list of conditions and the following disclaimer in the
roentgen b75cab
 *    documentation and/or other materials provided with the distribution.
roentgen b75cab
 * 3. Neither the name of the University nor the names of its contributors
roentgen b75cab
 *    may be used to endorse or promote products derived from this software
roentgen b75cab
 *    without specific prior written permission.
roentgen b75cab
 *
roentgen b75cab
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
roentgen b75cab
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
roentgen b75cab
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
roentgen b75cab
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
roentgen b75cab
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
roentgen b75cab
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
roentgen b75cab
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
roentgen b75cab
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
roentgen b75cab
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
roentgen b75cab
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
roentgen b75cab
 * SUCH DAMAGE.
roentgen b75cab
 */
roentgen b75cab
roentgen b75cab
#if 0
roentgen b75cab
static char sccsid[] = "@(#)strcasecmp.c	8.1 (Berkeley) 6/4/93";
roentgen b75cab
__RCSID("$NetBSD: strcasecmp.c,v 1.16 2003/08/07 16:43:49 agc Exp $");
roentgen b75cab
#endif
roentgen b75cab
roentgen b75cab
#include <ctype.h></ctype.h>
roentgen b75cab
#include <string.h></string.h>
roentgen b75cab
#include "libport.h"
roentgen b75cab
roentgen b75cab
int
roentgen b75cab
strcasecmp(const char *s1, const char *s2)
roentgen b75cab
{
roentgen b75cab
	const unsigned char *us1 = (const unsigned char *)s1,
roentgen b75cab
			*us2 = (const unsigned char *)s2;
roentgen b75cab
roentgen b75cab
	while (tolower(*us1) == tolower(*us2++))
roentgen b75cab
		if (*us1++ == '\0')
roentgen b75cab
			return (0);
roentgen b75cab
	return (tolower(*us1) - tolower(*--us2));
roentgen b75cab
}