regcomp problem with 2.1.3

Andreas Jaeger aj@suse.de
Mon May 15 06:35:00 GMT 2000


Hi all,

Andreas Hartmann reported a problem with regular expressions in glibc
2.1.3.  He's written a small program to show the problem which I just
polished up a little bit.


The appended program gives the following error:
$ ./a.out 
<13>
<Invalid preceding regular expression>

Removing either of the RE_ options results in correct behaviour, but
the combination of both RE_BACKSLASH_ESCAPE_IN_LISTS and
RE_CONTEXT_INDEP_ANCHORS leads to an error in regcomp.

Could somebody please investigate what's wrong here?

Thanks,
Andreas

#include <ctype.h>
#include <regex.h>
#include <stdio.h>
#include <malloc.h>

int
main (void)
{
  regex_t *preg;
  int ret;

  preg = calloc(1, sizeof(regex_t));

  if((ret = regcomp(preg, "*.ANF", RE_BACKSLASH_ESCAPE_IN_LISTS|RE_CONTEXT_INDEP_ANCHORS)) != 0)
    {
      char errmsg[200];

      printf ("<%d>\n",ret);

      regerror(ret, preg, errmsg, 200);
      regfree(preg);

      printf ("<%s>\n",errmsg);
    }
}

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de



More information about the Libc-alpha mailing list