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