extern bool rmtree(char *path, bool rmtopdir);
+/*
+ * stat() is not guaranteed to set the st_size field on win32, so we
+ * redefine it to our own implementation that is.
+ *
+ * We must pull in sys/stat.h here so the system header definition
+ * goes in first, and we redefine that, and not the other way around.
+ */
+#if defined(WIN32) && !defined(__CYGWIN__)
+#include <sys/stat.h>
+extern int pgwin32_safestat(const char *path, struct stat *buf);
+#define stat(a,b) pgwin32_safestat(a,b)
+#endif
+
#if defined(WIN32) && !defined(__CYGWIN__)
-/* open() and fopen() replacements to allow deletion of open files and
+/*
+ * open() and fopen() replacements to allow deletion of open files and
* passing of other special options.
*/
extern int pgwin32_open(const char *, int,...);
#define popen(a,b) _popen(a,b)
#define pclose(a) _pclose(a)
-/*
- * stat() is not guaranteed to set the st_size field on win32, so we
- * redefine it to our own implementation that is.
- *
- * We must pull in sys/stat.h here so the system header definition
- * goes in first, and we redefine that, and not the other way around.
- */
-extern int pgwin32_safestat(const char *path, struct stat *buf);
-#if !defined(FRONTEND) && !defined(_DIRMOD_C)
-#include <sys/stat.h>
-#define stat(a,b) pgwin32_safestat(a,b)
-#endif
-
/* Missing rand functions */
extern long lrand48(void);
extern void srand48(long seed);