Back to index

glibc  2.9
Functions | Variables
bug-regex13.c File Reference
#include <sys/types.h>
#include <mcheck.h>
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

int main (void)

Variables

struct {
int syntax
const char * pattern
const char * string
int start
tests []

Function Documentation

int main ( void  )

Definition at line 67 of file bug-regex13.c.

{
  struct re_pattern_buffer regbuf;
  const char *err;
  size_t i;
  int ret = 0;

  mtrace ();

  for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
    {
      int start;
      re_set_syntax (tests[i].syntax);
      memset (&regbuf, '\0', sizeof (regbuf));
      err = re_compile_pattern (tests[i].pattern, strlen (tests[i].pattern),
                                &regbuf);
      if (err != NULL)
       {
         printf ("re_compile_pattern failed: %s\n", err);
         ret = 1;
         continue;
       }

      start = re_search (&regbuf, tests[i].string, strlen (tests[i].string),
                         0, strlen (tests[i].string), NULL);
      if (start != tests[i].start)
       {
         printf ("re_search failed %d\n", start);
         ret = 1;
         regfree (&regbuf);
         continue;
       }
      regfree (&regbuf);
    }

  return ret;
}

Here is the call graph for this function:


Variable Documentation

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