chiark / gitweb /
Move SYM_NAME into the header file. Fix bugs.
[mLib] / report.c
CommitLineData
0875b58f 1/* -*-c-*-
2 *
3 * $Id: report.c,v 1.1 1998/06/17 23:44:42 mdw Exp $
4 *
5 * Reporting errors and things
6 *
7 * (c) 1998 Straylight/Edgeware
8 */
9
10/*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of the mLib utilities library.
13 *
14 * mLib is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * mLib 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 General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with mLib; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 */
28
29/*----- Revision history --------------------------------------------------*
30 *
31 * $Log: report.c,v $
32 * Revision 1.1 1998/06/17 23:44:42 mdw
33 * Initial revision
34 *
35 */
36
37/*----- Header files ------------------------------------------------------*/
38
39#include <stdarg.h>
40#include <stdio.h>
41#include <stdlib.h>
42#include <string.h>
43
44#include "quis.h"
45#include "report.h"
46
47/*----- Functions provided ------------------------------------------------*/
48
49/* --- @moan@ --- *
50 *
51 * Arguments: @const char *f@ = a @printf@-style format string
52 * @...@ = other arguments
53 *
54 * Returns: ---
55 *
56 * Use: Reports an error.
57 */
58
59void moan(const char *f, ...)
60{
61 va_list ap;
62 va_start(ap, f);
63 fprintf(stderr, "%s: ", QUIS);
64 vfprintf(stderr, f, ap);
65 va_end(ap);
66 putc('\n', stderr);
67}
68
69/* --- @die@ --- *
70 *
71 * Arguments: @int status@ = exit status to return
72 * @const char *f@ = a @printf@-style format string
73 * @...@ = other arguments
74 *
75 * Returns: Never.
76 *
77 * Use: Reports an error and exits. Like @moan@ above, only more
78 * permanent.
79 */
80
81void die(int status, const char *f, ...)
82{
83 va_list ap;
84 va_start(ap, f);
85 fprintf(stderr, "%s: ", QUIS);
86 vfprintf(stderr, f, ap);
87 va_end(ap);
88 putc('\n', stderr);
89 exit(status);
90}
91
92/*----- That's all, folks -------------------------------------------------*/