]> granicus.if.org Git - libevent/commitdiff
introduce evdns_init() which works on windows and unix.
authorNiels Provos <provos@gmail.com>
Mon, 28 Aug 2006 00:57:49 +0000 (00:57 +0000)
committerNiels Provos <provos@gmail.com>
Mon, 28 Aug 2006 00:57:49 +0000 (00:57 +0000)
svn:r231

evdns.c
evdns.h
test/regress_dns.c

diff --git a/evdns.c b/evdns.c
index 40838c6aa7dbdb6f044ada1ff43d34a394b70537..7866e2ed9636bb76666a1270a53228557286dc46 100644 (file)
--- a/evdns.c
+++ b/evdns.c
@@ -2027,3 +2027,16 @@ evdns_config_windows_nameservers(void)
        return load_nameservers_from_registry();
 }
 #endif
+
+int
+evdns_init()
+{
+       int res = 0;
+#ifdef MS_WINDOWS
+       evdns_config_windows_nameservers(void);
+#else
+       res = evdns_resolv_conf_parse(DNS_OPTIONS_ALL, "/etc/resolv.conf");
+#endif
+
+       return (res);
+}
diff --git a/evdns.h b/evdns.h
index 03662eb8e1ee424e49a1e3ab55586d79708cda4d..ff620e6e644f828bf775224d0d90e3b3c5e17b86 100644 (file)
--- a/evdns.h
+++ b/evdns.h
@@ -48,6 +48,7 @@
 
 typedef void (*evdns_callback_type) (int result, char type, int count, int ttl, void *addresses, void *arg);
 
+int evdns_init();
 int evdns_nameserver_add(unsigned long int address);
 int evdns_count_nameservers(void);
 int evdns_clear_nameservers_and_suspend(void);
index 2e6265537f734f90978b5f047f6b78290771cdd9..0b3382e1c0c8b9750d3400f031aaacf07fd1919a 100644 (file)
@@ -85,11 +85,7 @@ dns_gethostbyname()
 void
 dns_suite(void)
 {
-#ifdef WIN32
-       evdns_config_windows_nameservers();
-#else
-       evdns_resolv_conf_parse(DNS_OPTIONS_ALL, "/etc/resolv.conf");
-#endif
+       evdns_init();
        dns_gethostbyname();
 
        evdns_clear_nameservers_and_suspend();