aboutsummaryrefslogtreecommitdiff
path: root/jimiocompat.h
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2020-05-05 18:44:21 +1000
committerSteve Bennett <steveb@workware.net.au>2020-05-05 21:24:52 +1000
commitbda206b77afac4f73617df866a620b7c3b6f475d (patch)
tree7a17f847a7af335d273cd012f64ee122ccc5eb4a /jimiocompat.h
parent9366d8f76430fac4c64be6dd99e44a13ed4c2fb9 (diff)
downloadjimtcl-bda206b77afac4f73617df866a620b7c3b6f475d.zip
jimtcl-bda206b77afac4f73617df866a620b7c3b6f475d.tar.gz
jimtcl-bda206b77afac4f73617df866a620b7c3b6f475d.tar.bz2
file: stat: Fixes for 64 bit times on Windows
While -D__MINGW_USE_VC2005_COMPAT enables a 64-bit time_t, it is necessary to explicitly use _stat64 to access the stat structure containing 64 bit times. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jimiocompat.h')
-rw-r--r--jimiocompat.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/jimiocompat.h b/jimiocompat.h
index 2cbb578..5215d65 100644
--- a/jimiocompat.h
+++ b/jimiocompat.h
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <errno.h>
+#include <sys/stat.h>
#include "jimautoconf.h"
#include <jim.h>
@@ -61,19 +62,26 @@ int Jim_OpenForRead(const char *filename);
#define HAVE_PIPE
#define pipe(P) _pipe((P), 0, O_NOINHERIT)
-#elif defined(HAVE_UNISTD_H)
- #include <unistd.h>
- #include <fcntl.h>
- #include <sys/wait.h>
- #include <sys/stat.h>
+ typedef struct _stat64 jim_stat_t;
+ #define Jim_Stat _stat64
+
+#else
+ typedef struct stat jim_stat_t;
+ #define Jim_Stat stat
+
+ #if defined(HAVE_UNISTD_H)
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <sys/wait.h>
- typedef int pidtype;
- #define Jim_Errno() errno
- #define JIM_BAD_PID -1
- #define JIM_NO_PID 0
+ typedef int pidtype;
+ #define Jim_Errno() errno
+ #define JIM_BAD_PID -1
+ #define JIM_NO_PID 0
- #ifndef HAVE_EXECVPE
- #define execvpe(ARG0, ARGV, ENV) execvp(ARG0, ARGV)
+ #ifndef HAVE_EXECVPE
+ #define execvpe(ARG0, ARGV, ENV) execvp(ARG0, ARGV)
+ #endif
#endif
#endif