]> sjero.net Git - wget/blob - src/mswindows.h
[svn] Fixes to support out of the box compilation on various Windows compilers.
[wget] / src / mswindows.h
1 /* Declarations for windows
2    Copyright (C) 1995, 1997, 1997, 1998 Free Software Foundation, Inc.
3
4 This file is part of GNU Wget.
5
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.
10
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.
15
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.
19
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.  */
29
30 #ifndef MSWINDOWS_H
31 #define MSWINDOWS_H
32
33 /* Apparently needed for alloca(). */
34 #include <malloc.h>
35
36 #ifndef S_ISDIR
37 # define S_ISDIR(m) (((m) & (_S_IFMT)) == (_S_IFDIR))
38 #endif
39 #ifndef S_ISLNK
40 # define S_ISLNK(a) 0
41 #endif
42
43 /* We have strcasecmp and strncasecmp, just under a different name. */
44 #define strcasecmp stricmp
45 #define strncasecmp strnicmp
46
47 /* The same for snprintf() and vsnprintf().  */
48 #define snprintf _snprintf
49 #define vsnprintf _vsnprintf
50
51 /* No stat on Windows.  */
52 #define lstat stat
53
54 #define PATH_SEPARATOR '\\'
55
56 /* Microsoft says stat is _stat, Borland doesn't */
57 #ifdef _MSC_VER
58 # define stat _stat
59 #endif
60
61 #ifdef HAVE_ISATTY
62 /* Microsoft VC supports _isatty; Borland ? */
63 #ifdef _MSC_VER
64 # define isatty _isatty
65 #endif
66 #endif
67
68 /* Use ANSI-style stdargs regardless of whether the compiler bothers
69    to define __STDC__.  (Many don't when extensions are enabled.)  */
70 #define WGET_USE_STDARG
71
72 #define REALCLOSE(x) closesocket (x)
73
74 /* read & write don't work with sockets on Windows 95.  */
75 #define READ(fd, buf, cnt) recv ((fd), (buf), (cnt), 0)
76 #define WRITE(fd, buf, cnt) send ((fd), (buf), (cnt), 0)
77
78 /* #### Do we need this?  */
79 #include <direct.h>
80
81 /* Windows compilers accept only one arg to mkdir. */
82 #ifndef __BORLANDC__
83 # define mkdir(a, b) _mkdir(a)
84 #else  /* __BORLANDC__ */
85 # define mkdir(a, b) mkdir(a)
86 #endif /* __BORLANDC__ */
87
88 #include <windows.h>
89
90 /* Declarations of various socket errors: */
91
92 #define EWOULDBLOCK             WSAEWOULDBLOCK
93 #define EINPROGRESS             WSAEINPROGRESS
94 #define EALREADY                WSAEALREADY
95 #define ENOTSOCK                WSAENOTSOCK
96 #define EDESTADDRREQ            WSAEDESTADDRREQ
97 #define EMSGSIZE                WSAEMSGSIZE
98 #define EPROTOTYPE              WSAEPROTOTYPE
99 #define ENOPROTOOPT             WSAENOPROTOOPT
100 #define EPROTONOSUPPORT         WSAEPROTONOSUPPORT
101 #define ESOCKTNOSUPPORT         WSAESOCKTNOSUPPORT
102 #define EOPNOTSUPP              WSAEOPNOTSUPP
103 #define EPFNOSUPPORT            WSAEPFNOSUPPORT
104 #define EAFNOSUPPORT            WSAEAFNOSUPPORT
105 #define EADDRINUSE              WSAEADDRINUSE
106 #define EADDRNOTAVAIL           WSAEADDRNOTAVAIL
107 #define ENETDOWN                WSAENETDOWN
108 #define ENETUNREACH             WSAENETUNREACH
109 #define ENETRESET               WSAENETRESET
110 #define ECONNABORTED            WSAECONNABORTED
111 #define ECONNRESET              WSAECONNRESET
112 #define ENOBUFS                 WSAENOBUFS
113 #define EISCONN                 WSAEISCONN
114 #define ENOTCONN                WSAENOTCONN
115 #define ESHUTDOWN               WSAESHUTDOWN
116 #define ETOOMANYREFS            WSAETOOMANYREFS
117 #define ETIMEDOUT               WSAETIMEDOUT
118 #define ECONNREFUSED            WSAECONNREFUSED
119 #define ELOOP                   WSAELOOP
120 #define EHOSTDOWN               WSAEHOSTDOWN
121 #define EHOSTUNREACH            WSAEHOSTUNREACH
122 #define EPROCLIM                WSAEPROCLIM
123 #define EUSERS                  WSAEUSERS
124 #define EDQUOT                  WSAEDQUOT
125 #define ESTALE                  WSAESTALE
126 #define EREMOTE                 WSAEREMOTE
127
128 #ifdef __DMC__
129 # define HAVE_SLEEP 1
130 # define HAVE_USLEEP 1
131 #endif
132
133 /* Public functions.  */
134
135 #ifndef HAVE_SLEEP
136 unsigned int sleep (unsigned);
137 #endif
138 #ifndef HAVE_USLEEP
139 int usleep (unsigned long);
140 #endif
141
142 void ws_startup (void);
143 void ws_changetitle (char*, int);
144 char *ws_mypath (void);
145 void ws_help (const char *);
146 void windows_main_junk (int *, char **, char **);
147
148 #endif /* MSWINDOWS_H */