ERRSTK(3)
NAME
errstk, perrstk, initerrstk
- functions to maintain a stack or error messages
SYNOPSIS
#include <varargs.h>
void errstk (va_alist);
void perrstk (int (*errfunc)());
void initerrstk ();
DESCRIPTION
This is a set of routines to maintain an error stack. Each
time a called procedure gets an error, it can push a message
onto the error stack.The top level procedure can then print
the error stack to view the errors reported in the calling
sequence. When a moudule is first called the error stack is
initialized. The error stack is re-initialized when
perrstk() is called.
errstk Add error onto the error stack. This routine mallocs
storage and puts the error string in it and links this
string to the head of any previous error strings, thereby
forming an error stack. If errstk() itself gets an error,
like can't malloc, it will put a pre-assigned string such as
"errstk() can't malloc" on top of the error stack and
return. The calling error string will be lost, but any pre-
vious error stack will be intact. Any further calls to
errstk() will also be lost, until the error stack is re-
initialized.
perrstk This routine prints all strings in the current error
stack in LIFO order by calling the function pointed to. The
function must be one that takes a vararg sting and prints it
to where you want, e.g. printf() or write_log(). Normally
this will just be the errlog() arg passed to a strategy
module. perrstk then initializes the error stack.
initerrstk Lets you explicitly clear the error stack and
free any storage.
OPTIONS
none
EXAMPLES
errstk("M-sample not recognized: %s\n", m_sample);
perrstk((int(*)(const char*,...))errlog);
also see soi strategy modules
SEE ALSO
DIAGNOSTICS
"errstk() can't malloc. err msg(s) lost"
BUGS
none known
HISTORY
1995-09-20 SOI Version 1.0.2