1 /* $NetBSD: trylook.c,v 1.4 2002/07/14 00:26:18 wiz Exp $ */ 2 3 #include <sys/cdefs.h> 4 #ifndef lint 5 __RCSID("$NetBSD: trylook.c,v 1.4 2002/07/14 00:26:18 wiz Exp $"); 6 #endif 7 8 /* 9 * trylook.c - test program for lookup.c 10 */ 11 12 #include <sys/types.h> 13 #include <netinet/in.h> 14 #include <stdio.h> 15 16 #include "report.h" 17 #include "lookup.h" 18 19 extern char *ether_ntoa(struct ether_addr *); 20 extern char *inet_ntoa(struct in_addr); 21 22 int debug = 0; 23 char *progname; 24 25 int 26 main(int argc, char **argv) 27 { 28 int i; 29 struct in_addr in; 30 char *a; 31 u_char *hwa; 32 33 progname = argv[0]; /* for report */ 34 35 for (i = 1; i < argc; i++) { 36 37 /* Host name */ 38 printf("%s:", argv[i]); 39 40 /* IP addr */ 41 if (lookup_ipa(argv[i], &in.s_addr)) 42 a = "?"; 43 else 44 a = inet_ntoa(in); 45 printf(" ipa=%s", a); 46 47 /* Ether addr */ 48 hwa = lookup_hwa(argv[i], 1); 49 if (!hwa) 50 a = "?"; 51 else 52 a = ether_ntoa(hwa); 53 printf(" hwa=%s\n", a); 54 55 } 56 exit(0); 57 } 58