* here. Major name space pollution, can't be helped.
*/
#include <direct.h>
-#include <getopt.h>
#include <io.h>
#include <process.h>
#include <sys/stat.h>
extern int w32_mkdir(const char *dirname, mode_t perm);
/* Should be in sys/stat.h */
+#ifdef _MSC_VER
#ifndef S_IRUSR
#define S_IRUSR _S_IREAD
#define S_IWUSR _S_IWRITE
#define S_IXOTH 0
#define S_IRWXO S_IROTH | S_IWOTH | S_IXOTH
#endif
+#endif
/* Should be in fcntl.h */
+/* HACK, for use with fcntl() on a socket only, see w32sockets.c */
#define O_NONBLOCK 1
-
#define F_GETFL 1
#define F_SETFL 2
-
extern int fcntl(int fd, int cmd, ...);
/* Stuff that actually belongs here */
#define close(fd) w32_close_function((fd))
extern int (*w32_close_function)(int);
-#define ftruncate(fd, length) _chsize((fd), (length))
#define read(fd, buf, sz) w32_read_function((fd), (buf), (sz))
extern int (*w32_read_function)(int, void *, unsigned);
#define write(fd, buf, sz) w32_write_function((fd), (buf), (sz))
extern int (*w32_write_function)(int, const void *, unsigned);
+#ifdef _MSC_VER
+#define ftruncate(fd, length) _chsize((fd), (length))
+#endif
+
+#ifndef _MSC_VER
+#include_next <unistd.h>
+#endif
#endif /* UNISTD_H */