//	Zinc Application Framework - Z_UTILS.CPP
//	COPYRIGHT (C) 1990-1999.  All Rights Reserved.
//	Zinc Software Incorporated.  Pleasant Grove, Utah  USA

#include <z_ctype.hpp>
#include <z_stdlib.hpp>
#include <z_store.hpp>
#include <z_string.hpp>
#include <z_utils.hpp>

ZafIChar *ZafStrdup(const ZafIChar *srcString)
{
	// Make sure there is a valid string to duplicate.
	if (!srcString)
		return (ZAF_NULLP(ZafIChar));

	// Create the data space and copy the string.
	ZafIChar *destString = new ZafIChar[strlen(srcString) + 1];
	strcpy(destString, srcString);

	// Return the string pointer.
	return (destString);
}

int ZafStricmp(const ZafIChar *a, const ZafIChar *b)
{
	ZafIChar la, lb;
	for (;;)
	{
		la = *a; lb = *b;
		if (isupper(la))
			la = tolower(la);
		if (isupper(lb))
			lb = tolower(lb);
		if (la != lb || !la)
			break;
		a++; b++;
	}
	return (la - lb);
}

