It's definitely correct in 2.4. I know it was broken in 2.0 and 2.1.
I'm not sure about 2.2.
Here's my quick and dirty test program for those of you who want
to play at home:
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
main(argc, argv)
int argc;
char **argv;
{
struct hostent *ht;
char gbuf[1500];
if (argc < 2) {
fprintf(stderr, "not enough args\n");
exit(1);
}
while (--argc) {
printf("looking up: %s\n", argv[argc]);
ht = gethostbyname(argv[argc]);
printf("found, %s\n", ht->h_name);
}
}