Back to index

glibc  2.9
Classes | Functions | Variables
bug-regex27.c File Reference
#include <regex.h>
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Classes

struct  tests

Functions

int main (void)

Variables

struct tests tests []

Class Documentation

struct tests

Definition at line 25 of file bug-regex27.c.

Class Members
int cflags
const char * input
const char * regex
uint32_t result
int retval
const char * string
reg_syntax_t syntax
int valid

Function Documentation

int main ( void  )

Definition at line 39 of file bug-regex27.c.

{
  regex_t r;
  size_t i;
  int ret = 0;

  for (i = 0; i < sizeof (tests) / sizeof (tests[i]); ++i)
    {
      memset (&r, 0, sizeof (r));
      if (regcomp (&r, tests[i].regex, tests[i].cflags))
       {
         printf ("regcomp %zd failed\n", i);
         ret = 1;
         continue;
       }
      int rv = regexec (&r, tests[i].string, 0, NULL, 0);
      if (rv != tests[i].retval)
       {
         printf ("regexec %zd unexpected value %d != %d\n",
                i, rv, tests[i].retval);
         ret = 1;
       }
      regfree (&r);
    }
  return ret;
}

Here is the call graph for this function:


Variable Documentation

struct tests tests[]