3 * Test program to see whether gethostbyaddr_r takes 7 arguments and returns
7 static const char rcsid[] = "$Id: hostentp_ghba_r.c,v 1.1 2002/11/04 12:27:35 chris Exp $";
15 #include <netinet/in.h>
18 struct in_addr localhost;
19 struct hostent hostbuf, *hp;
24 localhost.s_addr = htonl(INADDR_LOOPBACK);
26 while ((hp = gethostbyaddr_r((char*)&localhost, sizeof(struct in_addr),
27 AF_INET, &hostbuf, buf, buflen, &herr))
30 buf = (char*)realloc(buf, buflen *= 2);
32 /* We assume that the loopback address can always be resolved if
33 * gethostbyaddr_r is actually working. */
35 fprintf(stderr, "errno = %d, herr = %d\n", errno, herr);