Import bind 9.5.2 vendor sources.
[dragonfly.git] / contrib / bind-9.5.2 / lib / isccc / result.c
blobcbedc16fb0cd96d47773e0da5ccddd70753a242a
1 /*
2 * Portions Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
3 * Portions Copyright (C) 2001, 2003 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
11 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
12 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 * Portions Copyright (C) 2001 Nominum, Inc.
19 * Permission to use, copy, modify, and/or distribute this software for any
20 * purpose with or without fee is hereby granted, provided that the above
21 * copyright notice and this permission notice appear in all copies.
23 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
24 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
26 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
27 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
28 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
29 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
32 /* $Id: result.c,v 1.10 2007/08/28 07:20:43 tbox Exp $ */
34 /*! \file */
36 #include <config.h>
38 #include <isc/once.h>
39 #include <isc/util.h>
41 #include <isccc/result.h>
42 #include <isccc/lib.h>
44 static const char *text[ISCCC_R_NRESULTS] = {
45 "unknown version", /* 1 */
46 "syntax error", /* 2 */
47 "bad auth", /* 3 */
48 "expired", /* 4 */
49 "clock skew", /* 5 */
50 "duplicate" /* 6 */
53 #define ISCCC_RESULT_RESULTSET 2
55 static isc_once_t once = ISC_ONCE_INIT;
57 static void
58 initialize_action(void) {
59 isc_result_t result;
61 result = isc_result_register(ISC_RESULTCLASS_ISCCC, ISCCC_R_NRESULTS,
62 text, isccc_msgcat,
63 ISCCC_RESULT_RESULTSET);
64 if (result != ISC_R_SUCCESS)
65 UNEXPECTED_ERROR(__FILE__, __LINE__,
66 "isc_result_register() failed: %u", result);
69 static void
70 initialize(void) {
71 isccc_lib_initmsgcat();
72 RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);
75 const char *
76 isccc_result_totext(isc_result_t result) {
77 initialize();
79 return (isc_result_totext(result));
82 void
83 isccc_result_register(void) {
84 initialize();