Commit 2d64cd55 authored by Yang Tse's avatar Yang Tse
Browse files

Introduction of ares_library_init() and ares_library_cleanup()

parent 60a6af74
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -6,12 +6,13 @@ ares_timeout.c ares_destroy.c ares_mkquery.c ares_version.c \
ares_expand_name.c ares_parse_a_reply.c windows_port.c ares_strdup.c	\
ares_expand_string.c ares_parse_ptr_reply.c ares_parse_aaaa_reply.c	\
ares_getnameinfo.c inet_net_pton.c bitncmp.c inet_ntop.c ares_writev.c	\
ares_parse_ns_reply.c ares_llist.c ares__timeval.c ares_strcasecmp.c
ares_parse_ns_reply.c ares_llist.c ares__timeval.c ares_strcasecmp.c	\
ares_library_init.c

HHEADERS = ares.h ares_private.h setup.h ares_dns.h ares_version.h          \
 nameser.h inet_net_pton.h inet_ntop.h ares_ipv6.h bitncmp.h setup_once.h   \
 ares_llist.h ares_strdup.h ares_strcasecmp.h ares_writev.h ares_build.h    \
 ares_rules.h
 ares_rules.h ares_library_init.h

MANPAGES= ares_destroy.3 ares_expand_name.3 ares_expand_string.3 ares_fds.3 \
 ares_free_hostent.3 ares_free_string.3 ares_gethostbyaddr.3		    \
+8 −1
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ OBJECTS = $(OBJ_DIR)\ares_fds.obj \
          $(OBJ_DIR)\ares_strerror.obj         \
          $(OBJ_DIR)\ares_cancel.obj           \
          $(OBJ_DIR)\ares_init.obj             \
          $(OBJ_DIR)\ares_library_init.obj     \
          $(OBJ_DIR)\ares_llist.obj            \
          $(OBJ_DIR)\ares_timeout.obj          \
          $(OBJ_DIR)\ares__timeval.obj         \
@@ -110,6 +111,8 @@ $(DEF_FILE): $(OBJECTS) Makefile.VC6
       @echo   ares_getsock           >> $@
       @echo   ares_init              >> $@
       @echo   ares_init_options      >> $@
       @echo   ares_library_init      >> $@
       @echo   ares_library_cleanup   >> $@
       @echo   ares_mkquery           >> $@
       @echo   ares_parse_a_reply     >> $@
       @echo   ares_parse_ptr_reply   >> $@
@@ -203,7 +206,8 @@ $(OBJ_DIR)\ares_cancel.obj: ares_cancel.c setup.h setup_once.h ares.h \
  ares_private.h ares_ipv6.h ares_build.h ares_rules.h

$(OBJ_DIR)\ares_init.obj: ares_init.c setup.h setup_once.h nameser.h ares.h    \
  ares_private.h ares_ipv6.h inet_net_pton.h ares_build.h ares_rules.h
  ares_private.h ares_ipv6.h inet_net_pton.h ares_build.h ares_rules.h         \
  ares_library_init.h

$(OBJ_DIR)\ares_timeout.obj: ares_timeout.c setup.h setup_once.h ares.h        \
  ares_private.h ares_ipv6.h ares_build.h ares_rules.h
@@ -260,6 +264,9 @@ $(OBJ_DIR)\inet_ntop.obj: inet_ntop.c setup.h setup_once.h nameser.h \
$(OBJ_DIR)\ares_getopt.obj: ares_getopt.c ares_getopt.h ares_build.h           \
  ares_rules.h

$(OBJ_DIR)\ares_library_init.obj: ares_library_init.c setup.h setup_once.h     \
  ares.h ares_private.h ares_library_init.h ares_build.h ares_rules.h

$(OBJ_DIR)\ares_llist.obj: ares_llist.c setup.h setup_once.h ares.h            \
  ares_private.h ares_llist.h ares_build.h ares_rules.h

+9 −0
Original line number Diff line number Diff line
@@ -116,6 +116,13 @@ int main(int argc, char **argv)
  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 ((ch = ares_getopt(argc, argv, "dvh?")) != -1)
    switch (ch)
      {
@@ -178,6 +185,8 @@ int main(int argc, char **argv)
  wait_ares(channel);
  ares_destroy(channel);

  ares_library_cleanup();

#if defined(WIN32) && !defined(WATT32)
  WSACleanup();
#endif
+9 −0
Original line number Diff line number Diff line
@@ -187,6 +187,13 @@ int main(int argc, char **argv)
  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;
    }

  options.flags = ARES_FLAG_NOCHECKRESP;
  options.servers = NULL;
  options.nservers = 0;
@@ -325,6 +332,8 @@ int main(int argc, char **argv)

  ares_destroy(channel);

  ares_library_cleanup();

#ifdef USE_WINSOCK
  WSACleanup();
#endif
+9 −0
Original line number Diff line number Diff line
@@ -77,6 +77,13 @@ int main(int argc, char **argv)
  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)
@@ -147,6 +154,8 @@ int main(int argc, char **argv)

  ares_destroy(channel);

  ares_library_cleanup();

#ifdef USE_WINSOCK
  WSACleanup();
#endif
Loading