stracmp.c revision 1
252N/A/***********************************************************************
252N/A* *
252N/A* This software is part of the ast package *
252N/A* Copyright (c) 1985-2011 AT&T Intellectual Property *
252N/A* and is licensed under the *
252N/A* Common Public License, Version 1.0 *
252N/A* by AT&T Intellectual Property *
252N/A* *
252N/A* A copy of the License is available at *
252N/A* http://www.opensource.org/licenses/cpl1.0.txt *
252N/A* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
252N/A* *
252N/A* Information and Software Systems Research *
252N/A* AT&T Research *
252N/A* Florham Park NJ *
252N/A* *
252N/A* Glenn Fowler <gsf@research.att.com> *
252N/A* David Korn <dgk@research.att.com> *
252N/A* Phong Vo <kpv@research.att.com> *
252N/A* *
252N/A***********************************************************************/
252N/A#pragma prototyped
252N/A
252N/A/*
252N/A * ccmapchr(ccmap(CC_NATIVE,CC_ASCII),c) and strcmp
252N/A */
252N/A
252N/A#include <ast.h>
252N/A#include <ccode.h>
252N/A
252N/A#if _lib_stracmp
252N/A
252N/ANoN(stracmp)
252N/A
252N/A#else
252N/A
252N/A#include <ctype.h>
252N/A
252N/Aint
252N/Astracmp(const char* aa, const char* ab)
252N/A{
252N/A register unsigned char* a;
252N/A register unsigned char* b;
252N/A register unsigned char* m;
252N/A register int c;
252N/A register int d;
252N/A
252N/A if (!(m = ccmap(CC_NATIVE, CC_ASCII)))
return strcmp(aa, ab);
a = (unsigned char*)aa;
b = (unsigned char*)ab;
for (;;)
{
c = m[*a++];
if (d = c - m[*b++])
return d;
if (!c)
return 0;
}
}
#endif