3 * Framework for checking consistency of keys
5 * (c) 2001 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of Catacomb.
12 * Catacomb is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Library General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
17 * Catacomb is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with Catacomb; if not, write to the Free
24 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
28 /*----- Header files ------------------------------------------------------*/
32 #include <mLib/dstr.h>
36 /*----- Main code ---------------------------------------------------------*/
38 /* --- @keycheck_report@ --- *
40 * Arguments: @keycheck *kc@ = keycheck state
41 * @unsigned sev@ = severity of this report
42 * @const char *msg@ = message to send along
43 * @...@ = things to fill the message in with
45 * Returns: Zero to continue, or nonzero to stop and give up.
47 * Use: Reports a message to the user function.
50 int keycheck_report(keycheck *kc, unsigned sev, const char *msg, ...)
58 dstr_vputf(&d, msg, &ap);
60 rc = kc->func ? kc->func(sev, d.buf, kc->p) : 0;
65 /* --- @keycheck_init@ --- *
67 * Arguments: @keycheck *kc@ = pointer to block to initialize
68 * @int (*func)(unsigned sev, const char *msg, void *p)@ =
69 * handler function for problems
70 * @void *p@ = pointer to give to handler
74 * Use: Initializes a key checking context.
77 void keycheck_init(keycheck *kc,
78 int (*func)(unsigned /*sev*/,
86 for (i = 0; i < KCSEV_MAX; i++)
90 /* --- @keycheck_allclear@ --- *
92 * Arguments: @keycheck *kc@ = pointer to keycheck context
93 * @unsigned sev@ = minimum severity to care about
95 * Returns: Nonzero if no problems of @sev@ or above were noticed.
98 int keycheck_allclear(keycheck *kc, unsigned sev)
100 while (sev < KCSEV_MAX) {
108 /*----- That's all, folks -------------------------------------------------*/