ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/evdns.c
(Generate patch)

Comparing libev/evdns.c (file contents):
Revision 1.4 by root, Thu Nov 1 17:45:30 2007 UTC vs.
Revision 1.7 by root, Sat Nov 3 20:24:42 2007 UTC

1#define DNS_USE_GETTIMEOFDAY_FOR_ID 1 1/* $Id: evdns.c,v 1.7 2007/11/03 20:24:42 root Exp $ */
2#define HAVE_STRUCT_IN6_ADDR 1
3 2
4/* The original version of this module was written by Adam Langley; for 3/* The original version of this module was written by Adam Langley; for
5 * a history of modifications, check out the subversion logs. 4 * a history of modifications, check out the subversion logs.
6 * 5 *
7 * When editing this module, try to keep it re-mergeable by Adam. Don't 6 * When editing this module, try to keep it re-mergeable by Adam. Don't
93#include <ctype.h> 92#include <ctype.h>
94#include <stdio.h> 93#include <stdio.h>
95#include <stdarg.h> 94#include <stdarg.h>
96 95
97#include "evdns.h" 96#include "evdns.h"
97#include "log.h"
98#ifdef WIN32 98#ifdef WIN32
99#include <windows.h> 99#include <windows.h>
100#include <winsock2.h> 100#include <winsock2.h>
101#include <iphlpapi.h> 101#include <iphlpapi.h>
102#else 102#else
2545 if (flags & DNS_OPTION_NAMESERVERS) evdns_nameserver_ip_add("127.0.0.1"); 2545 if (flags & DNS_OPTION_NAMESERVERS) evdns_nameserver_ip_add("127.0.0.1");
2546} 2546}
2547 2547
2548#ifndef HAVE_STRTOK_R 2548#ifndef HAVE_STRTOK_R
2549static char * 2549static char *
2550fake_strtok_r(char *s, const char *delim, char **state) { 2550strtok_r(char *s, const char *delim, char **state) {
2551 return strtok(s, delim); 2551 return strtok(s, delim);
2552} 2552}
2553#endif 2553#endif
2554 2554
2555/* helper version of atoi which returns -1 on error */ 2555/* helper version of atoi which returns -1 on error */
2621 2621
2622static void 2622static void
2623resolv_conf_parse_line(char *const start, int flags) { 2623resolv_conf_parse_line(char *const start, int flags) {
2624 char *strtok_state; 2624 char *strtok_state;
2625 static const char *const delims = " \t"; 2625 static const char *const delims = " \t";
2626#define NEXT_TOKEN fake_strtok_r(NULL, delims, &strtok_state) 2626#define NEXT_TOKEN strtok_r(NULL, delims, &strtok_state)
2627 2627
2628 char *const first_token = fake_strtok_r(start, delims, &strtok_state); 2628 char *const first_token = strtok_r(start, delims, &strtok_state);
2629 if (!first_token) return; 2629 if (!first_token) return;
2630 2630
2631 if (!strcmp(first_token, "nameserver") && (flags & DNS_OPTION_NAMESERVERS)) { 2631 if (!strcmp(first_token, "nameserver") && (flags & DNS_OPTION_NAMESERVERS)) {
2632 const char *const nameserver = NEXT_TOKEN; 2632 const char *const nameserver = NEXT_TOKEN;
2633 struct in_addr ina; 2633 struct in_addr ina;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines