79
80
#define snprintf _snprintf
80
81
#define vsnprintf _vsnprintf
82
/* No stat on Windows. */
83
/* Define a wgint type under Windows. */
84
typedef __int64 wgint;
85
#define SIZEOF_WGINT 8
88
#define WGINT_MAX 9223372036854775807LL
90
#define WGINT_MAX 9223372036854775807I64
93
#define str_to_wgint str_to_int64
94
__int64 str_to_int64 (const char *, char **, int);
96
/* No lstat on Windows. */
99
/* Transparently support large files, in spirit similar to the POSIX
101
#define stat(fname, buf) _stati64 (fname, buf)
104
# define fstat(fd, buf) _fstati64 (fd, buf)
107
#if defined(_MSC_VER) || defined(__MINGW32__)
108
# define struct_stat struct _stati64
109
#elif defined(__BORLANDC__)
110
# define struct_stat struct stati64
112
# define struct_stat struct stat
85
115
#define PATH_SEPARATOR '\\'
87
/* Microsoft says stat is _stat, Borland doesn't */
92
117
#ifdef HAVE_ISATTY
93
/* Microsoft VC supports _isatty; Borland ? */
95
119
# define isatty _isatty
99
#define REALCLOSE(x) closesocket (x)
101
/* read & write don't work with sockets on Windows 95. */
102
#define READ(fd, buf, cnt) recv ((fd), (buf), (cnt), 0)
103
#define WRITE(fd, buf, cnt) send ((fd), (buf), (cnt), 0)
105
123
/* #### Do we need this? */
106
124
#include <direct.h>
108
/* Windows compilers accept only one arg to mkdir. */
110
# define mkdir(a, b) _mkdir(a)
111
#else /* __BORLANDC__ */
112
# define mkdir(a, b) mkdir(a)
113
#endif /* __BORLANDC__ */
115
/* Declarations of various socket errors: */
126
/* Windows compilers accept only one arg to mkdir. */
127
#define mkdir(a, b) _mkdir(a)
131
/* Winsock functions don't set errno, so we provide wrappers
134
#define socket wrapped_socket
135
#define bind wrapped_bind
136
#define connect wrapped_connect
137
#define recv wrapped_recv
138
#define send wrapped_send
139
#define select wrapped_select
140
#define getsockname wrapped_getsockname
141
#define getpeername wrapped_getpeername
142
#define setsockopt wrapped_setsockopt
143
#define closesocket wrapped_closesocket
145
#endif /* not INHIBIT_WRAP */
147
int wrapped_socket (int, int, int);
148
int wrapped_bind (int, struct sockaddr *, int);
149
int wrapped_connect (int, const struct sockaddr *, int);
150
int wrapped_recv (int, void *, int, int);
151
int wrapped_send (int, const void *, int, int);
152
int wrapped_select (int, fd_set *, fd_set *, fd_set *, const struct timeval *);
153
int wrapped_getsockname (int, struct sockaddr *, int *);
154
int wrapped_getpeername (int, struct sockaddr *, int *);
155
int wrapped_setsockopt (int, int, int, const void *, int);
156
int wrapped_closesocket (int);
158
/* Finally, provide a private version of strerror that does the
159
right thing with Winsock errors. */
161
# define strerror windows_strerror
163
const char *windows_strerror (int);
165
/* Declarations of various socket errors: */
117
167
#define EWOULDBLOCK WSAEWOULDBLOCK
118
168
#define EINPROGRESS WSAEINPROGRESS
153
203
/* Public functions. */
156
unsigned int sleep (unsigned);
159
int usleep (unsigned long);
162
205
void ws_startup (void);
163
void ws_changetitle (const char*, int);
206
void ws_changetitle (const char *);
164
207
void ws_percenttitle (double);
165
208
char *ws_mypath (void);
166
void ws_help (const char *);
167
void windows_main_junk (int *, char **, char **);
209
void windows_main (int *, char **, char **);
169
/* Things needed for IPv6; missing in <ws2tcpip.h>. */
211
/* Things needed for IPv6; missing in <ws2tcpip.h>. */
170
212
#ifdef ENABLE_IPV6
172
extern const char *inet_ntop (int af, const void *src, char *dst, size_t size);
175
extern int inet_pton (int af, const char *src, void *dst);
213
# ifndef HAVE_INET_NTOP
214
extern const char *inet_ntop (int af, const void *src, char *dst, size_t size);
177
216
#endif /* ENABLE_IPV6 */