For the convenience of programmers instrumenting their code, several libcpc functions automatically emit to stderr
error messages that attempt to provide a more detailed explanation of their
error return values. While this can be useful for simple programs, some
applications may wish to report their errors differently--for example,
to a window or to a log file.
The cpc_seterrfn() function allows the caller to
provide an alternate function for reporting errors; the type signature is
shown above. The fn argument is passed the library
function name that detected the error, the format string fmt and argument pointer ap can be passed
directly to vsnprintf(3C)
or similar varargs-based routine for formatting.
The default printing routine can be restored by calling the routine
with an errfn argument of NULL.
|