8a7accdd96ac08be3d214d2e5a5ac76657445db4
[u/mdw/catacomb] / keycheck-report.c
1 /* -*-c-*-
2 *
3 * $Id: keycheck-report.c,v 1.1 2001/02/03 16:08:24 mdw Exp $
4 *
5 * A standard reporter function
6 *
7 * (c) 2001 Straylight/Edgeware
8 */
9
10 /*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of Catacomb.
13 *
14 * Catacomb is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 *
19 * Catacomb is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
23 *
24 * You should have received a copy of the GNU Library General Public
25 * License along with Catacomb; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 * MA 02111-1307, USA.
28 */
29
30 /*----- Revision history --------------------------------------------------*
31 *
32 * $Log: keycheck-report.c,v $
33 * Revision 1.1 2001/02/03 16:08:24 mdw
34 * Add consistency checking for public keys.
35 *
36 */
37
38 /*----- Header files ------------------------------------------------------*/
39
40 #include <stdio.h>
41
42 #include "keycheck.h"
43
44 /*----- Main code ---------------------------------------------------------*/
45
46 /* --- @keycheck_stdreport@ --- *
47 *
48 * Arguments: @unsigned sev@ = problem severity
49 * @const char *msg@ = message to report
50 * @void *p@ = an uninteresting pointer
51 *
52 * Returns: Zero.
53 *
54 * Use: Reports a message to stderr.
55 */
56
57 int keycheck_stdreport(unsigned sev, const char *msg, void *p)
58 {
59 static const char *const sevtab[] = {
60 "informational", "warning", "error"
61 };
62 keycheck_reportctx *r = p;
63 if (r && sev < r->sev)
64 return (0);
65 fprintf(r ? r->fp : stderr, "keycheck: %s: %s\n", sevtab[sev], msg);
66 return (0);
67 }
68
69 /*----- that's all, folks -------------------------------------------------*/