void usrerr(msg, arg1, ...)
#include <funclist.h>
extern FUNCLIST *SyserrFuncs;
extern FUNCLIST *UsrerrFuncs;
Both routines label the message with the contents of the ProgName variable, which is set by parseargs(3) to the name of the invoking program. The msg and up to five arguments are passed to fprintf(3) to be printed. The message should not contain a trailing newline; this is added internally. The contents of the errno global variable is then appended to the message.
After printing the message, syserr invokes the SyserrFuncs function list. A member function can attempt to clean up and return to a top loop using longjmp(3) or some similar mechanism. If the function list returns normally, the process is terminated.
After usrerr prints the message, it invokes the UsrerrFuncs function list. Member functions can use non-local jumps if a ``quick abort'' policy is desired. If this function list returns, usrerr returns to the caller. The global errno variable is reset to zero.
Messages printed by syserr should probably also be logged using syslog(3) or the equivalent.
It is possible to get recursive calls to syserr if one of the SyserrFuncs calls syserr. Similar comments apply to usrerr.