Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>regerror</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
regerror
========

Syntax
------


     #include <sys/types.h>
     #include <regex.h>
     
     size_t regerror(int errcode, const regex_t *preg,
                     char *errbuf, size_t errbuf_size);

Description
-----------

`regerror' maps a non-zero value of ERRCODE from either `regcomp'
(Return Value, regcomp:.) or `regexec' (Return Value, *note   
regexec::.) to a human-readable, printable message.

If PREG is non-`NULL', the error code should have arisen from use of
the variable of the type `regex_t' pointed to by PREG, and if the error
code came from `regcomp', it should have been the result from the most
recent `regcomp' using that `regex_t' variable.  (`regerror' may be
able to supply a more detailed message using information from the
`regex_t' than from ERRCODE alone.)  `regerror' places the
`NUL'-terminated message into the buffer pointed to by ERRBUF, limiting
the length (including the `NUL') to at most ERRBUF_SIZE bytes.  If the
whole message won't fit, as much of it as will fit before the
terminating `NUL' is supplied.  In any case, the returned value is the
size of buffer needed to hold the whole message (including terminating
`NUL').  If ERRBUF_SIZE is 0, ERRBUF is ignored but the return value is
still correct.

If the ERRCODE given to `regerror' is first ORed with `REG_ITOA', the
"message" that results is the printable name of the error code, e.g.
"REG_NOMATCH", rather than an explanation thereof.  If ERRCODE is
`REG_ATOI', then PREG shall be non-NULL and the `re_endp' member of the
structure it points to must point to the printable name of an error code
(e.g. "REG_ECOLLATE"); in this case, the result in ERRBUF is the
decimal representation of the numeric value of the error code (0 if the
name is not recognized).  `REG_ITOA' and `REG_ATOI' are intended
primarily as debugging facilities; they are extensions, compatible with
but not specified by POSIX 1003.2, and should be used with caution in
software intended to be portable to other systems.  Be warned also that
they are considered experimental and changes are possible.

Return Value
------------

The size of buffer needed to hold the message (including terminating
`NUL') is always returned, even if ERRBUF_SIZE is zero.


See Also: regcomp

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson