10 |
|
#include <io.h> /* _setmode() and stuff from unistd.h */ |
11 |
|
#include <stdio.h> |
12 |
|
typedef long off_t; |
13 |
+ |
#undef ftello |
14 |
+ |
#define ftello _ftelli64 |
15 |
+ |
#undef fseeko |
16 |
+ |
#define fseeko _fseeki64 |
17 |
+ |
#undef fdopen |
18 |
|
#define fdopen _fdopen |
19 |
+ |
#undef read |
20 |
|
#define read _read |
21 |
+ |
#undef open |
22 |
|
#define open _open |
23 |
+ |
#undef close |
24 |
|
#define close _close |
25 |
+ |
#undef write |
26 |
|
#define write _write |
27 |
+ |
#undef ftruncate |
28 |
|
#define ftruncate _chsize_s |
29 |
+ |
#undef unlink |
30 |
|
#define unlink _unlink |
31 |
+ |
#undef fileno |
32 |
|
#define fileno _fileno |
33 |
+ |
#undef snprintf |
34 |
|
#define snprintf _snprintf |
35 |
+ |
#undef vsnprintf |
36 |
|
#define vsnprintf _vsnprintf |
37 |
|
/* XXX should we check first if size_t is 32 bit? */ |
38 |
+ |
#undef fseeko |
39 |
|
#define fseeko _fseeki64 |
40 |
+ |
#undef lseek |
41 |
|
#define lseek _lseek |
42 |
+ |
#undef access |
43 |
|
#define access _access |
44 |
+ |
#undef mktemp |
45 |
|
#define mktemp _mktemp |
46 |
+ |
#define fpurge(s) |
47 |
|
|
48 |
|
#include <string.h> |
49 |
+ |
#undef strcasecmp |
50 |
|
#define strcasecmp _stricmp |
51 |
+ |
#undef strncasecmp |
52 |
|
#define strncasecmp _strnicmp |
53 |
+ |
#undef strdup |
54 |
|
#define strdup _strdup |
55 |
|
|
56 |
|
#include <windows.h> |
79 |
|
|
80 |
|
#include <fcntl.h> /* _O_BINARY, _O_TEXT */ |
81 |
|
#include <stdlib.h> /* _fmode */ |
82 |
< |
#define SET_DEFAULT_BINARY() _fmode = _O_BINARY |
82 |
> |
#define SET_DEFAULT_BINARY() (_fmode = _O_BINARY) |
83 |
> |
#define SET_DEFAULT_TEXT() (_fmode = _O_TEXT) |
84 |
|
#define SET_FILE_BINARY(fp) _setmode(_fileno(fp),_O_BINARY) |
85 |
+ |
#define SET_FILE_TEXT(fp) _setmode(_fileno(fp),_O_TEXT) |
86 |
|
#define SET_FD_BINARY(fd) _setmode(fd,_O_BINARY) |
87 |
+ |
#define SET_FD_TEXT(fd) _setmode(fd,_O_TEXT) |
88 |
|
#define putenv _putenv |
89 |
|
|
90 |
< |
#else /* _WIN32 || _WIN64 */ |
90 |
> |
#else /* ! (_WIN32 || _WIN64) */ |
91 |
|
|
92 |
|
#ifdef AMIGA |
93 |
|
#define NON_POSIX |
98 |
|
#define RHAS_FORK_EXEC |
99 |
|
#endif |
100 |
|
|
101 |
+ |
#ifdef __linux__ |
102 |
+ |
#include <stdio_ext.h> |
103 |
+ |
#define fpurge __fpurge |
104 |
+ |
#endif |
105 |
|
/* everybody except Windows */ |
106 |
|
|
107 |
|
/* NOPs */ |
108 |
|
#define SET_DEFAULT_BINARY() |
109 |
|
#define SET_FILE_BINARY(fp) |
110 |
|
#define SET_FD_BINARY(fd) |
111 |
+ |
#define SET_DEFAULT_TEXT() |
112 |
+ |
#define SET_FILE_TEXT(fp) |
113 |
+ |
#define SET_FD_TEXT(fd) |
114 |
|
|
115 |
|
#endif /* _WIN32 || _WIN64 */ |
116 |
|
|
118 |
|
extern "C" { |
119 |
|
#endif |
120 |
|
|
121 |
< |
/* nothing to protect yet */ |
121 |
> |
#if defined(_WIN32) || defined(_WIN64) |
122 |
> |
|
123 |
> |
extern int usleep(__int64 usec); |
124 |
> |
|
125 |
> |
#endif /* _WIN32 || _WIN64 */ |
126 |
|
|
127 |
|
#ifdef __cplusplus |
128 |
|
} |