13229Spst/* 23229Spst * trygetea.c - test program for getether.c 318471Swosch * 450476Speter * $FreeBSD$ 53229Spst */ 63229Spst 73229Spst#include <sys/types.h> 83229Spst#include <sys/socket.h> 93229Spst 103229Spst#if defined(SUNOS) || defined(SVR4) 113229Spst#include <sys/sockio.h> 123229Spst#endif 133229Spst 1413572Spst#ifdef _AIX32 1513572Spst#include <sys/time.h> /* for struct timeval in net/if.h */ 1613572Spst#endif 173229Spst#include <net/if.h> /* for struct ifreq */ 183229Spst#include <netinet/in.h> 193229Spst#include <arpa/inet.h> /* inet_ntoa */ 203229Spst 213229Spst#include <netdb.h> 223229Spst#include <stdio.h> 233229Spst#include <ctype.h> 243229Spst#include <errno.h> 253229Spst 2613572Spst#include "getether.h" 2713572Spst 283229Spstint debug = 0; 293229Spstchar *progname; 303229Spst 3113572Spstvoid 323229Spstmain(argc, argv) 3313572Spst int argc; 343229Spst char **argv; 353229Spst{ 363229Spst u_char ea[16]; /* Ethernet address */ 373229Spst int i; 383229Spst 393229Spst progname = argv[0]; /* for report */ 403229Spst 413229Spst if (argc < 2) { 423229Spst printf("need interface name\n"); 433229Spst exit(1); 443229Spst } 4513572Spst if ((i = getether(argv[1], (char*)ea)) < 0) { 463229Spst printf("Could not get Ethernet address (rc=%d)\n", i); 473229Spst exit(1); 483229Spst } 493229Spst printf("Ether-addr"); 503229Spst for (i = 0; i < 6; i++) 513229Spst printf(":%x", ea[i] & 0xFF); 523229Spst printf("\n"); 533229Spst 543229Spst exit(0); 553229Spst} 56