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

#if !defined(Z_UNISTD_HPP)
#define Z_UNISTD_HPP
#include <z_env.hpp>

#if defined(ZAF_ISO8859_1)
#	if defined(__BCPLUSPLUS__) || defined(__TCPLUSPLUS__)
#		include <dir.h>
#		include <io.h>
#		include <stdio.h>
#	elif defined(_MSC_VER) || (defined(__IBMCPP__) && !defined(_IBM_RS6000)) || defined(__SC__)
#		include <direct.h>
#		include <io.h>
#	elif defined(__WATCOMC__) && !defined(__QNX__)
#		include <stdio.h>
#		include <direct.h>
#		include <io.h>
#	elif defined(__CADUL__)
#		include <phile.h>
		// phile.h defines time_t differently than time.h does.  It also
		// does not ofer any ifdef protection of the definition like time.h
		// does.  So we need to make sure that anywhere phile.h and time.h
		// are both included, phile.h is included first and we define 
		// _TIME_T_DEFINED so we don't get a redifinition compile error.
#		define _TIME_T_DEFINED
#	else
#		include <unistd.h>
#		if !defined(ZAF_MACINTOSH)
#			include <sys/stat.h>
#		endif
#	endif
#	if defined(__DVX__)
#		include <stdio.h>
#		include <direct.h>
#	elif defined(ZAF_MOTIF)
#		include <stdio.h>
#	endif

	ZAF_EXPORT int ZafChDir(const ZafIChar *path);
	ZAF_EXPORT ZafIChar *ZafGetCwd(ZafIChar *path, unsigned int length);
#	if defined(_SUNOS4) && defined(__GNUC__)
	extern "C"
	{
#	endif
	ZAF_EXPORT int ZafRename(const ZafIChar *oldPath, const ZafIChar *newPath);
	ZAF_EXPORT int ZafUnlink(const ZafIChar *path);
#	if defined(_SUNOS4) && defined(__GNUC__)
	}
#	endif

#	if defined(ZAF_PSOS)
#		define OSchdir	change_dir
#		define OSgetcwd	getcwd
#		define OSrename	move_f
#		define OSunlink	remove_f
#		define OSremove	remove_f
#	else
#		define OSchdir	chdir
#		define OSgetcwd	getcwd
#		define OSrename	rename
#		define OSunlink	unlink
#		define OSremove	remove
#	endif
#	define chdir	ZafChDir
#	define getcwd	ZafGetCwd
#	define rename	ZafRename
#	define unlink	ZafUnlink
#	define remove	ZafUnlink
#elif defined(ZAF_UNICODE)
#	if defined(__BCPLUSPLUS__) || defined(__TCPLUSPLUS__)
#		include <dir.h>
#		include <io.h>
#	elif defined(_MSC_VER) || (defined(__IBMCPP__) && defined(WIN32))
#		include <direct.h>
#		include <io.h>
#	elif defined(__WATCOMC__) && !defined(__QNX__)
#		include <stdio.h>
#		include <direct.h>
#		include <io.h>
#	else
#		include <unistd.h>
#	if defined(__linux__) || defined(ZAF_VXWORKS)
#		include <stdio.h>
#	endif
#	endif
#	if defined(__DVX__)
#		include <stdio.h>
#		include <direct.h>
#	endif

	extern "C++" ZAF_EXPORT int chdir(const ZafIChar *path);
	extern "C++" ZAF_EXPORT ZafIChar *getcwd(ZafIChar *path, unsigned int length);
	extern "C++" ZAF_EXPORT int rename(const ZafIChar *oldPath, const ZafIChar *newPath);
	extern "C++" ZAF_EXPORT int unlink(const ZafIChar *path);
	extern "C++" ZAF_EXPORT int remove(const ZafIChar *path);
#else
#	if defined(__BCPLUSPLUS__) || defined(__TCPLUSPLUS__)
#		include <dir.h>
#		include <io.h>
#	elif defined(_MSC_VER) || defined(__IBMCPP__)
#		include <direct.h>
#		include <io.h>
#	else
#		include <unistd.h>
#	endif
#	if defined(__DVX__)
#		include <stdio.h>
#		include <direct.h>
#	endif
#endif

#endif
