about summary refs log tree commit diff
path: root/inet/tst-ether_aton.c
blob: 76ce8af445a03cf095cb7817719a057ccd1d0b5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <netinet/ether.h>

int
main (int argc, char *argv[])
{
  struct ether_addr *val;
  int result;

  val = ether_aton ("12:34:56:78:9a:bc");

  printf ("ether_aton (\"12:34:56:78:9a:bc\") = %hhx:%hhx:%hhx:%hhx:%hhx:%hhx\n",
	  val->ether_addr_octet[0],
	  val->ether_addr_octet[1],
	  val->ether_addr_octet[2],
	  val->ether_addr_octet[3],
	  val->ether_addr_octet[4],
	  val->ether_addr_octet[5]);


  result = (val->ether_addr_octet[0] != 0x12
	    || val->ether_addr_octet[1] != 0x34
	    || val->ether_addr_octet[2] != 0x56
	    || val->ether_addr_octet[3] != 0x78
	    || val->ether_addr_octet[4] != 0x9a
	    || val->ether_addr_octet[5] != 0xbc);

  return result;
}