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