aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-05 22:18:00 +0200
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-10 18:37:54 +1000
commite93362da581fe7fb9d25a462c7773c8295a62b05 (patch)
treea8f7af5e833e4e4aab6e0b35e17cdd4bf26535d5
parent7628003d2f02cb21b70cc935112bcc0efcf0ad75 (diff)
downloadbusybox-w32-e93362da581fe7fb9d25a462c7773c8295a62b05.tar.gz
busybox-w32-e93362da581fe7fb9d25a462c7773c8295a62b05.tar.bz2
busybox-w32-e93362da581fe7fb9d25a462c7773c8295a62b05.zip
libbb.h: support MinGW port
-rw-r--r--include/libbb.h16
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
93extern char **environ; 99extern char **environ;
100#endif
94#if defined(__GLIBC__) && __GLIBC__ < 2 101#if defined(__GLIBC__) && __GLIBC__ < 2
95int vdprintf(int d, const char *format, va_list ap); 102int 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;
470void xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen) FAST_FUNC; 481void xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen) FAST_FUNC;
471ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, 482ssize_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
587char *xstrdup(const char *s) FAST_FUNC RETURNS_MALLOC; 600char *xstrdup(const char *s) FAST_FUNC RETURNS_MALLOC;
@@ -720,6 +733,9 @@ char *safe_getdomainname(void) FAST_FUNC;
720char* str_tolower(char *str) FAST_FUNC; 733char* str_tolower(char *str) FAST_FUNC;
721 734
722char *utoa(unsigned n) FAST_FUNC; 735char *utoa(unsigned n) FAST_FUNC;
736#if ENABLE_PLATFORM_MINGW32
737# define itoa bb_itoa
738#endif
723char *itoa(int n) FAST_FUNC; 739char *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 */
725char *utoa_to_buf(unsigned n, char *buf, unsigned buflen) FAST_FUNC; 741char *utoa_to_buf(unsigned n, char *buf, unsigned buflen) FAST_FUNC;