Don't build sysctl as bootstrap tool. This helps us avoiding FreeBSD 4
[dragonfly.git] / libexec / bootpd / trygetea.c
1 /*
2  * trygetea.c - test program for getether.c
3  *
4  * $FreeBSD: src/libexec/bootpd/trygetea.c,v 1.5 1999/08/28 00:09:19 peter Exp $
5  * $DragonFly: src/libexec/bootpd/trygetea.c,v 1.2 2003/06/17 04:27:07 dillon Exp $
6  */
7
8 #include <sys/types.h>
9 #include <sys/socket.h>
10
11 #if defined(SUNOS) || defined(SVR4)
12 #include <sys/sockio.h>
13 #endif
14
15 #ifdef _AIX32
16 #include <sys/time.h>   /* for struct timeval in net/if.h */
17 #endif
18 #include <net/if.h>                             /* for struct ifreq */
19 #include <netinet/in.h>
20 #include <arpa/inet.h>                  /* inet_ntoa */
21
22 #include <netdb.h>
23 #include <stdio.h>
24 #include <ctype.h>
25 #include <errno.h>
26
27 #include "getether.h"
28
29 int debug = 0;
30 char *progname;
31
32 void
33 main(argc, argv)
34         int argc;
35         char **argv;
36 {
37         u_char ea[16];                          /* Ethernet address */
38         int i;
39
40         progname = argv[0];                     /* for report */
41
42         if (argc < 2) {
43                 printf("need interface name\n");
44                 exit(1);
45         }
46         if ((i = getether(argv[1], (char*)ea)) < 0) {
47                 printf("Could not get Ethernet address (rc=%d)\n", i);
48                 exit(1);
49         }
50         printf("Ether-addr");
51         for (i = 0; i < 6; i++)
52                 printf(":%x", ea[i] & 0xFF);
53         printf("\n");
54
55         exit(0);
56 }