2 * Copyright (C) 2000-2005 Erik Edelmann <Erik.Edelmann@iki.fi>
4 * This program is free software; you can redistribute it
5 * and/or modify it under the terms of the GNU General Public
6 * License version 2 as published by the Free Software
9 * This program is distributed in the hope that it will be
10 * useful, but WITHOUT ANY WARRANTY; without even the implied
11 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 * PURPOSE. See the GNU General Public License for more
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the Free
17 * Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307 USA
28 static const char *progname
;
31 void set_progname (const char *prog
)
36 static void print_errmesg (const char *kind
, const char *fmt
, va_list ap
)
44 fprintf (stderr
, "\n%s: %s: ", progname
, kind
);
53 s
= va_arg (ap
, char *);
63 fprintf (stderr
,"%i", n
);
66 u
= va_arg (ap
, unsigned);
67 fprintf (stderr
, "%u", u
);
70 d
= va_arg (ap
, double);
71 fprintf (stderr
, "%f", d
);
74 d
= va_arg (ap
, double);
75 fprintf (stderr
, "%g", d
);
93 void fatal_error (const char *fmt
, ...)
95 * Print a message on stderr and exit with exitcode 'EXIT_FAILURE'
101 print_errmesg ("ERROR", fmt
, ap
);
107 void warning (const char *fmt
, ...)
109 * Print a message on stderr.
115 print_errmesg ("WARNING", fmt
, ap
);