.
[glibc/history.git] / inet / tst-ether_line.c
blobff0560b16a6f8c61a61a99ca460a272bfefab798
1 #include <stdio.h>
2 #include <string.h>
3 #include <netinet/ether.h>
6 static int
7 do_test (void)
9 struct ether_addr a;
10 char buf[1000];
11 if (ether_line ("00:01:02:03:04:05 aaaaa \n", &a, buf) != 0)
13 puts ("ether_line failed");
14 return 1;
17 int res = 0;
18 int i;
19 for (i = 0; i < ETH_ALEN; ++i)
21 printf ("%02x%s",
22 (int) a.ether_addr_octet[i], i + 1 == ETH_ALEN ? "" : ":");
23 if (a.ether_addr_octet[i] != i)
25 printf ("octet %d is %d, expected %d\n",
26 i, (int) a.ether_addr_octet[i], i);
27 res = 1;
31 printf (" \"%s\"\n", buf);
32 res |= strcmp (buf, "aaaaa") != 0;
34 return res;
37 #define TEST_FUNCTION do_test ()
38 #include "../test-skeleton.c"