all must go
[rrdtool.git] / libraries / libart_lgpl-2.3.7 / art_misc.c
1 /* Libart_LGPL - library of basic graphic primitives
2  * Copyright (C) 1998 Raph Levien
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /* Various utility functions RLL finds useful. */
21
22 #include "config.h"
23 #ifdef HAVE_UINSTD_H
24 #include <unistd.h>
25 #endif
26 #include <stdio.h>
27 #include <stdarg.h>
28 #include "art_misc.h"
29
30 /**
31  * art_die: Print the error message to stderr and exit with a return code of 1.
32  * @fmt: The printf-style format for the error message.
33  *
34  * Used for dealing with severe errors.
35  **/
36 void
37 art_die (const char *fmt, ...)
38 {
39   va_list ap;
40
41   va_start (ap, fmt);
42   vfprintf (stderr, fmt, ap);
43   va_end (ap);
44   exit (1);
45 }
46
47 /**
48  * art_die: Print the error message to stderr.
49  * @fmt: The printf-style format for the error message.
50  *
51  * Used for generating warnings.
52  **/
53 void
54 art_warn (const char *fmt, ...)
55 {
56   va_list ap;
57
58   va_start (ap, fmt);
59   vfprintf (stderr, fmt, ap);
60   va_end (ap);
61 }