1 /* $NetBSD: lib.c,v 1.4 2014/12/10 04:38:01 christos Exp $ */
2
3 /*
4 * Portions Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
5 * Portions Copyright (C) 2001 Internet Software Consortium.
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
12 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
13 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
14 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 *
19 * Portions Copyright (C) 2001 Nominum, Inc.
20 *
21 * Permission to use, copy, modify, and/or distribute this software for any
22 * purpose with or without fee is hereby granted, provided that the above
23 * copyright notice and this permission notice appear in all copies.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
26 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
27 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
28 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
29 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
30 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
31 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
32 */
33
34 /* Id: lib.c,v 1.9 2007/08/28 07:20:43 tbox Exp */
35
36 /*! \file */
37
38 #include <config.h>
39
40 #include <stddef.h>
41
42 #include <isc/once.h>
43 #include <isc/msgcat.h>
44 #include <isc/util.h>
45
46 #include <isccc/lib.h>
47
48 /***
49 *** Globals
50 ***/
51
52 LIBISCCC_EXTERNAL_DATA isc_msgcat_t * isccc_msgcat = NULL;
53
54
55 /***
56 *** Private
57 ***/
58
59 static isc_once_t msgcat_once = ISC_ONCE_INIT;
60
61
62 /***
63 *** Functions
64 ***/
65
66 static void
open_msgcat(void)67 open_msgcat(void) {
68 isc_msgcat_open("libisccc.cat", &isccc_msgcat);
69 }
70
71 void
isccc_lib_initmsgcat(void)72 isccc_lib_initmsgcat(void) {
73
74 /*
75 * Initialize the DNS library's message catalog, isccc_msgcat, if it
76 * has not already been initialized.
77 */
78
79 RUNTIME_CHECK(isc_once_do(&msgcat_once, open_msgcat) == ISC_R_SUCCESS);
80 }
81