COMER(3) COMER(3)
NAME
comerr - common error display routine
SYNOPSIS
#include
void comerr (whoami, code, format, ...);
const char *whoami;
long code;
const char *format;
proc = setcomerrhook (proc);
void (* proc ) (const char *, long, const char *, valist);
proc = resetcomerrhook ();
void initializeXerrortable ();
DESCRIPTION
Comerr displays an error message on the standard error stream stderr
(see stdio(3S)) composed of the whoami string, which should specify the
program name or some subportion of a program, followed by an error mes-
sage generated from the code value (derived from compileet(1)), and a
string produced using the format string and any following arguments, in
the same style as fprintf(3).
The behavior of comerr can be modified using setcomerrhook; this
defines a procedure which is called with the arguments passed to
comerr, instead of the default internal procedure which sends the for-
matted text to error output. Thus the error messages from a program
can all easily be diverted to another form of diagnostic logging, such
as syslog(3). Resetcomerrhook may be used to restore the behavior
of comerr to its default form. Both procedures return the previous
``hook'' value. These ``hook'' procedures must have the declaration
given for proc above in the synopsis.
The initializeXerrortable routine is generated mechanically by
compileet(1) from a source file containing names and associated
strings. Each table has a name of up to four characters, which is used
in place of the X in the name of the routine. These routines should
be called before any of the corresponding error codes are used, so that
the comerr library will recognize error codes from these tables when
they are used.
The comerr.h header file should be included in any source file that
uses routines from the comerr library; executable files must be linked
using ``-lcomerr'' in order to cause the comerr library to be
included.
SEE ALSO
compileet (1), syslog (3).
Ken Raeburn, "A Common Error Description Library for UNIX".
SIPB 22 Nov 1988 COMER(3)
|