114
# define READ(fd, buf, cnt) recv((fd), (buf), (cnt), 0)
115
# define WRITE(fd, buf, cnt) send((fd), (buf), (cnt), 0)
118
/* mswindows.h defines these. */
120
# define READ(fd, buf, cnt) read ((fd), (buf), (cnt))
123
# define WRITE(fd, buf, cnt) write ((fd), (buf), (cnt))
126
# define REALCLOSE(x) close (x)
132
DEBUGP (("Closing fd %d\n", x)); \
135
111
/* Define a large integral type useful for storing large sizes that
136
112
exceed sizes of one download, such as when printing the sum of all
137
113
downloads. Note that this has nothing to do with large file
114
support, which determines the wgint type. This should be as large
115
as possible even on systems where when wgint is 32-bit; also,
116
unlike wgint, this can be a floating point type.
140
118
We use a 64-bit integral type where available, `double' otherwise.
141
119
It's hard to print LARGE_INT's portably, but fortunately it's
151
129
typedef long long LARGE_INT;
152
130
# define LARGE_INT_FMT "%lld"
133
/* Use __int64 under Windows. */
134
typedef __int64 LARGE_INT;
135
# define LARGE_INT_FMT "%I64"
154
137
/* Large integer type unavailable; use `double' instead. */
155
138
typedef double LARGE_INT;
156
# define LARGE_INT_FMT "%.0f"
139
# define LARGE_INT_FMT "%.0f"
144
/* Under Windows we #define struct_stat to struct _stati64. */
146
# define struct_stat struct stat
158
# define LONG_MAX ((long) ~((unsigned long)1 << (CHAR_BIT * sizeof (long) - 1)))
161
# define LLONG_MAX ((long long) ~((unsigned long long)1 << (CHAR_BIT * sizeof (long long) - 1)))
160
164
/* These are defined in cmpt.c if missing, therefore it's generally
161
165
safe to declare their parameters. */
162
166
#ifndef HAVE_STRERROR
256
/* Provide sig_atomic_t if the system doesn't. */
257
#ifndef HAVE_SIG_ATOMIC_T
258
typedef int sig_atomic_t;
255
261
/* Provide uint32_t on the platforms that don't define it. Although
256
262
most code should be agnostic about integer sizes, some code really
257
263
does need a 32-bit integral type. Such code should use uint32_t.