From e93362da581fe7fb9d25a462c7773c8295a62b05 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Mon, 5 Apr 2010 22:18:00 +0200 Subject: libbb.h: support MinGW port --- include/libbb.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 @@ # include #elif defined __APPLE__ # include +#elif ENABLE_PLATFORM_MINGW32 +# define WINVER 0x0501 +# include +# include +# undef s_addr #else # include # if !defined(__socklen_t_defined) && !defined(_SOCKLEN_T_DECLARED) @@ -90,7 +95,9 @@ /* Some libc's forget to declare these, do it ourself */ +#if !ENABLE_PLATFORM_MINGW32 extern char **environ; +#endif #if defined(__GLIBC__) && __GLIBC__ < 2 int vdprintf(int d, const char *format, va_list ap); #endif @@ -128,6 +135,10 @@ int sysinfo(struct sysinfo* info); # define BUFSIZ 4096 #endif +/* Can't use ENABLE_PLATFORM_MINGW32 because it's also called by host compiler */ +#if ENABLE_PLATFORM_MINGW32 +# include "mingw.h" +#endif /* Make all declarations hidden (-fvisibility flag only affects definitions) */ /* (don't include system headers after this until corresponding pop!) */ @@ -470,6 +481,7 @@ void xlisten(int s, int backlog) FAST_FUNC; void xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen) FAST_FUNC; ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, socklen_t tolen) FAST_FUNC; +#if !ENABLE_PLATFORM_MINGW32 /* SO_REUSEADDR allows a server to rebind to an address that is already * "in use" by old connections to e.g. previous server instance which is * 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, struct sockaddr *from, struct sockaddr *to, socklen_t sa_size) FAST_FUNC; +#endif char *xstrdup(const char *s) FAST_FUNC RETURNS_MALLOC; @@ -720,6 +733,9 @@ char *safe_getdomainname(void) FAST_FUNC; char* str_tolower(char *str) FAST_FUNC; char *utoa(unsigned n) FAST_FUNC; +#if ENABLE_PLATFORM_MINGW32 +# define itoa bb_itoa +#endif char *itoa(int n) FAST_FUNC; /* Returns a pointer past the formatted number, does NOT null-terminate */ char *utoa_to_buf(unsigned n, char *buf, unsigned buflen) FAST_FUNC; -- cgit v1.2.3-55-g6feb