Blame port/strcasecmp.c

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