Back to index

glibc  2.9
Functions | Variables
testfnm.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include "fnmatch.h"

Go to the source code of this file.

Functions

int main (void)

Variables

struct {
const char * name
const char * pattern
int flags
int expected
tests []

Function Documentation

int main ( void  )

Definition at line 63 of file testfnm.c.

{
  size_t i;
  int errors = 0;

  for (i = 0; i < sizeof (tests) / sizeof (*tests); i++)
    {
      int match;

      match = fnmatch (tests[i].pattern, tests[i].name, tests[i].flags);

      printf ("[%2zd]  %s %s %s  -> %s\n", i, tests[i].pattern,
             match == 0 ? "matches" : "does not match",
             tests[i].name,
             match != tests[i].expected ? "FAIL" : "OK");

      if (match != tests[i].expected)
       ++errors ;
    }

  return errors != 0;
}

Here is the call graph for this function:


Variable Documentation

struct { ... } tests[]