diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-07-08 13:06:28 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-07-08 13:06:28 +0000 |
commit | dad819b72a827fa27ad4f0c26d573892efdb504f (patch) | |
tree | a8d9ccec1cf12c25fe7a7950f24e47c1cb2c702d | |
parent | ff594e09e5d983bd0ff26a3e32f159911ffc2b48 (diff) | |
download | libmicrohttpd-dad819b72a827fa27ad4f0c26d573892efdb504f.tar.gz libmicrohttpd-dad819b72a827fa27ad4f0c26d573892efdb504f.zip |
LRN: MHD patches. Later will send patches for other issues, but at least
now it will compile.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | doc/examples/responseheaders.c | 4 | ||||
-rw-r--r-- | src/daemon/daemon.c | 35 | ||||
-rw-r--r-- | src/include/plibc/plibc.h | 83 |
5 files changed, 113 insertions, 14 deletions
@@ -1,3 +1,6 @@ | |||
1 | Sun Jul 8 15:05:31 CEST 2012 | ||
2 | Misc changes to fix build on W32. -LRN | ||
3 | |||
1 | Fri Jun 22 11:31:25 CEST 2012 | 4 | Fri Jun 22 11:31:25 CEST 2012 |
2 | Make sure sockets opened by MHD are non-inheritable by default (#2414). -CG | 5 | Make sure sockets opened by MHD are non-inheritable by default (#2414). -CG |
3 | 6 | ||
diff --git a/configure.ac b/configure.ac index eaefc655..33921887 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -22,7 +22,7 @@ | |||
22 | # | 22 | # |
23 | AC_PREREQ(2.57) | 23 | AC_PREREQ(2.57) |
24 | AC_INIT([libmicrohttpd], [0.9.20],[libmicrohttpd@gnu.org]) | 24 | AC_INIT([libmicrohttpd], [0.9.20],[libmicrohttpd@gnu.org]) |
25 | AM_INIT_AUTOMAKE([libmicrohttpd], [0.9.20]) | 25 | AM_INIT_AUTOMAKE([silent-rules]) |
26 | AM_CONFIG_HEADER([MHD_config.h]) | 26 | AM_CONFIG_HEADER([MHD_config.h]) |
27 | AC_CONFIG_MACRO_DIR([m4]) | 27 | AC_CONFIG_MACRO_DIR([m4]) |
28 | AH_TOP([#define _GNU_SOURCE 1]) | 28 | AH_TOP([#define _GNU_SOURCE 1]) |
diff --git a/doc/examples/responseheaders.c b/doc/examples/responseheaders.c index a71187af..5b16974f 100644 --- a/doc/examples/responseheaders.c +++ b/doc/examples/responseheaders.c | |||
@@ -37,14 +37,14 @@ answer_to_connection (void *cls, struct MHD_Connection *connection, | |||
37 | MHD_create_response_from_buffer (strlen (errorstr), | 37 | MHD_create_response_from_buffer (strlen (errorstr), |
38 | (void *) errorstr, | 38 | (void *) errorstr, |
39 | MHD_RESPMEM_PERSISTENT); | 39 | MHD_RESPMEM_PERSISTENT); |
40 | if (response) | 40 | if (NULL != response) |
41 | { | 41 | { |
42 | ret = | 42 | ret = |
43 | MHD_queue_response (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, | 43 | MHD_queue_response (connection, MHD_HTTP_INTERNAL_SERVER_ERROR, |
44 | response); | 44 | response); |
45 | MHD_destroy_response (response); | 45 | MHD_destroy_response (response); |
46 | 46 | ||
47 | return MHD_YES; | 47 | return ret; |
48 | } | 48 | } |
49 | else | 49 | else |
50 | return MHD_NO; | 50 | return MHD_NO; |
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 6db7ec10..d85ed92a 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c | |||
@@ -1149,12 +1149,22 @@ MHD_accept_connection (struct MHD_Daemon *daemon) | |||
1149 | if (MHD_YES == need_fcntl) | 1149 | if (MHD_YES == need_fcntl) |
1150 | { | 1150 | { |
1151 | /* make socket non-inheritable */ | 1151 | /* make socket non-inheritable */ |
1152 | #if !WINDOWS | ||
1152 | flags = fcntl (s, F_GETFD); | 1153 | flags = fcntl (s, F_GETFD); |
1153 | if ( ( (-1 == flags) || | 1154 | if ( ( (-1 == flags) || |
1154 | ( (flags != (flags | FD_CLOEXEC)) && | 1155 | ( (flags != (flags | FD_CLOEXEC)) && |
1155 | (0 != fcntl (s, F_SETFD, flags | FD_CLOEXEC)) ) ) ) | 1156 | (0 != fcntl (s, F_SETFD, flags | FD_CLOEXEC)) ) ) ) |
1157 | #else | ||
1158 | DWORD dwFlags; | ||
1159 | if (!GetHandleInformation ((HANDLE) s, &dwFlags) || | ||
1160 | ((dwFlags != dwFlags & ~HANDLE_FLAG_INHERIT) && | ||
1161 | !SetHandleInformation ((HANDLE) s, HANDLE_FLAG_INHERIT, 0))) | ||
1162 | #endif | ||
1156 | { | 1163 | { |
1157 | #if HAVE_MESSAGES | 1164 | #if HAVE_MESSAGES |
1165 | #if WINDOWS | ||
1166 | SetErrnoFromWinError (GetLastError ()); | ||
1167 | #endif | ||
1158 | FPRINTF(stderr, "Failed to make socket non-inheritable: %s\n", | 1168 | FPRINTF(stderr, "Failed to make socket non-inheritable: %s\n", |
1159 | STRERROR (errno)); | 1169 | STRERROR (errno)); |
1160 | #endif | 1170 | #endif |
@@ -1993,35 +2003,54 @@ create_socket (int domain, int type, int protocol) | |||
1993 | int ctype = SOCK_STREAM | sock_cloexec; | 2003 | int ctype = SOCK_STREAM | sock_cloexec; |
1994 | int fd; | 2004 | int fd; |
1995 | int flags; | 2005 | int flags; |
2006 | #if WINDOWS | ||
2007 | DWORD dwFlags; | ||
2008 | #endif | ||
1996 | 2009 | ||
1997 | /* use SOCK_STREAM rather than ai_socktype: some getaddrinfo | 2010 | /* use SOCK_STREAM rather than ai_socktype: some getaddrinfo |
1998 | * implementations do not set ai_socktype, e.g. RHL6.2. */ | 2011 | * implementations do not set ai_socktype, e.g. RHL6.2. */ |
1999 | fd = socket(domain, ctype, protocol); | 2012 | fd = SOCKET(domain, ctype, protocol); |
2000 | if ( (-1 == fd) && (EINVAL == errno) && (0 != sock_cloexec) ) | 2013 | if ( (-1 == fd) && (EINVAL == errno) && (0 != sock_cloexec) ) |
2001 | { | 2014 | { |
2002 | sock_cloexec = 0; | 2015 | sock_cloexec = 0; |
2003 | fd = socket(domain, type, protocol); | 2016 | fd = SOCKET(domain, type, protocol); |
2004 | } | 2017 | } |
2005 | if (-1 == fd) | 2018 | if (-1 == fd) |
2006 | return -1; | 2019 | return -1; |
2007 | if (0 != sock_cloexec) | 2020 | if (0 != sock_cloexec) |
2008 | return fd; /* this is it */ | 2021 | return fd; /* this is it */ |
2009 | /* flag was not set during 'socket' call, let's try setting it manually */ | 2022 | /* flag was not set during 'socket' call, let's try setting it manually */ |
2023 | #if !WINDOWS | ||
2010 | flags = fcntl (fd, F_GETFD); | 2024 | flags = fcntl (fd, F_GETFD); |
2011 | if (flags < 0) | 2025 | if (flags < 0) |
2026 | #else | ||
2027 | if (!GetHandleInformation ((HANDLE) fd, &dwFlags)) | ||
2028 | #endif | ||
2012 | { | 2029 | { |
2013 | #if HAVE_MESSAGES | 2030 | #if HAVE_MESSAGES |
2031 | #if WINDOWS | ||
2032 | SetErrnoFromWinError (GetLastError ()); | ||
2033 | #endif | ||
2014 | FPRINTF(stderr, "Failed to get socket options to make socket non-inheritable: %s\n", | 2034 | FPRINTF(stderr, "Failed to get socket options to make socket non-inheritable: %s\n", |
2015 | STRERROR (errno)); | 2035 | STRERROR (errno)); |
2016 | #endif | 2036 | #endif |
2017 | return fd; /* good luck */ | 2037 | return fd; /* good luck */ |
2018 | } | 2038 | } |
2039 | #if !WINDOWS | ||
2019 | if (flags == (flags | FD_CLOEXEC)) | 2040 | if (flags == (flags | FD_CLOEXEC)) |
2020 | return fd; /* already set */ | 2041 | return fd; /* already set */ |
2021 | flags |= FD_CLOEXEC; | 2042 | flags |= FD_CLOEXEC; |
2022 | if (0 != fcntl (fd, F_SETFD, flags)) | 2043 | if (0 != fcntl (fd, F_SETFD, flags)) |
2044 | #else | ||
2045 | if (dwFlags != dwFlags | HANDLE_FLAG_INHERIT) | ||
2046 | return fd; /* already unset */ | ||
2047 | if (!SetHandleInformation ((HANDLE) fd, HANDLE_FLAG_INHERIT, 0)) | ||
2048 | #endif | ||
2023 | { | 2049 | { |
2024 | #if HAVE_MESSAGES | 2050 | #if HAVE_MESSAGES |
2051 | #if WINDOWS | ||
2052 | SetErrnoFromWinError (GetLastError ()); | ||
2053 | #endif | ||
2025 | FPRINTF(stderr, "Failed to make socket non-inheritable: %s\n", | 2054 | FPRINTF(stderr, "Failed to make socket non-inheritable: %s\n", |
2026 | STRERROR (errno)); | 2055 | STRERROR (errno)); |
2027 | #endif | 2056 | #endif |
@@ -2804,7 +2833,7 @@ MHD_init () | |||
2804 | mhd_panic_cls = NULL; | 2833 | mhd_panic_cls = NULL; |
2805 | 2834 | ||
2806 | #ifdef WINDOWS | 2835 | #ifdef WINDOWS |
2807 | plibc_init ("GNU", "libmicrohttpd"); | 2836 | plibc_init_utf8 ("GNU", "libmicrohttpd", 1); |
2808 | #endif | 2837 | #endif |
2809 | #if HTTPS_SUPPORT | 2838 | #if HTTPS_SUPPORT |
2810 | gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); | 2839 | gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); |
diff --git a/src/include/plibc/plibc.h b/src/include/plibc/plibc.h index 4e3204c9..36698bf7 100644 --- a/src/include/plibc/plibc.h +++ b/src/include/plibc/plibc.h | |||
@@ -22,7 +22,7 @@ | |||
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: 69 $ | 25 | * @version $Revision: 87 $ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef _PLIBC_H_ | 28 | #ifndef _PLIBC_H_ |
@@ -50,8 +50,8 @@ extern "C" { | |||
50 | #include "langinfo.h" | 50 | #include "langinfo.h" |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #include <windows.h> | ||
54 | #include <ws2tcpip.h> | 53 | #include <ws2tcpip.h> |
54 | #include <windows.h> | ||
55 | #include <sys/types.h> | 55 | #include <sys/types.h> |
56 | #include <time.h> | 56 | #include <time.h> |
57 | #include <stdio.h> | 57 | #include <stdio.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 | 73 | #ifndef __MINGW64__ | |
74 | struct stat64 | 74 | struct stat64 |
75 | { | 75 | { |
76 | _dev_t st_dev; | 76 | _dev_t st_dev; |
@@ -85,7 +85,7 @@ struct stat64 | |||
85 | __time64_t st_mtime; | 85 | __time64_t st_mtime; |
86 | __time64_t st_ctime; | 86 | __time64_t st_ctime; |
87 | }; | 87 | }; |
88 | 88 | #endif | |
89 | typedef unsigned int sa_family_t; | 89 | typedef unsigned int sa_family_t; |
90 | 90 | ||
91 | struct sockaddr_un { | 91 | struct sockaddr_un { |
@@ -226,8 +226,13 @@ enum | |||
226 | #define MAP_SHARED 0x1 | 226 | #define MAP_SHARED 0x1 |
227 | #define MAP_PRIVATE 0x2 /* unsupported */ | 227 | #define MAP_PRIVATE 0x2 /* unsupported */ |
228 | #define MAP_FIXED 0x10 | 228 | #define MAP_FIXED 0x10 |
229 | #define MAP_ANONYMOUS 0x20 /* unsupported */ | ||
229 | #define MAP_FAILED ((void *)-1) | 230 | #define MAP_FAILED ((void *)-1) |
230 | 231 | ||
232 | #define MS_ASYNC 1 /* sync memory asynchronously */ | ||
233 | #define MS_INVALIDATE 2 /* invalidate the caches */ | ||
234 | #define MS_SYNC 4 /* synchronous memory sync */ | ||
235 | |||
231 | struct statfs | 236 | struct statfs |
232 | { | 237 | { |
233 | long f_type; /* type of filesystem (see below) */ | 238 | long f_type; /* type of filesystem (see below) */ |
@@ -331,17 +336,29 @@ typedef struct | |||
331 | #define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__) | 336 | #define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__) |
332 | 337 | ||
333 | BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest); | 338 | BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest); |
339 | BOOL _plibc_CreateShortcutW(const wchar_t *pwszSrc, const wchar_t *pwszDest); | ||
334 | BOOL _plibc_DereferenceShortcut(char *pszShortcut); | 340 | BOOL _plibc_DereferenceShortcut(char *pszShortcut); |
341 | BOOL _plibc_DereferenceShortcutW(wchar_t *pwszShortcut); | ||
335 | char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags); | 342 | char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags); |
343 | wchar_t *plibc_ChooseDirW(wchar_t *pwszTitle, unsigned long ulFlags); | ||
336 | char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); | 344 | char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags); |
337 | long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey, | 345 | wchar_t *plibc_ChooseFileW(wchar_t *pwszTitle, unsigned long ulFlags); |
346 | |||
347 | long QueryRegistry(HKEY hMainKey, const char *pszKey, const char *pszSubKey, | ||
338 | char *pszBuffer, long *pdLength); | 348 | char *pszBuffer, long *pdLength); |
349 | long QueryRegistryW(HKEY hMainKey, const wchar_t *pszKey, const wchar_t *pszSubKey, | ||
350 | wchar_t *pszBuffer, long *pdLength); | ||
339 | 351 | ||
340 | BOOL __win_IsHandleMarkedAsBlocking(int hHandle); | 352 | BOOL __win_IsHandleMarkedAsBlocking(int hHandle); |
341 | void __win_SetHandleBlockingMode(int s, BOOL bBlocking); | 353 | void __win_SetHandleBlockingMode(int s, BOOL bBlocking); |
342 | void __win_DiscardHandleBlockingMode(int s); | 354 | void __win_DiscardHandleBlockingMode(int s); |
343 | int _win_isSocketValid(int s); | 355 | int _win_isSocketValid(int s); |
344 | int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); | 356 | int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows); |
357 | int plibc_conv_to_win_pathw(const wchar_t *pszUnix, wchar_t *pwszWindows); | ||
358 | |||
359 | int plibc_conv_to_win_pathwconv(const char *pszUnix, wchar_t *pwszWindows); | ||
360 | int plibc_conv_to_win_pathwconv_ex(const char *pszUnix, wchar_t *pszWindows, int derefLinks); | ||
361 | |||
345 | unsigned plibc_get_handle_count(); | 362 | unsigned plibc_get_handle_count(); |
346 | 363 | ||
347 | typedef void (*TPanicProc) (int, char *); | 364 | typedef void (*TPanicProc) (int, char *); |
@@ -360,18 +377,25 @@ const char *hstrerror(int err); | |||
360 | int mkstemp(char *tmplate); | 377 | int mkstemp(char *tmplate); |
361 | char *strptime (const char *buf, const char *format, struct tm *tm); | 378 | char *strptime (const char *buf, const char *format, struct tm *tm); |
362 | const char *inet_ntop(int af, const void *src, char *dst, size_t size); | 379 | const char *inet_ntop(int af, const void *src, char *dst, size_t size); |
380 | #ifndef gmtime_r | ||
381 | struct tm *gmtime_r(const time_t *clock, struct tm *result); | ||
382 | #endif | ||
363 | 383 | ||
364 | int plibc_init(char *pszOrg, char *pszApp); | 384 | int plibc_init(char *pszOrg, char *pszApp); |
385 | int plibc_init_utf8(char *pszOrg, char *pszApp, int utf8_mode); | ||
365 | void plibc_shutdown(); | 386 | void plibc_shutdown(); |
366 | int plibc_initialized(); | 387 | int plibc_initialized(); |
367 | int plibc_conv_to_win_path_ex(const char *pszUnix, char *pszWindows, int derefLinks); | 388 | |
368 | void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine); | 389 | void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine); |
369 | void SetErrnoFromWinsockError(long lWinError); | 390 | void SetErrnoFromWinsockError(long lWinError); |
370 | void SetHErrnoFromWinError(long lWinError); | 391 | void SetHErrnoFromWinError(long lWinError); |
371 | void SetErrnoFromHRESULT(HRESULT hRes); | 392 | void SetErrnoFromHRESULT(HRESULT hRes); |
372 | int GetErrnoFromWinsockError(long lWinError); | 393 | int GetErrnoFromWinsockError(long lWinError); |
373 | FILE *_win_fopen(const char *filename, const char *mode); | 394 | FILE *_win_fopen(const char *filename, const char *mode); |
395 | int _win_fclose(FILE *); | ||
374 | DIR *_win_opendir(const char *dirname); | 396 | DIR *_win_opendir(const char *dirname); |
397 | struct dirent *_win_readdir(DIR *dirp); | ||
398 | int _win_closedir(DIR *dirp); | ||
375 | int _win_open(const char *filename, int oflag, ...); | 399 | int _win_open(const char *filename, int oflag, ...); |
376 | #ifdef ENABLE_NLS | 400 | #ifdef ENABLE_NLS |
377 | char *_win_bindtextdomain(const char *domainname, const char *dirname); | 401 | char *_win_bindtextdomain(const char *domainname, const char *dirname); |
@@ -405,25 +429,56 @@ size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream ); | |||
405 | int _win_symlink(const char *path1, const char *path2); | 429 | int _win_symlink(const char *path1, const char *path2); |
406 | void *_win_mmap(void *start, size_t len, int access, int flags, int fd, | 430 | void *_win_mmap(void *start, size_t len, int access, int flags, int fd, |
407 | unsigned long long offset); | 431 | unsigned long long offset); |
432 | int _win_msync(void *start, size_t length, int flags); | ||
408 | int _win_munmap(void *start, size_t length); | 433 | int _win_munmap(void *start, size_t length); |
409 | int _win_lstat(const char *path, struct stat *buf); | 434 | int _win_lstat(const char *path, struct stat *buf); |
410 | int _win_lstat64(const char *path, struct stat64 *buf); | 435 | int _win_lstat64(const char *path, struct stat64 *buf); |
411 | int _win_readlink(const char *path, char *buf, size_t bufsize); | 436 | int _win_readlink(const char *path, char *buf, size_t bufsize); |
412 | int _win_accept(int s, struct sockaddr *addr, int *addrlen); | 437 | int _win_accept(int s, struct sockaddr *addr, int *addrlen); |
438 | |||
413 | int _win_printf(const char *format,...); | 439 | int _win_printf(const char *format,...); |
440 | int _win_wprintf(const wchar_t *format, ...); | ||
441 | |||
414 | int _win_fprintf(FILE *f,const char *format,...); | 442 | int _win_fprintf(FILE *f,const char *format,...); |
443 | int _win_fwprintf(FILE *f,const wchar_t *format, ...); | ||
444 | |||
415 | int _win_vprintf(const char *format, va_list ap); | 445 | int _win_vprintf(const char *format, va_list ap); |
446 | int _win_vfwprintf(FILE *stream, const wchar_t *format, va_list arg_ptr); | ||
447 | |||
416 | int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr); | 448 | int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr); |
449 | int _win_vwprintf(const wchar_t *format, va_list ap); | ||
450 | |||
417 | int _win_vsprintf(char *dest,const char *format, va_list arg_ptr); | 451 | int _win_vsprintf(char *dest,const char *format, va_list arg_ptr); |
452 | int _win_vswprintf(wchar_t *dest, const wchar_t *format, va_list arg_ptr); | ||
453 | |||
418 | int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr); | 454 | int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr); |
455 | int _win_vsnwprintf(wchar_t* wstr, size_t size, const wchar_t *format, va_list arg_ptr); | ||
456 | |||
419 | int _win_snprintf(char *str,size_t size,const char *format,...); | 457 | int _win_snprintf(char *str,size_t size,const char *format,...); |
458 | int _win_snwprintf(wchar_t *str, size_t size, const wchar_t *format, ...); | ||
459 | |||
420 | int _win_sprintf(char *dest,const char *format,...); | 460 | int _win_sprintf(char *dest,const char *format,...); |
461 | int _win_swprintf(wchar_t *dest, const wchar_t *format, ...); | ||
462 | |||
421 | int _win_vsscanf(const char* str, const char* format, va_list arg_ptr); | 463 | int _win_vsscanf(const char* str, const char* format, va_list arg_ptr); |
464 | int _win_vswscanf(const wchar_t* wstr, const wchar_t* format, va_list arg_ptr); | ||
465 | |||
422 | int _win_sscanf(const char *str, const char *format, ...); | 466 | int _win_sscanf(const char *str, const char *format, ...); |
467 | int _win_swscanf(const wchar_t *wstr, const wchar_t *format, ...); | ||
468 | |||
423 | int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr); | 469 | int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr); |
470 | int _win_vfwscanf(FILE *stream, const wchar_t *format, va_list arg_ptr); | ||
471 | |||
424 | int _win_vscanf(const char *format, va_list arg_ptr); | 472 | int _win_vscanf(const char *format, va_list arg_ptr); |
473 | int _win_vwscanf(const wchar_t *format, va_list arg_ptr); | ||
474 | |||
425 | int _win_scanf(const char *format, ...); | 475 | int _win_scanf(const char *format, ...); |
476 | int _win_wscanf(const wchar_t *format, ...); | ||
477 | |||
426 | int _win_fscanf(FILE *stream, const char *format, ...); | 478 | int _win_fscanf(FILE *stream, const char *format, ...); |
479 | int _win_fwscanf(FILE *stream, const wchar_t *format, ...); | ||
480 | |||
481 | |||
427 | pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); | 482 | pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); |
428 | int _win_bind(int s, const struct sockaddr *name, int namelen); | 483 | int _win_bind(int s, const struct sockaddr *name, int namelen); |
429 | int _win_connect(int s,const struct sockaddr *name, int namelen); | 484 | int _win_connect(int s,const struct sockaddr *name, int namelen); |
@@ -461,10 +516,12 @@ size_t strnlen (const char *str, size_t maxlen); | |||
461 | #endif | 516 | #endif |
462 | char *stpcpy(char *dest, const char *src); | 517 | char *stpcpy(char *dest, const char *src); |
463 | char *strcasestr(const char *haystack_start, const char *needle_start); | 518 | char *strcasestr(const char *haystack_start, const char *needle_start); |
464 | 519 | #ifndef __MINGW64__ | |
465 | #define strcasecmp(a, b) stricmp(a, b) | 520 | #define strcasecmp(a, b) stricmp(a, b) |
521 | #define wcscasecmp(a, b) wcsicmp(a, b) | ||
466 | #define strncasecmp(a, b, c) strnicmp(a, b, c) | 522 | #define strncasecmp(a, b, c) strnicmp(a, b, c) |
467 | 523 | #define wcsncasecmp(a, b, c) wcsnicmp(a, b, c) | |
524 | #endif | ||
468 | #endif /* WINDOWS */ | 525 | #endif /* WINDOWS */ |
469 | 526 | ||
470 | #ifndef WINDOWS | 527 | #ifndef WINDOWS |
@@ -482,8 +539,11 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
482 | #define CTIME_R(c, b) ctime_r(c, b) | 539 | #define CTIME_R(c, b) ctime_r(c, b) |
483 | #undef FOPEN | 540 | #undef FOPEN |
484 | #define FOPEN(f, m) fopen(f, m) | 541 | #define FOPEN(f, m) fopen(f, m) |
542 | #define FCLOSE(f) fclose(f) | ||
485 | #define FTRUNCATE(f, l) ftruncate(f, l) | 543 | #define FTRUNCATE(f, l) ftruncate(f, l) |
486 | #define OPENDIR(d) opendir(d) | 544 | #define OPENDIR(d) opendir(d) |
545 | #define CLOSEDIR(d) closedir(d) | ||
546 | #define READDIR(d) readdir(d) | ||
487 | #define OPEN open | 547 | #define OPEN open |
488 | #define CHDIR(d) chdir(d) | 548 | #define CHDIR(d) chdir(d) |
489 | #define CLOSE(f) close(f) | 549 | #define CLOSE(f) close(f) |
@@ -506,6 +566,8 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
506 | #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) | 566 | #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f) |
507 | #define SYMLINK(a, b) symlink(a, b) | 567 | #define SYMLINK(a, b) symlink(a, b) |
508 | #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) | 568 | #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o) |
569 | #define MKFIFO(p, m) mkfifo(p, m) | ||
570 | #define MSYNC(s, l, f) msync(s, l, f) | ||
509 | #define MUNMAP(s, l) munmap(s, l) | 571 | #define MUNMAP(s, l) munmap(s, l) |
510 | #define STRERROR(i) strerror(i) | 572 | #define STRERROR(i) strerror(i) |
511 | #define RANDOM() random() | 573 | #define RANDOM() random() |
@@ -575,8 +637,11 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
575 | #define PLIBC_CTIME(c) _win_ctime(c) | 637 | #define PLIBC_CTIME(c) _win_ctime(c) |
576 | #define CTIME_R(c, b) _win_ctime_r(c, b) | 638 | #define CTIME_R(c, b) _win_ctime_r(c, b) |
577 | #define FOPEN(f, m) _win_fopen(f, m) | 639 | #define FOPEN(f, m) _win_fopen(f, m) |
640 | #define FCLOSE(f) _win_fclose(f) | ||
578 | #define FTRUNCATE(f, l) _win_ftruncate(f, l) | 641 | #define FTRUNCATE(f, l) _win_ftruncate(f, l) |
579 | #define OPENDIR(d) _win_opendir(d) | 642 | #define OPENDIR(d) _win_opendir(d) |
643 | #define CLOSEDIR(d) _win_closedir(d) | ||
644 | #define READDIR(d) _win_readdir(d) | ||
580 | #define OPEN _win_open | 645 | #define OPEN _win_open |
581 | #define CHDIR(d) _win_chdir(d) | 646 | #define CHDIR(d) _win_chdir(d) |
582 | #define CLOSE(f) _win_close(f) | 647 | #define CLOSE(f) _win_close(f) |
@@ -601,6 +666,8 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
601 | #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) | 666 | #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f) |
602 | #define SYMLINK(a, b) _win_symlink(a, b) | 667 | #define SYMLINK(a, b) _win_symlink(a, b) |
603 | #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) | 668 | #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o) |
669 | #define MKFIFO(p, m) _win_mkfifo(p, m) | ||
670 | #define MSYNC(s, l, f) _win_msync(s, l, f) | ||
604 | #define MUNMAP(s, l) _win_munmap(s, l) | 671 | #define MUNMAP(s, l) _win_munmap(s, l) |
605 | #define STRERROR(i) _win_strerror(i) | 672 | #define STRERROR(i) _win_strerror(i) |
606 | #define READLINK(p, b, s) _win_readlink(p, b, s) | 673 | #define READLINK(p, b, s) _win_readlink(p, b, s) |