diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-05 22:18:00 +0200 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-10 18:37:54 +1000 |
commit | e93362da581fe7fb9d25a462c7773c8295a62b05 (patch) | |
tree | a8f7af5e833e4e4aab6e0b35e17cdd4bf26535d5 | |
parent | 7628003d2f02cb21b70cc935112bcc0efcf0ad75 (diff) | |
download | busybox-w32-e93362da581fe7fb9d25a462c7773c8295a62b05.tar.gz busybox-w32-e93362da581fe7fb9d25a462c7773c8295a62b05.tar.bz2 busybox-w32-e93362da581fe7fb9d25a462c7773c8295a62b05.zip |
libbb.h: support MinGW port
-rw-r--r-- | include/libbb.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h index 976120e72..0933f5385 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -75,6 +75,11 @@ | |||
75 | # include <arpa/inet.h> | 75 | # include <arpa/inet.h> |
76 | #elif defined __APPLE__ | 76 | #elif defined __APPLE__ |
77 | # include <netinet/in.h> | 77 | # include <netinet/in.h> |
78 | #elif ENABLE_PLATFORM_MINGW32 | ||
79 | # define WINVER 0x0501 | ||
80 | # include <winsock2.h> | ||
81 | # include <ws2tcpip.h> | ||
82 | # undef s_addr | ||
78 | #else | 83 | #else |
79 | # include <arpa/inet.h> | 84 | # include <arpa/inet.h> |
80 | # if !defined(__socklen_t_defined) && !defined(_SOCKLEN_T_DECLARED) | 85 | # if !defined(__socklen_t_defined) && !defined(_SOCKLEN_T_DECLARED) |
@@ -90,7 +95,9 @@ | |||
90 | 95 | ||
91 | /* Some libc's forget to declare these, do it ourself */ | 96 | /* Some libc's forget to declare these, do it ourself */ |
92 | 97 | ||
98 | #if !ENABLE_PLATFORM_MINGW32 | ||
93 | extern char **environ; | 99 | extern char **environ; |
100 | #endif | ||
94 | #if defined(__GLIBC__) && __GLIBC__ < 2 | 101 | #if defined(__GLIBC__) && __GLIBC__ < 2 |
95 | int vdprintf(int d, const char *format, va_list ap); | 102 | int vdprintf(int d, const char *format, va_list ap); |
96 | #endif | 103 | #endif |
@@ -128,6 +135,10 @@ int sysinfo(struct sysinfo* info); | |||
128 | # define BUFSIZ 4096 | 135 | # define BUFSIZ 4096 |
129 | #endif | 136 | #endif |
130 | 137 | ||
138 | /* Can't use ENABLE_PLATFORM_MINGW32 because it's also called by host compiler */ | ||
139 | #if ENABLE_PLATFORM_MINGW32 | ||
140 | # include "mingw.h" | ||
141 | #endif | ||
131 | 142 | ||
132 | /* Make all declarations hidden (-fvisibility flag only affects definitions) */ | 143 | /* Make all declarations hidden (-fvisibility flag only affects definitions) */ |
133 | /* (don't include system headers after this until corresponding pop!) */ | 144 | /* (don't include system headers after this until corresponding pop!) */ |
@@ -470,6 +481,7 @@ void xlisten(int s, int backlog) FAST_FUNC; | |||
470 | void xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen) FAST_FUNC; | 481 | void xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen) FAST_FUNC; |
471 | ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, | 482 | ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, |
472 | socklen_t tolen) FAST_FUNC; | 483 | socklen_t tolen) FAST_FUNC; |
484 | #if !ENABLE_PLATFORM_MINGW32 | ||
473 | /* SO_REUSEADDR allows a server to rebind to an address that is already | 485 | /* SO_REUSEADDR allows a server to rebind to an address that is already |
474 | * "in use" by old connections to e.g. previous server instance which is | 486 | * "in use" by old connections to e.g. previous server instance which is |
475 | * killed or crashed. Without it bind will fail until all such connections | 487 | * killed or crashed. Without it bind will fail until all such connections |
@@ -582,6 +594,7 @@ ssize_t recv_from_to(int fd, void *buf, size_t len, int flags, | |||
582 | struct sockaddr *from, | 594 | struct sockaddr *from, |
583 | struct sockaddr *to, | 595 | struct sockaddr *to, |
584 | socklen_t sa_size) FAST_FUNC; | 596 | socklen_t sa_size) FAST_FUNC; |
597 | #endif | ||
585 | 598 | ||
586 | 599 | ||
587 | char *xstrdup(const char *s) FAST_FUNC RETURNS_MALLOC; | 600 | char *xstrdup(const char *s) FAST_FUNC RETURNS_MALLOC; |
@@ -720,6 +733,9 @@ char *safe_getdomainname(void) FAST_FUNC; | |||
720 | char* str_tolower(char *str) FAST_FUNC; | 733 | char* str_tolower(char *str) FAST_FUNC; |
721 | 734 | ||
722 | char *utoa(unsigned n) FAST_FUNC; | 735 | char *utoa(unsigned n) FAST_FUNC; |
736 | #if ENABLE_PLATFORM_MINGW32 | ||
737 | # define itoa bb_itoa | ||
738 | #endif | ||
723 | char *itoa(int n) FAST_FUNC; | 739 | char *itoa(int n) FAST_FUNC; |
724 | /* Returns a pointer past the formatted number, does NOT null-terminate */ | 740 | /* Returns a pointer past the formatted number, does NOT null-terminate */ |
725 | char *utoa_to_buf(unsigned n, char *buf, unsigned buflen) FAST_FUNC; | 741 | char *utoa_to_buf(unsigned n, char *buf, unsigned buflen) FAST_FUNC; |