freebsd-nq/libexec/bootpd/trylook.c

59 lines
812 B
C
Raw Normal View History

1994-09-30 05:45:07 +00:00
/*
* trylook.c - test program for lookup.c
1996-09-22 21:56:57 +00:00
*
1997-02-22 14:22:49 +00:00
* $Id$
1994-09-30 05:45:07 +00:00
*/
#include <sys/types.h>
#include <netinet/in.h>
#include <stdio.h>
#include "report.h"
#include "lookup.h"
extern char *ether_ntoa();
extern char *inet_ntoa();
int debug = 0;
char *progname;
1996-01-23 01:35:04 +00:00
void
1994-09-30 05:45:07 +00:00
main(argc, argv)
1996-01-23 01:35:04 +00:00
int argc;
1994-09-30 05:45:07 +00:00
char **argv;
{
int i;
struct in_addr in;
char *a;
u_char *hwa;
progname = argv[0]; /* for report */
for (i = 1; i < argc; i++) {
/* Host name */
printf("%s:", argv[i]);
/* IP addr */
if (lookup_ipa(argv[i], &in.s_addr))
a = "?";
else
a = inet_ntoa(in);
printf(" ipa=%s", a);
/* Ether addr */
1996-01-23 01:35:04 +00:00
printf(" hwa=");
1994-09-30 05:45:07 +00:00
hwa = lookup_hwa(argv[i], 1);
if (!hwa)
1996-01-23 01:35:04 +00:00
printf("?\n");
else {
int i;
for (i = 0; i < 6; i++)
printf(":%x", hwa[i] & 0xFF);
putchar('\n');
}
1994-09-30 05:45:07 +00:00
}
exit(0);
}