/* testing for how to do dns lookups */

#include <stdio.h>
#include <netdb.h>  /* for gethostbyname */

int main(void) {
  struct hostent *phe;
  char *haddr = "128.230.1.55";

  phe = gethostbyname (haddr);
  if (phe == NULL) {
    puts ("nope.");
    return 1;
  }

  printf ("h_errno is %d\n", h_errno );
  printf ("pointer to h_addr_list is %p, [0] is %p\n",
	  phe->h_addr_list, phe->h_addr_list[0] );
  printf ("official name is %s.\n", phe->h_name );
  printf ("addr type is %d, len is %d\n",
	  phe->h_addrtype, phe->h_length );
  printf ("for %s, got %s.\n", haddr, phe->h_addr);
  return 0;
}
