Back to index

glibc  2.9
Functions | Variables
tst-xpg-basename.c File Reference
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

int main (void)

Variables

struct {
const char * path
const char * file
tests []

Function Documentation

int main ( void  )

Definition at line 42 of file tst-xpg-basename.c.

{
  size_t i = 0;
  int errors = 0;
  char path[1024];
  char *file;

  for (i = 0; i < sizeof (tests) / sizeof (tests [0]); ++i)
    {
      if (tests [i].path == NULL)
       file = __xpg_basename (NULL);
      else
       {
         strcpy (path, tests [i].path);
         file = __xpg_basename (path);
       }
      if (strcmp (file, tests [i].file))
       {
         printf ("Test with `%s' failed: Result is: `%s'.\n",
                (tests [i].path == NULL ? "NULL" : tests [i].path), file);
         errors = 1;
       }
    }

  return errors;
}

Here is the call graph for this function:


Variable Documentation

struct { ... } tests[] [static]