/[jscoverage]/trunk/http-host.c
ViewVC logotype

Diff of /trunk/http-host.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 116 by siliconforks, Sat May 31 21:42:36 2008 UTC revision 125 by siliconforks, Mon Jun 2 17:52:38 2008 UTC
# Line 22  Line 22 
22  #include "http-server.h"  #include "http-server.h"
23    
24  #include <errno.h>  #include <errno.h>
 #include <netdb.h>  
25    
26  #include "util.h"  #include "util.h"
27    
28  int xgethostbyname(const char * host, struct in_addr * a) {  int xgethostbyname(const char * host, struct in_addr * a) {
29    #if defined(__CYGWIN__) || defined(__MINGW32__)
30      /* gethostbyname is thread-safe */
31      struct hostent * p = gethostbyname(host);
32      if (p == NULL || p->h_addrtype != AF_INET) {
33        return -1;
34      }
35      *a = *((struct in_addr *) p->h_addr);
36      return 0;
37    #else
38    struct hostent h;    struct hostent h;
39    struct hostent * p;    struct hostent * p;
40    char * buffer;    char * buffer;
# Line 47  Line 55 
55    *a = *((struct in_addr *) p->h_addr);    *a = *((struct in_addr *) p->h_addr);
56    free(buffer);    free(buffer);
57    return 0;    return 0;
58    #endif
59    }
60    
61    #ifndef HAVE_INET_ATON
62    int inet_aton(const char * name, struct in_addr * a) {
63      unsigned long result = inet_addr(name);
64      if (result == INADDR_NONE) {
65        return 0;
66      }
67      else {
68        a->s_addr = result;
69        return 1;
70      }
71  }  }
72    #endif

Legend:
Removed from v.116  
changed lines
  Added in v.125

  ViewVC Help
Powered by ViewVC 1.1.24