sets the required HAVE_xx defines for non-DOS/Win targets.
#include <sys/select.h>
#endif
-#ifdef WIN32
-#include <winsock.h>
-#include <windows.h>
+#if defined(WATT32)
+ #include <netinet/in.h>
+ #include <tcp.h>
+#elif defined(WIN32)
+ #include <winsock.h>
+ #include <windows.h>
#else
-#include <netinet/in.h>
+ #include <netinet/in.h>
#endif
#define ARES_SUCCESS 0
#include "setup.h"
#include <stdlib.h>
-#ifdef WIN32
-#else
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+
#include "ares.h"
#include "ares_private.h"
#include "setup.h"
#include <sys/types.h>
-#ifdef WIN32
-
-#else
+#if !defined(WIN32) || defined(WATT32)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "setup.h"
#include <sys/types.h>
-#ifdef WIN32
+#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#include <netinet/in.h>
#include "setup.h"
#include <sys/types.h>
-#ifdef WIN32
+#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#include <netinet/in.h>
#include "setup.h"
#include <sys/types.h>
-#ifdef WIN32
-
-#else
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include "setup.h"
#include <stdlib.h>
-#ifdef WIN32
-
-#else
+#if !defined(WIN32) || defined(WATT32)
#include <netdb.h>
#endif
#include "setup.h"
#include <sys/types.h>
-#ifdef WIN32
+#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#include <iphlpapi.h>
#include <malloc.h>
+
#else
#include <sys/param.h>
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
+#endif
+
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <arpa/nameser.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#endif
#include <stdio.h>
#include <stdlib.h>
#include "ares.h"
#include "ares_private.h"
+#ifdef WATT32
+#undef WIN32 /* Redefined in MingW/MSVC headers */
+#endif
+
static int init_by_options(ares_channel channel, struct ares_options *options,
int optmask);
static int init_by_environment(ares_channel channel);
#include <stdio.h>
#include <sys/types.h>
-#ifdef WIN32
-
-#else
+#if !defined(WIN32) || defined(WATT32)
#include <netinet/in.h>
/* We define closesocket() here so that we can use this function all over
the source code for closing sockets. */
#define INADDR_NONE 0xffffffff
#endif
-#ifdef WIN32
+#if defined(WIN32) && !defined(WATT32)
#define IsNT ((int)GetVersion()>0)
#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP"
#include "setup.h"
#include <sys/types.h>
-#ifdef WIN32
+#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
+
#else
#include <sys/socket.h>
+#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
+#endif
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/nameser.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#endif
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#include <errno.h>
+
#include "ares.h"
#include "ares_dns.h"
#include "ares_private.h"
-#ifdef WIN32
+#if defined(WIN32) || defined(WATT32)
#define GET_ERRNO() WSAGetLastError()
#else
#define GET_ERRNO() errno
*/
process_answer(channel, server->tcp_buffer, server->tcp_length,
i, 1, now);
- free(server->tcp_buffer);
+ if (server->tcp_buffer)
+ free(server->tcp_buffer);
server->tcp_buffer = NULL;
server->tcp_lenbuf_pos = 0;
}
#include "setup.h"
#include <sys/types.h>
-#ifdef WIN32
+#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#include <netinet/in.h>
#include <string.h>
#include <ctype.h>
-#ifdef WIN32
+#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#endif
#include "setup.h"
#include <sys/types.h>
-#ifdef WIN32
+#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#include <netinet/in.h>
#include "setup.h"
#include <sys/types.h>
-#ifdef WIN32
-
-#else
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <time.h>
+
#include "ares.h"
#include "ares_private.h"
#define T_MAILA ns_t_maila
#define T_ANY ns_t_any
-#if !(defined(__MINGW32__) || defined(NETWARE))
-/* protos for the functions we provide in windows_port.c */
-int ares_strncasecmp(const char *s1, const char *s2, size_t n);
-int ares_strcasecmp(const char *s1, const char *s2);
-
-/* use this define magic to prevent us from adding symbol names to the library
- that is a high-risk to collide with another libraries' attempts to do the
- same */
-#define strncasecmp(a,b,c) ares_strncasecmp(a,b,c)
-#define strcasecmp(a,b) ares_strcasecmp(a,b)
-#endif
-
#endif /* ARES_NAMESER_H */
#else
/* simple work-around for now, for systems without configure support */
#define ssize_t int
+
+#ifdef __MINGW32__
+#define HAVE_SYS_TIME_H
+#define HAVE_UNISTD_H
+#endif
+
#endif
/* Recent autoconf versions define these symbols in config.h. We don't want
#undef PACKAGE
/* now typedef our socket type */
-#ifdef WIN32
+#if defined(WIN32) && !defined(WATT32)
#include <winsock.h>
typedef SOCKET ares_socket_t;
#define ARES_SOCKET_BAD INVALID_SOCKET
#define ARES_SOCKET_BAD -1
#endif
+/* Assume a few thing unless they're set by configure
+ */
+#if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER)
+#define HAVE_SYS_TIME_H
+#endif
+
+#if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER)
+#define HAVE_UNISTD_H
+#endif
+
+#if !defined(HAVE_SYS_UIO_H) && !defined(WIN32)
+#define HAVE_SYS_UIO_H
+#endif
+
+#if (defined(WIN32) || defined(WATT32)) && \
+ !(defined(__MINGW32__) || defined(NETWARE))
+/* protos for the functions we provide in windows_port.c */
+int ares_strncasecmp(const char *s1, const char *s2, int n);
+int ares_strcasecmp(const char *s1, const char *s2);
+
+/* use this define magic to prevent us from adding symbol names to the library
+ that is a high-risk to collide with another libraries' attempts to do the
+ same */
+#define strncasecmp(a,b,c) ares_strncasecmp(a,b,c)
+#define strcasecmp(a,b) ares_strcasecmp(a,b)
+#endif
+
#endif /* ARES_SETUP_H */
#include "setup.h"
-#ifdef WIN32 /* only do the following on windows */
+/* only do the following on windows
+ */
+#if (defined(WIN32) || defined(WATT32)) && !defined(MSDOS)
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <malloc.h>
+#ifdef WATT32
+#include <sys/socket.h>
+#else
#include "nameser.h"
+#endif
+#include "ares.h"
+#include "ares_private.h"
#ifndef __MINGW32__
int
-ares_strncasecmp(const char *a, const char *b, size_t n)
+ares_strncasecmp(const char *a, const char *b, int n)
{
- size_t i;
+ int i;
for (i = 0; i < n; i++) {
int c1 = isupper(a[i]) ? tolower(a[i]) : a[i];
}
int
-ares_writev (SOCKET s, const struct iovec *vector, size_t count)
+ares_writev (ares_socket_t s, const struct iovec *vector, size_t count)
{
char *buffer, *bp;
size_t i, bytes = 0;