result.c revision 1255d388f034dc556d235a002527101781dbeb29
5fa46bc91672ef5737aee6f99763161511566c24Tinderbox User * Copyright (C) 1998-2001 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Permission to use, copy, modify, and distribute this software for any
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater * purpose with or without fee is hereby granted, provided that the above
9178881e1bf6a4b01db886b355406c8bed61cc2aMichael Graff * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26696386938e70e93d7dde509d7bc45ead5870b7Mark Andrews/* $Id: result.c,v 1.57 2001/10/22 07:09:21 marka Exp $ */
ce24330566b66a5ca8522fa948fb36b94a4d6981Mark Andrewstypedef struct resulttable {
6028d1ce0380d0ba7f6c6ecd1ad20b31ddd1becbDavid Lawrence unsigned int base;
364a82f7c25b62967678027043425201a5e5171aBob Halley unsigned int last;
9178881e1bf6a4b01db886b355406c8bed61cc2aMichael Graff const char ** text;
be066f0629a12e11bc17f27671036b3f451bd5eaBrian Wellingtonregister_table(unsigned int base, unsigned int nresults, const char **text,
c95a89b433e42ecf9108b6c263f405fecc0d8a65Michael Sawyer * We use malloc() here because we we want to be able to use
c95a89b433e42ecf9108b6c263f405fecc0d8a65Michael Sawyer * isc_result_totext() even if there is no memory context.
c95a89b433e42ecf9108b6c263f405fecc0d8a65Michael Sawyer RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS);
c95a89b433e42ecf9108b6c263f405fecc0d8a65Michael Sawyer result = register_table(ISC_RESULTCLASS_ISC, ISC_R_NRESULTS, text,
c95a89b433e42ecf9108b6c263f405fecc0d8a65Michael Sawyer "register_table() %s: %u",
c95a89b433e42ecf9108b6c263f405fecc0d8a65Michael Sawyer isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,
c95a89b433e42ecf9108b6c263f405fecc0d8a65Michael Sawyer RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);
97e7d389d54a9e3a1ba8313ed140b04afabc7081Michael Graff if (result >= table->base && result <= table->last) {
9178881e1bf6a4b01db886b355406c8bed61cc2aMichael Graff * Note: we use 'index + 1' as the message number
97e7d389d54a9e3a1ba8313ed140b04afabc7081Michael Graff * instead of index because isc_msgcat_get() requires
97e7d389d54a9e3a1ba8313ed140b04afabc7081Michael Graff * the message number to be > 0.
f9df80f4348ef68043903efa08299480324f4823Michael Graff text = isc_msgcat_get(table->msgcat, table->set,
f9df80f4348ef68043903efa08299480324f4823Michael Graff text = isc_msgcat_get(isc_msgcat, ISC_RESULT_UNAVAILABLESET,
9178881e1bf6a4b01db886b355406c8bed61cc2aMichael Graffisc_result_register(unsigned int base, unsigned int nresults,
9178881e1bf6a4b01db886b355406c8bed61cc2aMichael Graff const char **text, isc_msgcat_t *msgcat, int set)