3 /* $Id: query-loc.c,v 1.1 2008/02/15 01:47:15 marka Exp $ */
17 short verbose = FALSE;
27 while ((ch = getopt (argc, argv, "vd:")) != EOF)
35 debug = atoi (optarg);
38 (void) fprintf (stderr,
39 "%s: illegal debug value.\n", progname);
55 printf ("\nThis is %s, version %s.\n\n", progname, VERSION);
60 if ((addr.s_addr = inet_addr (host)) == INADDR_NONE)
63 printf ("%s is a name\n", host);
64 loc = getlocbyname (host, FALSE);
69 printf ("%s is an IP address ", host);
70 hp = (struct hostent *) gethostbyaddr
71 ((char *) &addr, sizeof (addr), AF_INET);
75 printf ("and %s is its official name\n",
77 loc = getlocbyname (hp->h_name, FALSE);
82 printf ("which has no name\n");
83 loc = getlocbyaddr (addr, NULL);
88 printf ("No LOCation found for %s\n", host);
94 printf ("LOCation for %s is ", host);