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