Table of Contents

NAME

QccErrorAddMessage, QccErrorPrintMessages, QccErrorExit, QccErrorWarning - error-message handling

SYNOPSIS

#include "libQccPack.h"

void QccErrorAddMessage(const char *format, ...);
void QccErrorPrintMessages(void);
void QccErrorClearMessages(void);
void QccErrorExit(void);
void QccErrorWarning(const char *format, ...);

void QccErrorAddMessageVA(const char *format, va_list ap);
void QccErrorWarningVA(const char *format, va_list ap);

DESCRIPTION

The QccErrorAddMessage(), QccErrorPrintMessages(), and QccErrorExit() routines provide automatic handling of error messages for programs and routines using the QccPack library. The QccPack library maintains a list of error messages. QccErrorAddMessage() is used to add a message to this list; QccErrorPrintMessages() is used to print the messages to stderr; QccErrorExit() is used to print the messages to stderr and then exit the current program.

QccErrorAddMessage() accepts a format string and a subsequent variable-length argument list in the style of printf(3) ; this format string and argument list are used to assemble an error-message string. The resulting error-message string is stored in a list of error messages, and control is returned to the calling routine. QccErrorAddMessage() uses vsnprintf(3) to generate the error message and the facilities of stdarg(3) to implement the variable-length argument list.

QccErrorPrintMessages() dumps the current list of error messages to stderr. QccErrorPrintMessages() takes care, when possible, to nicely wrap long lines of text onto multiple output lines without splitting words. After the messages are output, the message list maintained by the QccPack library is cleared via a call to QccErrorClearMessages(), and control is returned to the calling routine.

QccErrorClearMessages() removes all messages from the message list maintain by QccPack.

QccErrorExit() calls QccErrorPrintMessages() to dump the current list of messages to stderr and then causes program termination, returning a value of QCCEXIT_ERROR to the parent. QccErrorExit() does not return.

QccErrorWarning() accepts a warning message in the same manner that QccErrorAddMessage() accepts an error message; however, the warning message is written immediately to stderr rather than being stored in a list of messages, as in the case of QccErrorAddMessage(). This is useful to provide the user with important, but noncritical, warning information.

QccErrorAddMessageVA() and QccErrorWarningVA() function indentically to QccErrorAddMessage() and QccErrorWarning(), respectively, except that QccErrorAddMessageVA() and QccErrorWarningVA() can be called from a function whose own argument list contains a variable number of arguments implemented via the variable-length argument facilities of stdarg(3) .

SEE ALSO

QccExit(3) , QccInit(3) , printf(3) , stdarg(3) , exit(3) , QccPack(3)

AUTHOR

Copyright (C) 1997-2021 James E. Fowler


Table of Contents



Get QccPack at SourceForge.net. Fast, secure and Free Open Source software downloads