From aeee8c099f494298ed423920b66ce501dcb14790 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Fri, 1 Jul 2005 20:44:04 +0000
Subject: [PATCH] Kludges necessary for Cygwin compile (why? I have no idea...)

---
 src/xpdev/datewrap.h | 2 +-
 src/xpdev/dirwrap.h  | 4 ++++
 src/xpdev/filewrap.h | 2 ++
 src/xpdev/xpbeep.c   | 2 +-
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/xpdev/datewrap.h b/src/xpdev/datewrap.h
index 71083b82e9..965e9a2a34 100644
--- a/src/xpdev/datewrap.h
+++ b/src/xpdev/datewrap.h
@@ -43,7 +43,7 @@
 /* Compensates for struct tm "weirdness" */
 time_t sane_mktime(struct tm*);
 
-#if defined(__BORLANDC__)
+#if defined(__BORLANDC__) || defined(__CYGWIN__)
 	#define timezone _timezone
 #endif
 
diff --git a/src/xpdev/dirwrap.h b/src/xpdev/dirwrap.h
index 85ee3136ef..ec8b310268 100644
--- a/src/xpdev/dirwrap.h
+++ b/src/xpdev/dirwrap.h
@@ -67,6 +67,10 @@ extern "C" {
 	#include <glob.h>		/* POSIX.2 directory pattern matching function */
 	#define MKDIR(dir)		mkdir(dir,0777)
 
+	#if defined(__CYGWIN__)
+		#define DLLEXPORT	/* CygWin's glob.h #undef's DLLEXPORT */
+	#endif
+
 #else	
 
 	#include <direct.h>		/* mkdir() */
diff --git a/src/xpdev/filewrap.h b/src/xpdev/filewrap.h
index aaab270fb6..a9c5d5fbbf 100644
--- a/src/xpdev/filewrap.h
+++ b/src/xpdev/filewrap.h
@@ -80,8 +80,10 @@
 		#include <share.h>
 		#define L_SET	SEEK_SET
 	#else
+		#ifndef O_TEXT
 		#define O_TEXT		0		/* all files in binary mode on Unix */
 		#define O_BINARY	0		/* all files in binary mode on Unix */
+		#endif
 		#undef	O_DENYNONE
 		#define O_DENYNONE  (1<<31)	/* req'd for Baja/nopen compatibility */
 
diff --git a/src/xpdev/xpbeep.c b/src/xpdev/xpbeep.c
index 85be732594..2cc325fbaf 100644
--- a/src/xpdev/xpbeep.c
+++ b/src/xpdev/xpbeep.c
@@ -259,7 +259,7 @@ void DLLCALL unix_beep(int freq, int dur)
 	}
 #endif
 
-#if !defined(__GNU__) && !defined(__QNX__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__)
+#if !defined(__GNU__) && !defined(__QNX__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(__CYGWIN__)
 	if(console_fd == -1) 
   		console_fd = open("/dev/console", O_NOCTTY);
 	
-- 
GitLab