1 --- ./src/Makefile.dist.org Fri Jul 19 08:45:04 2002
2 +++ ./src/Makefile.dist Mon Jul 29 17:55:33 2002
4 # If we have the timezone() function, we can try that as well
5 #HAVE_TIMEZONE=-DHAVE_TIMEZONE
7 +# If we have the getaddrinfo() function, we can try that as well
8 +#HAVE_GETADDRINFO=-DHAVE_GETADDRINFO
10 # If we don't have the strchr function then define this
11 #NEED_STRCHR=-DNEED_STRCHR
15 # Now set up the initial command line. SUNOS_5 makes this a bit wierd.
17 -CFLAGS=-I./inc ${GNU_STRFTIME} ${NEED_SNPRINTF} ${NEED_FLOCK} ${DEC_UNIX} ${IRIX} ${USE_HITCHING_LOCK} ${NO_MEMMOVE} ${NEED_STRERROR} ${NO_TM_GMTOFF} ${HAVE_TZNAME} ${HAVE_TIMEZONE} ${NEED_STRCHR} ${NEED_STRRCHR} ${MY_PRINTF_IS_BRAINDEAD} ${DETECT_BROKEN_HOSTNAME}
18 +CFLAGS=-I./inc ${GNU_STRFTIME} ${NEED_SNPRINTF} ${NEED_FLOCK} ${DEC_UNIX} ${IRIX} ${USE_HITCHING_LOCK} ${NO_MEMMOVE} ${NEED_STRERROR} ${NO_TM_GMTOFF} ${HAVE_TZNAME} ${HAVE_TIMEZONE} ${NEED_STRCHR} ${NEED_STRRCHR} ${MY_PRINTF_IS_BRAINDEAD} ${DETECT_BROKEN_HOSTNAME} ${HAVE_GETADDRINFO}
20 -CFLAGS=-I./inc -DSUNOS_5 ${GNU_STRFTIME} ${NEED_SNPRINTF} ${NEED_FLOCK} ${USE_HITCHING_LOCK} ${NO_MEMMOVE} ${NEED_STRERROR} ${NO_TM_GMTOFF} ${HAVE_TZNAME} ${HAVE_TIMEZONE} ${NEED_STRCHR} ${NEED_STRRCHR} ${MY_PRINTF_IS_BRAINDEAD}
21 +CFLAGS=-I./inc -DSUNOS_5 ${GNU_STRFTIME} ${NEED_SNPRINTF} ${NEED_FLOCK} ${USE_HITCHING_LOCK} ${NO_MEMMOVE} ${NEED_STRERROR} ${NO_TM_GMTOFF} ${HAVE_TZNAME} ${HAVE_TIMEZONE} ${NEED_STRCHR} ${NEED_STRRCHR} ${MY_PRINTF_IS_BRAINDEAD} ${HAVE_GETADDRINFO}
24 # Now set up the initial library path. Once again, SUNOS_5 makes this
25 --- ./src/io.c.org Fri Jul 19 08:45:04 2002
26 +++ ./src/io.c Mon Jul 29 17:59:54 2002
28 /* Open a socket to a specific host/port */
29 int sock_open(const char *conhostname, int port, LSOCKET *sock)
31 - struct hostent *conhost;
32 - struct sockaddr_in name;
36 +#ifdef HAVE_GETADDRINFO
37 + char pbuf[NI_MAXSERV];
38 + struct addrinfo hints, *res, *res0;
41 - conhost = gethostbyname(conhostname);
44 + sprintf(pbuf, "%d", port);
45 + pbuf[sizeof(pbuf)-1] = '\0';
46 + memset(&hints, 0, sizeof(hints));
47 + hints.ai_family = AF_UNSPEC;
48 + hints.ai_socktype = SOCK_STREAM;
49 + if (getaddrinfo(conhostname, pbuf, &hints, &res0) != 0)
52 - name.sin_port = htons(port);
53 - name.sin_family = AF_INET;
54 - bcopy((char *)conhost->h_addr, (char *)&name.sin_addr, conhost->h_length);
55 - mysock = socket(AF_INET, SOCK_STREAM, 0);
56 - addr_len = sizeof(name);
58 - if (connect(mysock, (struct sockaddr *)&name, addr_len) == -1)
64 + for (res = res0; res != NULL; res = res->ai_next) {
65 + mysock = socket(res->ai_family, res->ai_socktype, 0);
68 + if (connect(mysock, res->ai_addr, res->ai_addrlen) == -1) {
78 +#else /* HAVE_GETADDRINFO */
80 + struct hostent *conhost;
81 + struct sockaddr_in name;
84 + conhost = gethostbyname(conhostname);
88 + name.sin_port = htons(port);
89 + name.sin_family = AF_INET;
90 + bcopy((char *)conhost->h_addr, (char *)&name.sin_addr, conhost->h_length);
91 + mysock = socket(AF_INET, SOCK_STREAM, 0);
92 + addr_len = sizeof(name);
94 + if (connect(mysock, (struct sockaddr *)&name, addr_len) == -1)
96 +#endif /* HAVE_GETADDRINFO */
103 int sock_close(LSOCKET sock)