Staging
v0.5.2
https://github.com/torvalds/linux
Raw File
Tip revision: d8c3291c73b958243b33f8509d4507e76dafd055 authored by Linus Torvalds on 11 May 2006, 23:31:53 UTC
Linux v2.6.17-rc4
Tip revision: d8c3291
strcasecmp.c
/*
 *  linux/arch/xtensa/lib/strcasecmp.c
 *
 *  This file is subject to the terms and conditions of the GNU General
 *  Public License.  See the file "COPYING" in the main directory of
 *  this archive for more details.
 *
 *  Copyright (C) 2002 Tensilica Inc.
 */

#include <linux/string.h>


/* We handle nothing here except the C locale.  Since this is used in
   only one place, on strings known to contain only 7 bit ASCII, this
   is ok.  */

int strcasecmp(const char *a, const char *b)
{
	int ca, cb;

	do {
		ca = *a++ & 0xff;
		cb = *b++ & 0xff;
		if (ca >= 'A' && ca <= 'Z')
			ca += 'a' - 'A';
		if (cb >= 'A' && cb <= 'Z')
			cb += 'a' - 'A';
	} while (ca == cb && ca != '\0');

	return ca - cb;
}
back to top