]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - libexec/bootpd/trygetea.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / libexec / bootpd / trygetea.c
1 /*
2  * trygetea.c - test program for getether.c
3  *
4  * $FreeBSD$
5  */
6
7 #include <sys/types.h>
8 #include <sys/socket.h>
9
10 #if defined(SUNOS) || defined(SVR4)
11 #include <sys/sockio.h>
12 #endif
13
14 #ifdef _AIX32
15 #include <sys/time.h>   /* for struct timeval in net/if.h */
16 #endif
17 #include <net/if.h>                             /* for struct ifreq */
18 #include <netinet/in.h>
19 #include <arpa/inet.h>                  /* inet_ntoa */
20
21 #include <netdb.h>
22 #include <stdio.h>
23 #include <ctype.h>
24 #include <errno.h>
25
26 #include "getether.h"
27
28 int debug = 0;
29 char *progname;
30
31 void
32 main(argc, argv)
33         int argc;
34         char **argv;
35 {
36         u_char ea[16];                          /* Ethernet address */
37         int i;
38
39         progname = argv[0];                     /* for report */
40
41         if (argc < 2) {
42                 printf("need interface name\n");
43                 exit(1);
44         }
45         if ((i = getether(argv[1], (char*)ea)) < 0) {
46                 printf("Could not get Ethernet address (rc=%d)\n", i);
47                 exit(1);
48         }
49         printf("Ether-addr");
50         for (i = 0; i < 6; i++)
51                 printf(":%x", ea[i] & 0xFF);
52         printf("\n");
53
54         exit(0);
55 }