From caa66b610f90ddc5989b72bc2b437869e74c4421 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sat, 25 Oct 2008 07:38:03 +0000 Subject: Fix build on Win32 --- src/lib/sockio-c.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/lib/sockio-c.c') diff --git a/src/lib/sockio-c.c b/src/lib/sockio-c.c index 51c04bfe..75f94390 100644 --- a/src/lib/sockio-c.c +++ b/src/lib/sockio-c.c @@ -47,8 +47,13 @@ #include #include #include -#include -#include +#ifdef __WIN32__ +# include +# include +#else +# include +# include +#endif #include "cfuns.h" #include "sockio.h" @@ -143,14 +148,21 @@ oa_inet_pton(const char* addr, int prot, openaxiom_byte* bytes) { switch (prot) { case 4: { +#ifdef __WIN32__ + unsigned long inet_val = inet_addr(addr); + if (inet_val == INADDR_NONE || inet_val == INADDR_ANY) + return -1; + memcpy(bytes, &inet_val, 4); + return 0; +#else struct in_addr inet_val; if (inet_aton(addr, &inet_val) != 0) { memcpy(bytes, &inet_val, 4); return 0; } return -1; +#endif } - default: return -1; } -- cgit v1.2.3