Back to index

glibc  2.9
Defines | Functions
tst-ether_line.c File Reference
#include <stdio.h>
#include <string.h>
#include <netinet/ether.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Defines

#define TEST_FUNCTION   do_test ()

Functions

static int do_test (void)

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 37 of file tst-ether_line.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 7 of file tst-ether_line.c.

{
  struct ether_addr a;
  char buf[1000];
  if (ether_line ("00:01:02:03:04:05       aaaaa   \n", &a, buf) != 0)
    {
      puts ("ether_line failed");
      return 1;
    }

  int res = 0;
  int i;
  for (i = 0; i < ETH_ALEN; ++i)
    {
      printf ("%02x%s",
             (int) a.ether_addr_octet[i], i + 1 == ETH_ALEN ? "" : ":");
      if (a.ether_addr_octet[i] != i)
       {
         printf ("octet %d is %d, expected %d\n",
                i, (int) a.ether_addr_octet[i], i);
         res = 1;
       }
    }

  printf (" \"%s\"\n", buf);
  res |= strcmp (buf, "aaaaa") != 0;

  return res;
}

Here is the call graph for this function: