result.c revision 1bb3831e13a65afd87078c88e0285d23b1e0bcdf
313b0ea9f258edd8530f4454c69e6ba194280162Tinderbox User * Copyright (C) 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC")
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * Copyright (C) 1998-2001, 2003 Internet Software Consortium.
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater * Permission to use, copy, modify, and/or distribute this software for any
e08daafffce8fb74ffca8ecf5772e334299ccf76Bob Halley * purpose with or without fee is hereby granted, provided that the above
e08daafffce8fb74ffca8ecf5772e334299ccf76Bob Halley * copyright notice and this permission notice appear in all copies.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PERFORMANCE OF THIS SOFTWARE.
28a8f5b0de57d269cf2845c69cb6abe18cbd3b3aMark Andrews/* $Id: result.c,v 1.72 2012/01/27 01:21:41 marka Exp $ */
d8c1e4eccf5bf88a3b4f8dc4a24391b5712bb3a3Mark Andrewstypedef struct resulttable {
e08daafffce8fb74ffca8ecf5772e334299ccf76Bob Halley unsigned int base;
64a84169d7eed05486b10be90afea58f4af146f9Brian Wellington unsigned int last;
9cd6d409b78a6f833b681c13a68fbdc7c024fe66David Lawrence const char ** text;
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 "address mask not contiguous", /*%< 37 */
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrewsregister_table(unsigned int base, unsigned int nresults, const char **text,
aa39170da817cae7b4c6c735cc832e05ec3d2351Mark Andrews * We use malloc() here because we we want to be able to use
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews * isc_result_totext() even if there is no memory context.
9cd6d409b78a6f833b681c13a68fbdc7c024fe66David Lawrence RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS);
9cd6d409b78a6f833b681c13a68fbdc7c024fe66David Lawrence result = register_table(ISC_RESULTCLASS_ISC, ISC_R_NRESULTS, text,
e08daafffce8fb74ffca8ecf5772e334299ccf76Bob Halley "register_table() %s: %u",
64a84169d7eed05486b10be90afea58f4af146f9Brian Wellington RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);
64a84169d7eed05486b10be90afea58f4af146f9Brian Wellington if (result >= table->base && result <= table->last) {
64a84169d7eed05486b10be90afea58f4af146f9Brian Wellington * Note: we use 'index + 1' as the message number
64a84169d7eed05486b10be90afea58f4af146f9Brian Wellington * instead of index because isc_msgcat_get() requires
64a84169d7eed05486b10be90afea58f4af146f9Brian Wellington * the message number to be > 0.
64a84169d7eed05486b10be90afea58f4af146f9Brian Wellington text = isc_msgcat_get(table->msgcat, table->set,
64a84169d7eed05486b10be90afea58f4af146f9Brian Wellington text = isc_msgcat_get(isc_msgcat, ISC_RESULT_UNAVAILABLESET,
64a84169d7eed05486b10be90afea58f4af146f9Brian Wellingtonisc_result_register(unsigned int base, unsigned int nresults,
e08daafffce8fb74ffca8ecf5772e334299ccf76Bob Halley const char **text, isc_msgcat_t *msgcat, int set)