1 /* $NetBSD: query-loc.c,v 1.4 2014/12/10 04:37:56 christos Exp $ */
5 /* Id: query-loc.c,v 1.1 2008/02/15 01:47:15 marka Exp */
19 short verbose
= FALSE
;
29 while ((ch
= getopt (argc
, argv
, "vd:")) != EOF
)
37 debug
= atoi (optarg
);
40 (void) fprintf (stderr
,
41 "%s: illegal debug value.\n", progname
);
57 printf ("\nThis is %s, version %s.\n\n", progname
, VERSION
);
62 if ((addr
.s_addr
= inet_addr (host
)) == INADDR_NONE
)
65 printf ("%s is a name\n", host
);
66 loc
= getlocbyname (host
, FALSE
);
71 printf ("%s is an IP address ", host
);
72 hp
= (struct hostent
*) gethostbyaddr
73 ((char *) &addr
, sizeof (addr
), AF_INET
);
77 printf ("and %s is its official name\n",
79 loc
= getlocbyname (hp
->h_name
, FALSE
);
84 printf ("which has no name\n");
85 loc
= getlocbyaddr (addr
, NULL
);
90 printf ("No LOCation found for %s\n", host
);
96 printf ("LOCation for %s is ", host
);