~ubuntu-branches/ubuntu/precise/wget/precise-proposed

« back to all changes in this revision

Viewing changes to src/mswindows.h

  • Committer: Bazaar Package Importer
  • Author(s): Noèl Köthe
  • Date: 2005-06-26 16:46:25 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050626164625-jjcde8hyztx7xq7o
Tags: 1.10-2
* wget-fix_error--save-headers patch from upstream
  (closes: Bug#314728)
* don't pattern-match server redirects patch from upstream
  (closes: Bug#163243)
* correct de.po typos
  (closes: Bug#313883)
* wget-E_html_behind_file_counting fix problem with adding the
  numbers after the html extension
* updated Standards-Version: to 3.6.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Declarations for windows
2
 
   Copyright (C) 1995, 1997, 1997, 1998 Free Software Foundation, Inc.
 
2
   Copyright (C) 1995, 1997, 1997, 1998, 2004
 
3
   Free Software Foundation, Inc.
3
4
 
4
5
This file is part of GNU Wget.
5
6
 
34
35
#error Include mswindows.h inside or after "wget.h"
35
36
#endif
36
37
 
 
38
/* Prevent inclusion of <winsock*.h> in <windows.h>.  */
37
39
#ifndef WIN32_LEAN_AND_MEAN
38
 
#define WIN32_LEAN_AND_MEAN  /* Prevent inclusion of <winsock*.h> in <windows.h> */
 
40
#define WIN32_LEAN_AND_MEAN
39
41
#endif
40
42
 
41
43
#include <windows.h>
42
44
 
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
45
 
 * <ws2tcpip.h>
46
 
 */
 
45
/* Use the correct winsock header; <ws2tcpip.h> includes <winsock2.h> only
 
46
   on Watcom/MingW.  We cannot use <winsock.h> for IPv6.  Using
 
47
   getaddrinfo() requires <ws2tcpip.h>.  */
47
48
#if defined(ENABLE_IPV6) || defined(HAVE_GETADDRINFO)
48
49
# include <winsock2.h>
49
50
# include <ws2tcpip.h>
55
56
# define EAI_SYSTEM -1   /* value doesn't matter */
56
57
#endif
57
58
 
58
 
/* Must include <sys/stat.h> because of 'stat' define below. */
 
59
/* Must include <sys/stat.h> because of 'stat' define below.  */
59
60
#include <sys/stat.h>
60
61
 
61
 
/* Missing in several .c files. Include here. */
 
62
/* Missing in several .c files.  Include here.  */
62
63
#include <io.h>
63
64
 
64
 
/* Apparently needed for alloca(). */
 
65
/* Apparently needed for alloca().  */
65
66
#include <malloc.h>
66
67
 
67
68
#ifndef S_ISDIR
71
72
# define S_ISLNK(a) 0
72
73
#endif
73
74
 
74
 
/* We have strcasecmp and strncasecmp, just under a different name. */
 
75
/* We have strcasecmp and strncasecmp, just under a different name.  */
75
76
#define strcasecmp stricmp
76
77
#define strncasecmp strnicmp
77
78
 
79
80
#define snprintf _snprintf
80
81
#define vsnprintf _vsnprintf
81
82
 
82
 
/* No stat on Windows.  */
 
83
/* Define a wgint type under Windows. */
 
84
typedef __int64 wgint;
 
85
#define SIZEOF_WGINT 8
 
86
 
 
87
#ifdef __GNUC__
 
88
#define WGINT_MAX 9223372036854775807LL
 
89
#else
 
90
#define WGINT_MAX 9223372036854775807I64
 
91
#endif
 
92
 
 
93
#define str_to_wgint str_to_int64
 
94
__int64 str_to_int64 (const char *, char **, int);
 
95
 
 
96
/* No lstat on Windows.  */
83
97
#define lstat stat
84
98
 
 
99
/* Transparently support large files, in spirit similar to the POSIX
 
100
   LFS API.  */
 
101
#define stat(fname, buf) _stati64 (fname, buf)
 
102
 
 
103
#ifndef __BORLANDC__
 
104
# define fstat(fd, buf) _fstati64 (fd, buf)
 
105
#endif
 
106
 
 
107
#if defined(_MSC_VER) || defined(__MINGW32__)
 
108
# define struct_stat struct _stati64
 
109
#elif defined(__BORLANDC__)
 
110
# define struct_stat struct stati64
 
111
#else
 
112
# define struct_stat struct stat
 
113
#endif
 
114
 
85
115
#define PATH_SEPARATOR '\\'
86
116
 
87
 
/* Microsoft says stat is _stat, Borland doesn't */
88
 
#ifdef _MSC_VER
89
 
# define stat _stat
90
 
#endif
91
 
 
92
117
#ifdef HAVE_ISATTY
93
 
/* Microsoft VC supports _isatty; Borland ? */
94
118
#ifdef _MSC_VER
95
119
# define isatty _isatty
96
120
#endif
97
121
#endif
98
122
 
99
 
#define REALCLOSE(x) closesocket (x)
100
 
 
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)
104
 
 
105
123
/* #### Do we need this?  */
106
124
#include <direct.h>
107
125
 
108
 
/* Windows compilers accept only one arg to mkdir. */
109
 
#ifndef __BORLANDC__
110
 
# define mkdir(a, b) _mkdir(a)
111
 
#else  /* __BORLANDC__ */
112
 
# define mkdir(a, b) mkdir(a)
113
 
#endif /* __BORLANDC__ */
114
 
 
115
 
/* Declarations of various socket errors: */
 
126
/* Windows compilers accept only one arg to mkdir.  */
 
127
#define mkdir(a, b) _mkdir(a)
 
128
 
 
129
#ifndef INHIBIT_WRAP
 
130
 
 
131
/* Winsock functions don't set errno, so we provide wrappers
 
132
   that do. */
 
133
 
 
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
 
144
 
 
145
#endif /* not INHIBIT_WRAP */
 
146
 
 
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);
 
157
 
 
158
/* Finally, provide a private version of strerror that does the
 
159
   right thing with Winsock errors. */
 
160
#ifndef INHIBIT_WRAP
 
161
# define strerror windows_strerror
 
162
#endif
 
163
const char *windows_strerror (int);
 
164
 
 
165
/* Declarations of various socket errors:  */
116
166
 
117
167
#define EWOULDBLOCK             WSAEWOULDBLOCK
118
168
#define EINPROGRESS             WSAEINPROGRESS
152
202
 
153
203
/* Public functions.  */
154
204
 
155
 
#ifndef HAVE_SLEEP
156
 
unsigned int sleep (unsigned);
157
 
#endif
158
 
#ifndef HAVE_USLEEP
159
 
int usleep (unsigned long);
160
 
#endif
161
 
 
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 **);
168
210
 
169
 
/* Things needed for IPv6; missing in <ws2tcpip.h>. */
 
211
/* Things needed for IPv6; missing in <ws2tcpip.h>.  */
170
212
#ifdef ENABLE_IPV6
171
 
# ifndef HAVE_NTOP
172
 
  extern const char *inet_ntop (int af, const void *src, char *dst, size_t size);
173
 
# endif
174
 
# ifndef HAVE_PTON
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);
176
215
# endif
177
216
#endif /* ENABLE_IPV6 */
178
217