AoD(3) AoD(3)
NAME
AoD - AssertOrDie
SYNTAX
#include <AF/AFUtils.h>
extern void AoD(int bool, char *errmsg, ...);
DESCRIPTION
AoD is essentially assert(3) except that the interface is more reasonable.
If the boolean is true (non zero), AoD returns. If the boolean is false
(0), AoD treats the rest of its arguments as arguments to fprintf(stderr,
errmsg, ...) and then calls exit(1);
ARGUMENTS
bool is a boolean value or an expression that evaluates to a boolean.
errmsg
is a format string in the style of printf(3).
... are extra optional arguments required by the format string errmsg.
EXAMPLES
Typical usage is:
AoD(argc > 3, "%s: Usage, at least 2 arguments!\n", argv[0]);
The general idea is to replace the proliferation of "fatal" subroutines
that seem to crop up everywhere with a single subroutine that everyone can
use.
SEE ALSO
assert(3)
BUGS
If you encounter a reproducible bug, please submit a problem report to
(af-bugs@crl.dec.com).
COPYRIGHT
Copyright 1990-1994, Digital Equipment Corporation.
See AF(1) for a full statement of rights and permissions.
AUTHORS
Larry Stewart, Digital Cambridge Research Lab