From 2ab3d99967d68c79351fe2a3df22c445447e3010 Mon Sep 17 00:00:00 2001 From: Michał Cichoń Date: Tue, 15 Nov 2011 22:28:48 +0100 Subject: Initial import. --- compatibility/unistd.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 compatibility/unistd.h (limited to 'compatibility/unistd.h') diff --git a/compatibility/unistd.h b/compatibility/unistd.h new file mode 100644 index 0000000..3360ae2 --- /dev/null +++ b/compatibility/unistd.h @@ -0,0 +1,42 @@ +#ifndef _UNISTD_H +#define _UNISTD_H 1 + +/* This file intended to serve as a drop-in replacement for + * unistd.h on Windows + * Please add functionality as neeeded + */ + +#include +#include +//#include /* getopt from: http://www.pwilson.net/sample.html. */ + +#define srandom srand +#define random rand + +static const W_OK = 2; +static const R_OK = 4; + +#define access _access +#define ftruncate _chsize + +#undef ssize_t +#ifdef _WIN64 +typedef __int64 ssize_t; +#else +typedef _W64 int ssize_t; +#endif + +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 +/* should be in some equivalent to */ +typedef __int8 int8_t; +typedef __int16 int16_t; +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; + +#endif /* unistd.h */ -- cgit v1.2.3