2 * Copyright (C) 1997-2001 Internet Software Consortium.
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
9 * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
10 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
11 * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
13 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
14 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
15 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: assertions.c,v 1.16 2001/07/16 03:52:05 mayer Exp $ */
25 #include <isc/assertions.h>
33 default_callback(const char *, int, isc_assertiontype_t, const char *);
39 LIBISC_EXTERNAL_DATA isc_assertioncallback_t isc_assertion_failed =
43 isc_assertion_setcallback(isc_assertioncallback_t cb) {
45 isc_assertion_failed = default_callback;
47 isc_assertion_failed = cb;
51 isc_assertion_typetotext(isc_assertiontype_t type) {
55 * These strings have purposefully not been internationalized
56 * because they are considered to essentially be keywords of
57 * the ISC development environment.
60 case isc_assertiontype_require:
63 case isc_assertiontype_ensure:
66 case isc_assertiontype_insist:
69 case isc_assertiontype_invariant:
83 default_callback(const char *file, int line, isc_assertiontype_t type,
86 fprintf(stderr, "%s:%d: %s(%s) %s.\n",
87 file, line, isc_assertion_typetotext(type), cond,
88 isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
89 ISC_MSG_FAILED, "failed"));