diff options
Diffstat (limited to 'src/include/plibc/plibc.h')
-rw-r--r-- | src/include/plibc/plibc.h | 457 |
1 files changed, 287 insertions, 170 deletions
diff --git a/src/include/plibc/plibc.h b/src/include/plibc/plibc.h index 5b964080..d40a31e5 100644 --- a/src/include/plibc/plibc.h +++ b/src/include/plibc/plibc.h | |||
@@ -18,11 +18,11 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * @file plibc.h | 21 | * @file include/plibc.h |
22 | * @brief PlibC header | 22 | * @brief PlibC header |
23 | * @attention This file is usually not installed under Unix, | 23 | * @attention This file is usually not installed under Unix, |
24 | * so ship it with your application | 24 | * so ship it with your application |
25 | * @version $Revision: 87 $ | 25 | * @version $Revision$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef _PLIBC_H_ | 28 | #ifndef _PLIBC_H_ |
@@ -70,7 +70,7 @@ extern "C" { | |||
70 | /* Convert LARGE_INTEGER to double */ | 70 | /* Convert LARGE_INTEGER to double */ |
71 | #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ | 71 | #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \ |
72 | (double)((x).LowPart)) | 72 | (double)((x).LowPart)) |
73 | #ifndef __MINGW64__ | 73 | #ifndef __MINGW64_VERSION_MAJOR |
74 | struct stat64 | 74 | struct stat64 |
75 | { | 75 | { |
76 | _dev_t st_dev; | 76 | _dev_t st_dev; |
@@ -120,101 +120,254 @@ enum | |||
120 | #endif | 120 | #endif |
121 | 121 | ||
122 | /* Thanks to the Cygwin project */ | 122 | /* Thanks to the Cygwin project */ |
123 | #define ENOCSI 43 /* No CSI structure available */ | 123 | #if !defined(ENOCSI) |
124 | #define EL2HLT 44 /* Level 2 halted */ | 124 | # define ENOCSI 43 /* No CSI structure available */ |
125 | #ifndef EDEADLK | 125 | #endif |
126 | #define EDEADLK 45 /* Deadlock condition */ | 126 | #if !defined(EL2HLT) |
127 | #endif | 127 | # define EL2HLT 44 /* Level 2 halted */ |
128 | #ifndef ENOLCK | 128 | #endif |
129 | #define ENOLCK 46 /* No record locks available */ | 129 | #if !defined(EDEADLK) |
130 | #endif | 130 | # define EDEADLK 45 /* Deadlock condition */ |
131 | #define EBADE 50 /* Invalid exchange */ | 131 | #endif |
132 | #define EBADR 51 /* Invalid request descriptor */ | 132 | #if !defined(ENOLCK) |
133 | #define EXFULL 52 /* Exchange full */ | 133 | # define ENOLCK 46 /* No record locks available */ |
134 | #define ENOANO 53 /* No anode */ | 134 | #endif |
135 | #define EBADRQC 54 /* Invalid request code */ | 135 | #if !defined(EBADE) |
136 | #define EBADSLT 55 /* Invalid slot */ | 136 | # define EBADE 50 /* Invalid exchange */ |
137 | #ifndef EDEADLOCK | 137 | #endif |
138 | #define EDEADLOCK EDEADLK /* File locking deadlock error */ | 138 | #if !defined(EBADR) |
139 | #endif | 139 | # define EBADR 51 /* Invalid request descriptor */ |
140 | #define EBFONT 57 /* Bad font file fmt */ | 140 | #endif |
141 | #define ENOSTR 60 /* Device not a stream */ | 141 | #if !defined(EXFULL) |
142 | #define ENODATA 61 /* No data (for no delay io) */ | 142 | # define EXFULL 52 /* Exchange full */ |
143 | #define ETIME 62 /* Timer expired */ | 143 | #endif |
144 | #define ENOSR 63 /* Out of streams resources */ | 144 | #if !defined(ENOANO) |
145 | #define ENONET 64 /* Machine is not on the network */ | 145 | # define ENOANO 53 /* No anode */ |
146 | #define ENOPKG 65 /* Package not installed */ | 146 | #endif |
147 | #define EREMOTE 66 /* The object is remote */ | 147 | #if !defined(EBADRQC) |
148 | #define ENOLINK 67 /* The link has been severed */ | 148 | # define EBADRQC 54 /* Invalid request code */ |
149 | #define EADV 68 /* Advertise error */ | 149 | #endif |
150 | #define ESRMNT 69 /* Srmount error */ | 150 | #if !defined(EBADSLT) |
151 | #define ECOMM 70 /* Communication error on send */ | 151 | # define EBADSLT 55 /* Invalid slot */ |
152 | #define EPROTO 71 /* Protocol error */ | 152 | #endif |
153 | #define EMULTIHOP 74 /* Multihop attempted */ | 153 | #if !defined(EDEADLOCK) |
154 | #define ELBIN 75 /* Inode is remote (not really error) */ | 154 | # define EDEADLOCK EDEADLK /* File locking deadlock error */ |
155 | #define EDOTDOT 76 /* Cross mount point (not really error) */ | 155 | #endif |
156 | #define EBADMSG 77 /* Trying to read unreadable message */ | 156 | #if !defined(EBFONT) |
157 | #define ENOTUNIQ 80 /* Given log. name not unique */ | 157 | # define EBFONT 57 /* Bad font file fmt */ |
158 | #define EBADFD 81 /* f.d. invalid for this operation */ | 158 | #endif |
159 | #define EREMCHG 82 /* Remote address changed */ | 159 | #if !defined(ENOSTR) |
160 | #define ELIBACC 83 /* Can't access a needed shared lib */ | 160 | # define ENOSTR 60 /* Device not a stream */ |
161 | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ | 161 | #endif |
162 | #define ELIBSCN 85 /* .lib section in a.out corrupted */ | 162 | #if !defined(ENODATA) |
163 | #define ELIBMAX 86 /* Attempting to link in too many libs */ | 163 | # define ENODATA 61 /* No data (for no delay io) */ |
164 | #define ELIBEXEC 87 /* Attempting to exec a shared library */ | 164 | #endif |
165 | #ifndef ENOSYS | 165 | #if !defined(ETIME) |
166 | #define ENOSYS 88 /* Function not implemented */ | 166 | # define ETIME 62 /* Timer expired */ |
167 | #endif | 167 | #endif |
168 | #define ENMFILE 89 /* No more files */ | 168 | #if !defined(ENOSR) |
169 | #ifndef ENOTEMPTY | 169 | # define ENOSR 63 /* Out of streams resources */ |
170 | #define ENOTEMPTY 90 /* Directory not empty */ | 170 | #endif |
171 | #endif | 171 | #if !defined(ENONET) |
172 | #ifndef ENAMETOOLONG | 172 | # define ENONET 64 /* Machine is not on the network */ |
173 | #define ENAMETOOLONG 91 /* File or path name too long */ | 173 | #endif |
174 | #endif | 174 | #if !defined(ENOPKG) |
175 | #define ELOOP 92 /* Too many symbolic links */ | 175 | # define ENOPKG 65 /* Package not installed */ |
176 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ | 176 | #endif |
177 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ | 177 | #if !defined(EREMOTE) |
178 | #define ECONNRESET 104 /* Connection reset by peer */ | 178 | # define EREMOTE 66 /* The object is remote */ |
179 | #define ENOBUFS 105 /* No buffer space available */ | 179 | #endif |
180 | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ | 180 | #if !defined(ENOLINK) |
181 | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ | 181 | # define ENOLINK 67 /* The link has been severed */ |
182 | #define ENOTSOCK 108 /* Socket operation on non-socket */ | 182 | #endif |
183 | #define ENOPROTOOPT 109 /* Protocol not available */ | 183 | #if !defined(EADV) |
184 | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ | 184 | # define EADV 68 /* Advertise error */ |
185 | #define ECONNREFUSED 111 /* Connection refused */ | 185 | #endif |
186 | #define EADDRINUSE 112 /* Address already in use */ | 186 | #if !defined(ESRMNT) |
187 | #define ECONNABORTED 113 /* Connection aborted */ | 187 | # define ESRMNT 69 /* Srmount error */ |
188 | #define ENETUNREACH 114 /* Network is unreachable */ | 188 | #endif |
189 | #define ENETDOWN 115 /* Network interface is not configured */ | 189 | #if !defined(ECOMM) |
190 | #ifndef ETIMEDOUT | 190 | # define ECOMM 70 /* Communication error on send */ |
191 | #define ETIMEDOUT 116 /* Connection timed out */ | 191 | #endif |
192 | #endif | 192 | #if !defined(EMULTIHOP) |
193 | #define EHOSTDOWN 117 /* Host is down */ | 193 | # define EMULTIHOP 74 /* Multihop attempted */ |
194 | #define EHOSTUNREACH 118 /* Host is unreachable */ | 194 | #endif |
195 | #define EINPROGRESS 119 /* Connection already in progress */ | 195 | #if !defined(ELBIN) |
196 | #define EALREADY 120 /* Socket already connected */ | 196 | # define ELBIN 75 /* Inode is remote (not really error) */ |
197 | #define EDESTADDRREQ 121 /* Destination address required */ | 197 | #endif |
198 | #define EMSGSIZE 122 /* Message too long */ | 198 | #if !defined(EDOTDOT) |
199 | #define EPROTONOSUPPORT 123 /* Unknown protocol */ | 199 | # define EDOTDOT 76 /* Cross mount point (not really error) */ |
200 | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ | 200 | #endif |
201 | #define EADDRNOTAVAIL 125 /* Address not available */ | 201 | #if !defined(EBADMSG) |
202 | #define ENETRESET 126 /* Connection aborted by network */ | 202 | # define EBADMSG 77 /* Trying to read unreadable message */ |
203 | #define EISCONN 127 /* Socket is already connected */ | 203 | #endif |
204 | #define ENOTCONN 128 /* Socket is not connected */ | 204 | #if !defined(ENOTUNIQ) |
205 | #define ETOOMANYREFS 129 /* Too many references: cannot splice */ | 205 | # define ENOTUNIQ 80 /* Given log. name not unique */ |
206 | #define EPROCLIM 130 /* Too many processes */ | 206 | #endif |
207 | #define EUSERS 131 /* Too many users */ | 207 | #if !defined(EBADFD) |
208 | #define EDQUOT 132 /* Disk quota exceeded */ | 208 | # define EBADFD 81 /* f.d. invalid for this operation */ |
209 | #define ESTALE 133 /* Unknown error */ | 209 | #endif |
210 | #ifndef ENOTSUP | 210 | #if !defined(EREMCHG) |
211 | #define ENOTSUP 134 /* Not supported */ | 211 | # define EREMCHG 82 /* Remote address changed */ |
212 | #endif | 212 | #endif |
213 | #define ENOMEDIUM 135 /* No medium (in tape drive) */ | 213 | #if !defined(ELIBACC) |
214 | #define ENOSHARE 136 /* No such host or network path */ | 214 | # define ELIBACC 83 /* Can't access a needed shared lib */ |
215 | #define ECASECLASH 137 /* Filename exists with different case */ | 215 | #endif |
216 | #define EWOULDBLOCK EAGAIN /* Operation would block */ | 216 | #if !defined(ELIBBAD) |
217 | #define EOVERFLOW 139 /* Value too large for defined data type */ | 217 | # define ELIBBAD 84 /* Accessing a corrupted shared lib */ |
218 | #endif | ||
219 | #if !defined(ELIBSCN) | ||
220 | # define ELIBSCN 85 /* .lib section in a.out corrupted */ | ||
221 | #endif | ||
222 | #if !defined(ELIBMAX) | ||
223 | # define ELIBMAX 86 /* Attempting to link in too many libs */ | ||
224 | #endif | ||
225 | #if !defined(ELIBEXEC) | ||
226 | # define ELIBEXEC 87 /* Attempting to exec a shared library */ | ||
227 | #endif | ||
228 | #if !defined(ENOSYS) | ||
229 | # define ENOSYS 88 /* Function not implemented */ | ||
230 | #endif | ||
231 | #if !defined(ENMFILE) | ||
232 | # define ENMFILE 89 /* No more files */ | ||
233 | #endif | ||
234 | #if !defined(ENOTEMPTY) | ||
235 | # define ENOTEMPTY 90 /* Directory not empty */ | ||
236 | #endif | ||
237 | #if !defined(ENAMETOOLONG) | ||
238 | # define ENAMETOOLONG 91 /* File or path name too long */ | ||
239 | #endif | ||
240 | #if !defined(EPFNOSUPPORT) | ||
241 | # define EPFNOSUPPORT 96 /* Protocol family not supported */ | ||
242 | #endif | ||
243 | #if !defined(ENOSHARE) | ||
244 | # define ENOSHARE 97 /* No such host or network path */ | ||
245 | #endif | ||
246 | #if !defined(ENOMEDIUM) | ||
247 | # define ENOMEDIUM 98 /* No medium (in tape drive) */ | ||
248 | #endif | ||
249 | #if !defined(ESHUTDOWN) | ||
250 | # define ESHUTDOWN 99 /* Can't send after socket shutdown */ | ||
251 | #endif | ||
252 | #if !defined(EADDRINUSE) | ||
253 | # define EADDRINUSE 100 /* Address already in use */ | ||
254 | #endif | ||
255 | #if !defined(EADDRNOTAVAIL) | ||
256 | # define EADDRNOTAVAIL 101 /* Address not available */ | ||
257 | #endif | ||
258 | #if !defined(EAFNOSUPPORT) | ||
259 | # define EAFNOSUPPORT 102 /* Address family not supported by protocol family */ | ||
260 | #endif | ||
261 | #if !defined(EALREADY) | ||
262 | # define EALREADY 103 /* Socket already connected */ | ||
263 | #endif | ||
264 | #if !defined(ECANCELED) | ||
265 | # define ECANCELED 105 /* Connection cancelled */ | ||
266 | #endif | ||
267 | #if !defined(ECONNABORTED) | ||
268 | # define ECONNABORTED 106 /* Connection aborted */ | ||
269 | #endif | ||
270 | #if !defined(ECONNREFUSED) | ||
271 | # define ECONNREFUSED 107 /* Connection refused */ | ||
272 | #endif | ||
273 | #if !defined(ECONNRESET) | ||
274 | # define ECONNRESET 108 /* Connection reset by peer */ | ||
275 | #endif | ||
276 | #if !defined(EDESTADDRREQ) | ||
277 | # define EDESTADDRREQ 109 /* Destination address required */ | ||
278 | #endif | ||
279 | #if !defined(EHOSTUNREACH) | ||
280 | # define EHOSTUNREACH 110 /* Host is unreachable */ | ||
281 | #endif | ||
282 | #if !defined(ECONNABORTED) | ||
283 | # define ECONNABORTED 111 /* Connection aborted */ | ||
284 | #endif | ||
285 | #if !defined(EINPROGRESS) | ||
286 | # define EINPROGRESS 112 /* Connection already in progress */ | ||
287 | #endif | ||
288 | #if !defined(EISCONN) | ||
289 | # define EISCONN 113 /* Socket is already connected */ | ||
290 | #endif | ||
291 | #if !defined(ELOOP) | ||
292 | # define ELOOP 114 /* Too many symbolic links */ | ||
293 | #endif | ||
294 | #if !defined(EMSGSIZE) | ||
295 | # define EMSGSIZE 115 /* Message too long */ | ||
296 | #endif | ||
297 | #if !defined(ENETDOWN) | ||
298 | # define ENETDOWN 116 /* Network interface is not configured */ | ||
299 | #endif | ||
300 | #if !defined(ENETRESET) | ||
301 | # define ENETRESET 117 /* Connection aborted by network */ | ||
302 | #endif | ||
303 | #if !defined(ENETUNREACH) | ||
304 | # define ENETUNREACH 118 /* Network is unreachable */ | ||
305 | #endif | ||
306 | #if !defined(ENOBUFS) | ||
307 | # define ENOBUFS 119 /* No buffer space available */ | ||
308 | #endif | ||
309 | #if !defined(EHOSTDOWN) | ||
310 | # define EHOSTDOWN 120 /* Host is down */ | ||
311 | #endif | ||
312 | #if !defined(EPROCLIM) | ||
313 | # define EPROCLIM 121 /* Too many processes */ | ||
314 | #endif | ||
315 | #if !defined(EDQUOT) | ||
316 | # define EDQUOT 122 /* Disk quota exceeded */ | ||
317 | #endif | ||
318 | #if !defined(ENOPROTOOPT) | ||
319 | # define ENOPROTOOPT 123 /* Protocol not available */ | ||
320 | #endif | ||
321 | #if !defined(ESOCKTNOSUPPORT) | ||
322 | # define ESOCKTNOSUPPORT 124 /* Socket type not supported */ | ||
323 | #endif | ||
324 | #if !defined(ESTALE) | ||
325 | # define ESTALE 125 /* Unknown error */ | ||
326 | #endif | ||
327 | #if !defined(ENOTCONN) | ||
328 | # define ENOTCONN 126 /* Socket is not connected */ | ||
329 | #endif | ||
330 | #if !defined(ETOOMANYREFS) | ||
331 | # define ETOOMANYREFS 127 /* Too many references: cannot splice */ | ||
332 | #endif | ||
333 | #if !defined(ENOTSOCK) | ||
334 | # define ENOTSOCK 128 /* Socket operation on non-socket */ | ||
335 | #endif | ||
336 | #if !defined(ENOTSUP) | ||
337 | # define ENOTSUP 129 /* Not supported */ | ||
338 | #endif | ||
339 | #if !defined(EOPNOTSUPP) | ||
340 | # define EOPNOTSUPP 130 /* Operation not supported on transport endpoint */ | ||
341 | #endif | ||
342 | #if !defined(EUSERS) | ||
343 | # define EUSERS 131 /* Too many users */ | ||
344 | #endif | ||
345 | #if !defined(EOVERFLOW) | ||
346 | # define EOVERFLOW 132 /* Value too large for defined data type */ | ||
347 | #endif | ||
348 | #if !defined(EOWNERDEAD) | ||
349 | # define EOWNERDEAD 133 /* Unknown error */ | ||
350 | #endif | ||
351 | #if !defined(EPROTO) | ||
352 | # define EPROTO 134 /* Protocol error */ | ||
353 | #endif | ||
354 | #if !defined(EPROTONOSUPPORT) | ||
355 | # define EPROTONOSUPPORT 135 /* Unknown protocol */ | ||
356 | #endif | ||
357 | #if !defined(EPROTOTYPE) | ||
358 | # define EPROTOTYPE 136 /* Protocol wrong type for socket */ | ||
359 | #endif | ||
360 | #if !defined(ECASECLASH) | ||
361 | # define ECASECLASH 137 /* Filename exists with different case */ | ||
362 | #endif | ||
363 | #if !defined(ETIMEDOUT) | ||
364 | /* Make sure it's the same as WSATIMEDOUT */ | ||
365 | # define ETIMEDOUT 138 /* Connection timed out */ | ||
366 | #endif | ||
367 | #if !defined(EWOULDBLOCK) || EWOULBLOCK == 140 | ||
368 | # undef EWOULDBLOCK /* MinGW-w64 defines it as 140, but we want it as EAGAIN */ | ||
369 | # define EWOULDBLOCK EAGAIN /* Operation would block */ | ||
370 | #endif | ||
218 | 371 | ||
219 | #undef HOST_NOT_FOUND | 372 | #undef HOST_NOT_FOUND |
220 | #define HOST_NOT_FOUND 1 | 373 | #define HOST_NOT_FOUND 1 |
@@ -251,9 +404,6 @@ struct statfs | |||
251 | long f_spare[6]; /* spare for later */ | 404 | long f_spare[6]; /* spare for later */ |
252 | }; | 405 | }; |
253 | 406 | ||
254 | extern const struct in6_addr in6addr_any; /* :: */ | ||
255 | extern const struct in6_addr in6addr_loopback; /* ::1 */ | ||
256 | |||
257 | /* Taken from the Wine project <http://www.winehq.org> | 407 | /* Taken from the Wine project <http://www.winehq.org> |
258 | /wine/include/winternl.h */ | 408 | /wine/include/winternl.h */ |
259 | enum SYSTEM_INFORMATION_CLASS | 409 | enum SYSTEM_INFORMATION_CLASS |
@@ -375,7 +525,6 @@ int inet_pton4(const char *src, u_char *dst, int pton); | |||
375 | #if USE_IPV6 | 525 | #if USE_IPV6 |
376 | int inet_pton6(const char *src, u_char *dst); | 526 | int inet_pton6(const char *src, u_char *dst); |
377 | #endif | 527 | #endif |
378 | int truncate(const char *fname, int distance); | ||
379 | int statfs(const char *path, struct statfs *buf); | 528 | int statfs(const char *path, struct statfs *buf); |
380 | const char *hstrerror(int err); | 529 | const char *hstrerror(int err); |
381 | int mkstemp(char *tmplate); | 530 | int mkstemp(char *tmplate); |
@@ -409,11 +558,12 @@ int _win_close(int fd); | |||
409 | int _win_creat(const char *path, mode_t mode); | 558 | int _win_creat(const char *path, mode_t mode); |
410 | char *_win_ctime(const time_t *clock); | 559 | char *_win_ctime(const time_t *clock); |
411 | char *_win_ctime_r(const time_t *clock, char *buf); | 560 | char *_win_ctime_r(const time_t *clock, char *buf); |
412 | int _win_fstat(int handle, struct stat *buffer); | 561 | int _win_fstat(int handle, struct _stat *buffer); |
413 | int _win_ftruncate(int fildes, off_t length); | 562 | int _win_ftruncate(int fildes, off_t length); |
414 | void _win_gettimeofday(struct timeval *tp, void *tzp); | 563 | int _win_truncate(const char *fname, int distance); |
415 | int _win_kill(pid_t pid, int sig); | 564 | int _win_kill(pid_t pid, int sig); |
416 | int _win_pipe(int *phandles); | 565 | int _win_pipe(int *phandles); |
566 | intptr_t _win_mkfifo(const char *path, mode_t mode); | ||
417 | int _win_rmdir(const char *path); | 567 | int _win_rmdir(const char *path); |
418 | int _win_access( const char *path, int mode ); | 568 | int _win_access( const char *path, int mode ); |
419 | int _win_chmod(const char *filename, int pmode); | 569 | int _win_chmod(const char *filename, int pmode); |
@@ -422,7 +572,7 @@ long _win_random(void); | |||
422 | void _win_srandom(unsigned int seed); | 572 | void _win_srandom(unsigned int seed); |
423 | int _win_remove(const char *path); | 573 | int _win_remove(const char *path); |
424 | int _win_rename(const char *oldname, const char *newname); | 574 | int _win_rename(const char *oldname, const char *newname); |
425 | int _win_stat(const char *path, struct stat *buffer); | 575 | int _win_stat(const char *path, struct _stat *buffer); |
426 | int _win_stat64(const char *path, struct stat64 *buffer); | 576 | int _win_stat64(const char *path, struct stat64 *buffer); |
427 | long _win_sysconf(int name); | 577 | long _win_sysconf(int name); |
428 | int _win_unlink(const char *filename); | 578 | int _win_unlink(const char *filename); |
@@ -435,54 +585,11 @@ void *_win_mmap(void *start, size_t len, int access, int flags, int fd, | |||
435 | unsigned long long offset); | 585 | unsigned long long offset); |
436 | int _win_msync(void *start, size_t length, int flags); | 586 | int _win_msync(void *start, size_t length, int flags); |
437 | int _win_munmap(void *start, size_t length); | 587 | int _win_munmap(void *start, size_t length); |
438 | int _win_lstat(const char *path, struct stat *buf); | 588 | int _win_lstat(const char *path, struct _stat *buf); |
439 | int _win_lstat64(const char *path, struct stat64 *buf); | 589 | int _win_lstat64(const char *path, struct stat64 *buf); |
440 | int _win_readlink(const char *path, char *buf, size_t bufsize); | 590 | int _win_readlink(const char *path, char *buf, size_t bufsize); |
441 | int _win_accept(int s, struct sockaddr *addr, int *addrlen); | 591 | int _win_accept(int s, struct sockaddr *addr, int *addrlen); |
442 | 592 | ||
443 | int _win_printf(const char *format,...); | ||
444 | int _win_wprintf(const wchar_t *format, ...); | ||
445 | |||
446 | int _win_fprintf(FILE *f,const char *format,...); | ||
447 | int _win_fwprintf(FILE *f,const wchar_t *format, ...); | ||
448 | |||
449 | int _win_vprintf(const char *format, va_list ap); | ||
450 | int _win_vfwprintf(FILE *stream, const wchar_t *format, va_list arg_ptr); | ||
451 | |||
452 | int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr); | ||
453 | int _win_vwprintf(const wchar_t *format, va_list ap); | ||
454 | |||
455 | int _win_vsprintf(char *dest,const char *format, va_list arg_ptr); | ||
456 | int _win_vswprintf(wchar_t *dest, const wchar_t *format, va_list arg_ptr); | ||
457 | |||
458 | int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr); | ||
459 | int _win_vsnwprintf(wchar_t* wstr, size_t size, const wchar_t *format, va_list arg_ptr); | ||
460 | |||
461 | int _win_snprintf(char *str,size_t size,const char *format,...); | ||
462 | int _win_snwprintf(wchar_t *str, size_t size, const wchar_t *format, ...); | ||
463 | |||
464 | int _win_sprintf(char *dest,const char *format,...); | ||
465 | int _win_swprintf(wchar_t *dest, const wchar_t *format, ...); | ||
466 | |||
467 | int _win_vsscanf(const char* str, const char* format, va_list arg_ptr); | ||
468 | int _win_vswscanf(const wchar_t* wstr, const wchar_t* format, va_list arg_ptr); | ||
469 | |||
470 | int _win_sscanf(const char *str, const char *format, ...); | ||
471 | int _win_swscanf(const wchar_t *wstr, const wchar_t *format, ...); | ||
472 | |||
473 | int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr); | ||
474 | int _win_vfwscanf(FILE *stream, const wchar_t *format, va_list arg_ptr); | ||
475 | |||
476 | int _win_vscanf(const char *format, va_list arg_ptr); | ||
477 | int _win_vwscanf(const wchar_t *format, va_list arg_ptr); | ||
478 | |||
479 | int _win_scanf(const char *format, ...); | ||
480 | int _win_wscanf(const wchar_t *format, ...); | ||
481 | |||
482 | int _win_fscanf(FILE *stream, const char *format, ...); | ||
483 | int _win_fwscanf(FILE *stream, const wchar_t *format, ...); | ||
484 | |||
485 | |||
486 | pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); | 593 | pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); |
487 | int _win_bind(int s, const struct sockaddr *name, int namelen); | 594 | int _win_bind(int s, const struct sockaddr *name, int namelen); |
488 | int _win_connect(int s,const struct sockaddr *name, int namelen); | 595 | int _win_connect(int s,const struct sockaddr *name, int namelen); |
@@ -512,21 +619,29 @@ struct hostent *gethostbyname2(const char *name, int af); | |||
512 | char *_win_strerror(int errnum); | 619 | char *_win_strerror(int errnum); |
513 | int IsWinNT(); | 620 | int IsWinNT(); |
514 | char *index(const char *s, int c); | 621 | char *index(const char *s, int c); |
622 | char *_win_strtok_r (char *ptr, const char *sep, char **end); | ||
515 | 623 | ||
516 | #if !HAVE_STRNDUP | 624 | #if !HAVE_STRNDUP |
517 | char *strndup (const char *s, size_t n); | 625 | char *strndup (const char *s, size_t n); |
518 | #endif | 626 | #endif |
519 | #if !HAVE_STRNLEN | 627 | #if !HAVE_STRNLEN && (!defined(__MINGW64_VERSION_MAJOR) || !defined(_INC_STRING)) |
520 | size_t strnlen (const char *str, size_t maxlen); | 628 | size_t strnlen (const char *str, size_t maxlen); |
521 | #endif | 629 | #endif |
522 | char *stpcpy(char *dest, const char *src); | 630 | char *stpcpy(char *dest, const char *src); |
523 | char *strcasestr(const char *haystack_start, const char *needle_start); | 631 | char *strcasestr(const char *haystack_start, const char *needle_start); |
524 | #ifndef __MINGW64__ | 632 | #ifndef __MINGW64_VERSION_MAJOR |
525 | #define strcasecmp(a, b) stricmp(a, b) | 633 | #define strcasecmp(a, b) stricmp(a, b) |
526 | #define wcscasecmp(a, b) wcsicmp(a, b) | ||
527 | #define strncasecmp(a, b, c) strnicmp(a, b, c) | 634 | #define strncasecmp(a, b, c) strnicmp(a, b, c) |
635 | #endif | ||
636 | #ifndef wcscasecmp | ||
637 | #define wcscasecmp(a, b) wcsicmp(a, b) | ||
638 | #endif | ||
639 | #ifndef wcsncasecmp | ||
528 | #define wcsncasecmp(a, b, c) wcsnicmp(a, b, c) | 640 | #define wcsncasecmp(a, b, c) wcsnicmp(a, b, c) |
529 | #endif | 641 | #endif |
642 | #ifndef strtok_r /* winpthreads defines it in pthread.h */ | ||
643 | #define strtok_r _win_strtok_r | ||
644 | #endif | ||
530 | #endif /* WINDOWS */ | 645 | #endif /* WINDOWS */ |
531 | 646 | ||
532 | #ifndef WINDOWS | 647 | #ifndef WINDOWS |
@@ -546,6 +661,7 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
546 | #define FOPEN(f, m) fopen(f, m) | 661 | #define FOPEN(f, m) fopen(f, m) |
547 | #define FCLOSE(f) fclose(f) | 662 | #define FCLOSE(f) fclose(f) |
548 | #define FTRUNCATE(f, l) ftruncate(f, l) | 663 | #define FTRUNCATE(f, l) ftruncate(f, l) |
664 | #define TRUNCATE(f, l) truncate(f, l) | ||
549 | #define OPENDIR(d) opendir(d) | 665 | #define OPENDIR(d) opendir(d) |
550 | #define CLOSEDIR(d) closedir(d) | 666 | #define CLOSEDIR(d) closedir(d) |
551 | #define READDIR(d) readdir(d) | 667 | #define READDIR(d) readdir(d) |
@@ -611,7 +727,7 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
611 | #define SHUTDOWN(s, h) shutdown(s, h) | 727 | #define SHUTDOWN(s, h) shutdown(s, h) |
612 | #define SOCKET(a, t, p) socket(a, t, p) | 728 | #define SOCKET(a, t, p) socket(a, t, p) |
613 | #define SOCKETPAIR(a, t, p, v) socketpair(a, t, p, v) | 729 | #define SOCKETPAIR(a, t, p, v) socketpair(a, t, p, v) |
614 | #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t) | 730 | #define GETHOSTBYADDR(a, l, t) gethostbyaddr(a, l, t) |
615 | #define GETHOSTBYNAME(n) gethostbyname(n) | 731 | #define GETHOSTBYNAME(n) gethostbyname(n) |
616 | #define GETTIMEOFDAY(t, n) gettimeofday(t, n) | 732 | #define GETTIMEOFDAY(t, n) gettimeofday(t, n) |
617 | #define INSQUE(e, p) insque(e, p) | 733 | #define INSQUE(e, p) insque(e, p) |
@@ -645,6 +761,7 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
645 | #define FOPEN(f, m) _win_fopen(f, m) | 761 | #define FOPEN(f, m) _win_fopen(f, m) |
646 | #define FCLOSE(f) _win_fclose(f) | 762 | #define FCLOSE(f) _win_fclose(f) |
647 | #define FTRUNCATE(f, l) _win_ftruncate(f, l) | 763 | #define FTRUNCATE(f, l) _win_ftruncate(f, l) |
764 | #define TRUNCATE(f, l) _win_truncate(f, l) | ||
648 | #define OPENDIR(d) _win_opendir(d) | 765 | #define OPENDIR(d) _win_opendir(d) |
649 | #define CLOSEDIR(d) _win_closedir(d) | 766 | #define CLOSEDIR(d) _win_closedir(d) |
650 | #define READDIR(d) _win_readdir(d) | 767 | #define READDIR(d) _win_readdir(d) |
@@ -652,7 +769,7 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
652 | #define CHDIR(d) _win_chdir(d) | 769 | #define CHDIR(d) _win_chdir(d) |
653 | #define CLOSE(f) _win_close(f) | 770 | #define CLOSE(f) _win_close(f) |
654 | #define PLIBC_KILL(p, s) _win_kill(p, s) | 771 | #define PLIBC_KILL(p, s) _win_kill(p, s) |
655 | #define LSEEK(f, o, w) _win_lseek(f, o, w) | 772 | #define LSEEK(f, o, w) lseek(f, o, w) |
656 | #define FSTAT(h, b) _win_fstat(h, b) | 773 | #define FSTAT(h, b) _win_fstat(h, b) |
657 | #define RMDIR(f) _win_rmdir(f) | 774 | #define RMDIR(f) _win_rmdir(f) |
658 | #define ACCESS(p, m) _win_access(p, m) | 775 | #define ACCESS(p, m) _win_access(p, m) |
@@ -679,20 +796,20 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
679 | #define READLINK(p, b, s) _win_readlink(p, b, s) | 796 | #define READLINK(p, b, s) _win_readlink(p, b, s) |
680 | #define LSTAT(p, b) _win_lstat(p, b) | 797 | #define LSTAT(p, b) _win_lstat(p, b) |
681 | #define LSTAT64(p, b) _win_lstat64(p, b) | 798 | #define LSTAT64(p, b) _win_lstat64(p, b) |
682 | #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) | 799 | #define PRINTF printf |
683 | #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) | 800 | #define FPRINTF fprintf |
684 | #define VPRINTF(f, a) _win_vprintf(f, a) | 801 | #define VPRINTF(f, a) vprintf(f, a) |
685 | #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) | 802 | #define VFPRINTF(s, f, a) vfprintf(s, f, a) |
686 | #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) | 803 | #define VSPRINTF(d, f, a) vsprintf(d, f, a) |
687 | #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) | 804 | #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) |
688 | #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__) | 805 | #define _REAL_SNPRINTF snprintf |
689 | #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) | 806 | #define SPRINTF sprintf |
690 | #define VSSCANF(s, f, a) _win_vsscanf(s, f, a) | 807 | #define VSSCANF(s, f, a) vsscanf(s, f, a) |
691 | #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) | 808 | #define SSCANF sscanf |
692 | #define VFSCANF(s, f, a) _win_vfscanf(s, f, a) | 809 | #define VFSCANF(s, f, a) vfscanf(s, f, a) |
693 | #define VSCANF(f, a) _win_vscanf(f, a) | 810 | #define VSCANF(f, a) vscanf(f, a) |
694 | #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) | 811 | #define SCANF scanf |
695 | #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) | 812 | #define FSCANF fscanf |
696 | #define WAITPID(p, s, o) _win_waitpid(p, s, o) | 813 | #define WAITPID(p, s, o) _win_waitpid(p, s, o) |
697 | #define ACCEPT(s, a, l) _win_accept(s, a, l) | 814 | #define ACCEPT(s, a, l) _win_accept(s, a, l) |
698 | #define BIND(s, n, l) _win_bind(s, n, l) | 815 | #define BIND(s, n, l) _win_bind(s, n, l) |
@@ -710,9 +827,9 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
710 | #define SHUTDOWN(s, h) _win_shutdown(s, h) | 827 | #define SHUTDOWN(s, h) _win_shutdown(s, h) |
711 | #define SOCKET(a, t, p) _win_socket(a, t, p) | 828 | #define SOCKET(a, t, p) _win_socket(a, t, p) |
712 | #define SOCKETPAIR(a, t, p, v) _win_socketpair(a, t, p, v) | 829 | #define SOCKETPAIR(a, t, p, v) _win_socketpair(a, t, p, v) |
713 | #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t) | 830 | #define GETHOSTBYADDR(a, l, t) _win_gethostbyaddr(a, l, t) |
714 | #define GETHOSTBYNAME(n) _win_gethostbyname(n) | 831 | #define GETHOSTBYNAME(n) _win_gethostbyname(n) |
715 | #define GETTIMEOFDAY(t, n) _win_gettimeofday(t, n) | 832 | #define GETTIMEOFDAY(t, n) gettimeofday(t, n) |
716 | #define INSQUE(e, p) _win_insque(e, p) | 833 | #define INSQUE(e, p) _win_insque(e, p) |
717 | #define REMQUE(e) _win_remque(e) | 834 | #define REMQUE(e) _win_remque(e) |
718 | #define HSEARCH(i, a) _win_hsearch(i, a) | 835 | #define HSEARCH(i, a) _win_hsearch(i, a) |