/* Copyright 1998 by the Massachusetts Institute of Technology.
*
- * $Id$
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* without express or implied warranty.
*/
-#include "setup.h"
+#include "ares_setup.h"
#if !defined(WIN32) || defined(WATT32)
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
#endif
+
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#include "ares.h"
#include "ares_dns.h"
-#include "inet_ntop.h"
-#include "inet_net_pton.h"
#include "ares_getopt.h"
+#include "ares_ipv6.h"
+#include "ares_nowarn.h"
+
+#ifndef HAVE_STRDUP
+# include "ares_strdup.h"
+# define strdup(ptr) ares_strdup(ptr)
+#endif
+
+#ifndef HAVE_STRCASECMP
+# include "ares_strcasecmp.h"
+# define strcasecmp(p1,p2) ares_strcasecmp(p1,p2)
+#endif
+
+#ifndef HAVE_STRNCASECMP
+# include "ares_strcasecmp.h"
+# define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n)
+#endif
static void callback(void *arg, int status, int timeouts, struct hostent *host);
static void usage(void);
fd_set read_fds, write_fds;
struct timeval *tvp, tv;
struct in_addr addr4;
- struct in6_addr addr6;
+ struct ares_in6_addr addr6;
#ifdef USE_WINSOCK
WORD wVersionRequested = MAKEWORD(USE_WINSOCK,USE_WINSOCK);
WSAStartup(wVersionRequested, &wsaData);
#endif
+ status = ares_library_init(ARES_LIB_INIT_ALL);
+ if (status != ARES_SUCCESS)
+ {
+ fprintf(stderr, "ares_library_init: %s\n", ares_strerror(status));
+ return 1;
+ }
+
while ((c = ares_getopt(argc,argv,"dt:h")) != -1)
{
switch (c)
}
/* Wait for all queries to complete. */
- while (1)
+ for (;;)
{
FD_ZERO(&read_fds);
FD_ZERO(&write_fds);
ares_destroy(channel);
+ ares_library_cleanup();
+
#ifdef USE_WINSOCK
WSACleanup();
#endif