summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-07-01 06:58:47 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-07-01 06:58:47 +0000
commitcb0a33076ad3f144228d59a475dc232d9c32fdb5 (patch)
treee3642dc48d510235490ce07abee999be16ff20bf
parentfcf36da14f5e22e9d052d6f56a4b52fb8d4d88fb (diff)
downloadc-ares-cb0a33076ad3f144228d59a475dc232d9c32fdb5.tar.gz
c-ares-cb0a33076ad3f144228d59a475dc232d9c32fdb5.tar.bz2
c-ares-cb0a33076ad3f144228d59a475dc232d9c32fdb5.zip
Gisle Vanem made this build fine with djgpp and the Watt-32 stack.
-rw-r--r--ares_init.c18
-rw-r--r--ares_private.h9
-rw-r--r--ares_process.c2
3 files changed, 28 insertions, 1 deletions
diff --git a/ares_init.c b/ares_init.c
index bd23234..c5e35d0 100644
--- a/ares_init.c
+++ b/ares_init.c
@@ -506,6 +506,24 @@ DhcpNameServer
free(resolvers);
}
+#elif defined(WATT32)
+ int i;
+
+ sock_init();
+ for (i = 0; def_nameservers[i]; i++)
+ ;
+ if (i == 0)
+ return ARES_SUCCESS; /* use localhost DNS server */
+
+ nservers = i;
+ servers = calloc(sizeof(*servers), i);
+ if (!servers)
+ return ARES_ENOMEM;
+
+ for (i = 0; def_nameservers[i]; i++)
+ servers[i].addr.s_addr = htonl(def_nameservers[i]);
+ status = ARES_EOF;
+
#else
{
char *p;
diff --git a/ares_private.h b/ares_private.h
index 7a755e0..caff53b 100644
--- a/ares_private.h
+++ b/ares_private.h
@@ -27,6 +27,15 @@
#define closesocket(x) close(x)
#endif
+#ifdef WATT32
+#include <tcp.h>
+#include <sys/ioctl.h>
+#undef closesocket
+#define closesocket(s) close_s(s)
+#define select(n,r,w,x,t) select_s(n,r,w,x,t)
+#define writev(s,v,c) writev_s(s,v,c)
+#endif
+
#define DEFAULT_TIMEOUT 5
#define DEFAULT_TRIES 4
#ifndef INADDR_NONE
diff --git a/ares_process.c b/ares_process.c
index 6a7585c..a8dd0c7 100644
--- a/ares_process.c
+++ b/ares_process.c
@@ -458,7 +458,7 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server)
/* Set the socket non-blocking. */
-#ifdef WIN32
+#if defined(WIN32) || defined(WATT32)
flags = 1;
ioctlsocket(s, FIONBIO, &flags);
#else