diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-05-31 09:13:34 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-05-31 09:13:34 +0000 |
commit | 8a4cbc733114d0a51bc324b466764d10985cbd80 (patch) | |
tree | 218dc2e4d069b9656143ab3e0de06aaa97c26209 /ext/socket/getaddrinfo.c | |
parent | 1307f8d555235116f0f0c79b9902df9cfd4bff12 (diff) |
990531
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/getaddrinfo.c')
-rw-r--r-- | ext/socket/getaddrinfo.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index e9ff9235e1..7ae41e6030 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -39,22 +39,28 @@ */ #include <sys/types.h> +#ifndef NT #include <sys/param.h> +#endif #ifdef HAVE_SYSCTL_H #include <sys/sysctl.h> #endif +#ifndef NT #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <arpa/nameser.h> #include <netdb.h> #include <resolv.h> +#include <unistd.h> +#else +#include <winsock2.h> +#endif #include <string.h> #include <stdio.h> #include <stdlib.h> #include <stddef.h> #include <ctype.h> -#include <unistd.h> #include "config.h" #include "addrinfo.h" @@ -355,7 +361,7 @@ getaddrinfo(hostname, servname, hints, res) pai->ai_socktype = SOCK_DGRAM; pai->ai_protocol = IPPROTO_UDP; } - port = htons(atoi(servname)); + port = htons((unsigned short)atoi(servname)); } else { struct servent *sp; char *proto; @@ -561,8 +567,10 @@ get_addr(hostname, af, res, pai, port0) int i, error = 0, h_error; char *ap; #ifndef INET6 +#ifndef NT extern int h_errno; #endif +#endif top = NULL; sentinel.ai_next = NULL; |