fix crashes reported by Debian Cylab Mayhem Team
[swftools.git] / lib / art / art_misc.c
bloba7e0566ee14b710d0ef41672120c753371084e5a
1 /* Libart_LGPL - library of basic graphic primitives
2 * Copyright (C) 1998 Raph Levien
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.
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.
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.
20 /* Various utility functions RLL finds useful. */
22 #include "config.h"
23 #include "art_misc.h"
25 #ifdef HAVE_UINSTD_H
26 #include <unistd.h>
27 #endif
28 #include <stdio.h>
29 #include <stdarg.h>
31 /**
32 * art_die: Print the error message to stderr and exit with a return code of 1.
33 * @fmt: The printf-style format for the error message.
35 * Used for dealing with severe errors.
36 **/
37 void
38 art_die (const char *fmt, ...)
40 va_list ap;
42 va_start (ap, fmt);
43 vfprintf (stderr, fmt, ap);
44 va_end (ap);
45 exit (1);
48 /**
49 * art_warn: Print the warning message to stderr.
50 * @fmt: The printf-style format for the warning message.
52 * Used for generating warnings.
53 **/
54 void
55 art_warn (const char *fmt, ...)
57 va_list ap;
59 fprintf(stderr, "warn: ");
60 va_start (ap, fmt);
61 vfprintf (stderr, fmt, ap);
62 va_end (ap);
65 /**
66 * art_dprint: Print the debug message to stderr.
67 * @fmt: The printf-style format for the debug message.
69 * Used for generating debug output.
70 **/
71 void
72 art_dprint (const char *fmt, ...)
74 va_list ap;
76 va_start (ap, fmt);
77 vfprintf (stderr, fmt, ap);
78 va_end (ap);