regerror()

map regcomp() error code to printable string 

Function


SYNOPSIS

#include <sys/types.h>

#include <regex.h>

size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size);


DESCRIPTION

The regerror() function provides a mapping from error codes returned by regcomp() and regexec() to unspecified printable strings. It generates a string corresponding to the value of the errcode argument, which must be the last nonzero value returned by regcomp() or regexec() with the given value of preg. If errcode is not such a value, the content of the generated string is unspecified.

If preg is a null pointer, but errcode is a value returned by a previous call to regexec() or regcomp(), the regerror() still generates an error string corresponding to the value of errcode, but it might not be as detailed under some implementations.

If the errbuf_size argument is not 0, regerror() places the generated string into the buffer of size errbuf_size bytes pointed to by errbuf. If the string (including the terminating null) cannot fit in the buffer, regerror() truncates the string and null-terminates the result.

If errbuf_size is 0, regerror() ignores the errbuf argument, and returns the size of the buffer needed to hold the generated string.


PARAMETERS

errcode 

Is the last nonzero value that regcomp() or regexec() returns.

preg 

Points to the given value in errcode.

errbuf 

Points to the errbuf_size parameter.

errbuf_size 

If not zero, indicates the place where regerror() places the generated string into the errbuf_size-byte buffer that errbuf points to. If the size is zero, regerror() ignores this parameter and returns an integer value.


RETURN VALUES

If successful, the regerror() function returns the size of the buffer needed to hold the entire generated string, including the null termination. If the return value is greater than errbuf_size, the string returned in the buffer that errbuf points to has been truncated.


CONFORMANCE

POSIX.2 (1996)


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
regcomp(), regexec(), regfree()


PTC MKS Toolkit 10.4 Documentation Build 39.