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 /* #### Do we need this? */
104 /* Windows compilers accept only one arg to mkdir. */
106 # define mkdir(a, b) _mkdir(a)
107 #else /* __BORLANDC__ */
108 # define mkdir(a, b) mkdir(a)
109 #endif /* __BORLANDC__ */
111 /* Declarations of various socket errors: */
113 #define EWOULDBLOCK WSAEWOULDBLOCK
114 #define EINPROGRESS WSAEINPROGRESS
115 #define EALREADY WSAEALREADY
116 #define ENOTSOCK WSAENOTSOCK
117 #define EDESTADDRREQ WSAEDESTADDRREQ
118 #define EMSGSIZE WSAEMSGSIZE
119 #define EPROTOTYPE WSAEPROTOTYPE
120 #define ENOPROTOOPT WSAENOPROTOOPT
121 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
122 #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
123 #define EOPNOTSUPP WSAEOPNOTSUPP
124 #define EPFNOSUPPORT WSAEPFNOSUPPORT
125 #define EAFNOSUPPORT WSAEAFNOSUPPORT
126 #define EADDRINUSE WSAEADDRINUSE
127 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
128 #define ENETDOWN WSAENETDOWN
129 #define ENETUNREACH WSAENETUNREACH
130 #define ENETRESET WSAENETRESET
131 #define ECONNABORTED WSAECONNABORTED
132 #define ECONNRESET WSAECONNRESET
133 #define ENOBUFS WSAENOBUFS
134 #define EISCONN WSAEISCONN
135 #define ENOTCONN WSAENOTCONN
136 #define ESHUTDOWN WSAESHUTDOWN
137 #define ETOOMANYREFS WSAETOOMANYREFS
138 #define ETIMEDOUT WSAETIMEDOUT
139 #define ECONNREFUSED WSAECONNREFUSED
140 #define ELOOP WSAELOOP
141 #define EHOSTDOWN WSAEHOSTDOWN
142 #define EHOSTUNREACH WSAEHOSTUNREACH
143 #define EPROCLIM WSAEPROCLIM
144 #define EUSERS WSAEUSERS
145 #define EDQUOT WSAEDQUOT
146 #define ESTALE WSAESTALE
147 #define EREMOTE WSAEREMOTE
149 /* Public functions. */
152 unsigned int sleep (unsigned);
155 int usleep (unsigned long);
158 void ws_startup (void);
159 void ws_changetitle (const char*, int);
160 void ws_percenttitle (double);
161 char *ws_mypath (void);
162 void ws_help (const char *);
163 void windows_main_junk (int *, char **, char **);
165 /* Things needed for IPv6; missing in <ws2tcpip.h>. */
168 extern const char *inet_ntop (int af, const void *src, char *dst, size_t size);
171 extern int inet_pton (int af, const char *src, void *dst);
173 #endif /* ENABLE_IPV6 */
175 #endif /* MSWINDOWS_H */