X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ffatal.c;h=8bcc3c56183eb220ead1c59b3fe82afe222aaaf4;hb=a9b64ea6a96fe625db5332f5e2b3e5f968704af7;hp=e6f46ec94ca8f639abdffe37886656fab70eda34;hpb=92f1833affa37844e22d2ebe4ca4c6ba924377f4;p=gnulib.git diff --git a/lib/fatal.c b/lib/fatal.c index e6f46ec94..8bcc3c561 100644 --- a/lib/fatal.c +++ b/lib/fatal.c @@ -1,30 +1,33 @@ +/* Fatal exits for noninteractive utilities + + Copyright (C) 2001, 2003 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + #ifdef HAVE_CONFIG_H # include #endif /* FIXME: define EXIT_FAILURE */ -#include - -#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC -# if __STDC__ -# include -# define VA_START(args, lastarg) va_start(args, lastarg) -# else -# include -# define VA_START(args, lastarg) va_start(args) -# endif -#else -# define va_alist a1, a2, a3, a4, a5, a6, a7, a8 -# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; -#endif +#include "fatal.h" -#if STDC_HEADERS || _LIBC -# include -# include -#else -void exit (); -#endif +#include +#include +#include +#include #ifdef _LIBC # define program_name program_invocation_name @@ -34,24 +37,14 @@ void exit (); extern char *program_name; #endif -#include "fatal.h" #include "unlocked-io.h" /* Like error, but always exit with EXIT_FAILURE. */ void -#if defined VA_START && __STDC__ fatal (int errnum, const char *message, ...) -#else -fatal (errnum, message, va_alist) - int errnum; - char *message; - va_dcl -#endif { -#ifdef VA_START va_list args; -#endif if (error_print_progname) (*error_print_progname) (); @@ -61,11 +54,10 @@ fatal (errnum, message, va_alist) fprintf (stderr, "%s: ", program_name); } -#ifdef VA_START - VA_START (args, message); + va_start (args, message); error (EXIT_FAILURE, errnum, message, args); + + /* The following code isn't reachable, but pacifies some compilers. */ va_end (args); -#else - error (EXIT_FAILURE, errnum, message, a1, a2, a3, a4, a5, a6, a7, a8); -#endif + abort (); }