1 /* Declarations for windows
2 Copyright (C) 1995, 1997, 1997, 1998 Free Software Foundation, Inc.
4 This file is part of GNU Wget.
6 GNU Wget is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 GNU Wget is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Wget; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 In addition, as a special exception, the Free Software Foundation
21 gives permission to link the code of its release of Wget with the
22 OpenSSL project's "OpenSSL" library (or with modified versions of it
23 that use the same license as the "OpenSSL" library), and distribute
24 the linked executables. You must obey the GNU General Public License
25 in all respects for all of the code used other than "OpenSSL". If you
26 modify this file, you may extend this exception to your version of the
27 file, but you are not obligated to do so. If you do not wish to do
28 so, delete this exception statement from your version. */
34 #error Include mswindows.h inside or after "wget.h"
37 #ifndef WIN32_LEAN_AND_MEAN
38 #define WIN32_LEAN_AND_MEAN /* Prevent inclusion of <winsock*.h> in <windows.h> */
43 /* Use the correct winsock header; <ws2tcpip.h> includes <winsock2.h> only on
44 * Watcom/MingW. We cannot use <winsock.h> for IPv6. Using getaddrinfo() requires
47 #if defined(ENABLE_IPV6) || defined(HAVE_GETADDRINFO)
48 # include <winsock2.h>
49 # include <ws2tcpip.h>
55 # define EAI_SYSTEM -1 /* value doesn't matter */
58 /* Must include <sys/stat.h> because of 'stat' define below. */
61 /* Missing in several .c files. Include here. */
64 /* Apparently needed for alloca(). */
68 # define S_ISDIR(m) (((m) & (_S_IFMT)) == (_S_IFDIR))
74 /* We have strcasecmp and strncasecmp, just under a different name. */
75 #define strcasecmp stricmp
76 #define strncasecmp strnicmp
78 /* The same for snprintf() and vsnprintf(). */
79 #define snprintf _snprintf
80 #define vsnprintf _vsnprintf
82 /* No stat on Windows. */
85 #define PATH_SEPARATOR '\\'
87 /* Microsoft says stat is _stat, Borland doesn't */
93 /* Microsoft VC supports _isatty; Borland ? */
95 # 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 /* #### Do we need this? */
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: */
117 #define EWOULDBLOCK WSAEWOULDBLOCK
118 #define EINPROGRESS WSAEINPROGRESS
119 #define EALREADY WSAEALREADY
120 #define ENOTSOCK WSAENOTSOCK
121 #define EDESTADDRREQ WSAEDESTADDRREQ
122 #define EMSGSIZE WSAEMSGSIZE
123 #define EPROTOTYPE WSAEPROTOTYPE
124 #define ENOPROTOOPT WSAENOPROTOOPT
125 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
126 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
127 #define EOPNOTSUPP WSAEOPNOTSUPP
128 #define EPFNOSUPPORT WSAEPFNOSUPPORT
129 #define EAFNOSUPPORT WSAEAFNOSUPPORT
130 #define EADDRINUSE WSAEADDRINUSE
131 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
132 #define ENETDOWN WSAENETDOWN
133 #define ENETUNREACH WSAENETUNREACH
134 #define ENETRESET WSAENETRESET
135 #define ECONNABORTED WSAECONNABORTED
136 #define ECONNRESET WSAECONNRESET
137 #define ENOBUFS WSAENOBUFS
138 #define EISCONN WSAEISCONN
139 #define ENOTCONN WSAENOTCONN
140 #define ESHUTDOWN WSAESHUTDOWN
141 #define ETOOMANYREFS WSAETOOMANYREFS
142 #define ETIMEDOUT WSAETIMEDOUT
143 #define ECONNREFUSED WSAECONNREFUSED
144 #define ELOOP WSAELOOP
145 #define EHOSTDOWN WSAEHOSTDOWN
146 #define EHOSTUNREACH WSAEHOSTUNREACH
147 #define EPROCLIM WSAEPROCLIM
148 #define EUSERS WSAEUSERS
149 #define EDQUOT WSAEDQUOT
150 #define ESTALE WSAESTALE
151 #define EREMOTE WSAEREMOTE
153 /* Public functions. */
156 unsigned int sleep (unsigned);
159 int usleep (unsigned long);
162 void ws_startup (void);
163 void ws_changetitle (const char*, int);
164 void ws_percenttitle (double);
165 char *ws_mypath (void);
166 void ws_help (const char *);
167 void windows_main_junk (int *, char **, char **);
169 /* Things needed for IPv6; missing in <ws2tcpip.h>. */
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);
177 #endif /* ENABLE_IPV6 */
179 #endif /* MSWINDOWS_H */