#include #include #include #include #include #include #include main(int argc, char**argv){ struct hostent h, *p; long now; if (argc!=2) { printf("Usage: %s hostname\n", argv[0]); exit(-1); } time(&now); printf("starting : gethostbyname(%s) at %s", argv[0], ctime(&now)); p=gethostbyname(argv[1]); if (p!=NULL) { printf("HOST=>%s\n",p->h_name); } else { printf("UNKNOWN HOST\n"); } time(&now); printf("ended : gethostbyname(%s) at %s", argv[0], ctime(&now)); }