bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Error in rx documentation


From: Edward F Eaglehouse
Subject: Error in rx documentation
Date: Thu, 12 Jul 2001 15:51:10 -0400

Package: rx
Version: 1.5

In the package documentation, source rx.texi, in the section "POSIX Entry
Points", the description for the functions reads:

  Function: int regexec (regex_t *compiled, char *string, size_t nmatch,
regmatch_t matchptr [], int eflags)
  Function: int regnexec (regex_t *compiled, char *string, int len, size_t
nmatch, regmatch_t matchptr [], int eflags)
    This function tries to match the compiled regular expression *compiled
against string.

After tracking down a compile-time error when trying to use it, I found out
that the "regmatch_t matchptr[]" should really read "regmatch_t *
matchptr[]".

I had originally tried to cast the address to my array as "(regmatch_t **)"
to avoid the compiler error, but then I was getting invalid results,
probably trampling some memory along the way. When I allocated a new
variable containing a pointer to the array, then passed its address,
everything seemed to work as I expected. E.g.

    ...
    regmatch_t aRegMatch[10];
    regmatch_t * pRegMatch = &aRegMatch[0];

    iResult = regexec(pCompiledRegEx, pszString,
        sizeof (aRegMatch) / sizeof (aRegMatch[0]),
        &pRegMatch, 0);

There was also no mention of the REG_ALLOC_REGS for eflags.

REG_ICASE shows usage in both cflags and eflags. It makes more sense to me
in eflags, but I think it should be documented.

The documentation doesn't mention the anchor characters '^' and '$' either,
except in passing.


Cordially,
Edward F Eaglehouse <address@hidden>
<mailto:address@hidden> Automated Solutions Corp
Phone: 330-659-6335




reply via email to

[Prev in Thread] Current Thread [Next in Thread]