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

#include <z_stdlib.hpp>
#include <z_string.hpp>
#include <z_cset.hpp>

#if defined(ZAF_UNICODE)
#	include "u_stdlib.cpp"
#elif defined(ZAF_ISO8859_1)
#undef getenv
ZafIChar *ZafGetEnv(const ZafIChar *envname)
{
	static ZafIChar envBuffer[ZAF_MAXENVLEN];

	char *osEnvName = ZafConvertToOSString(envname);
	char *osEnv = OSgetenv(osEnvName);
	delete []osEnvName;

	if (osEnv)
	{
		ZafIChar *zafEnv = ZafConvertToZafString(osEnv);
		strncpy(envBuffer, zafEnv, ZAF_MAXENVLEN - 1);
		envBuffer[ZAF_MAXENVLEN - 1] = 0;
		delete []zafEnv;
		return (envBuffer);
	}

	return (ZAF_NULLP(ZafIChar));
}
#else
	// We use the compiler's library for OEM characters
#endif
