Mercurial > hg > octave-kai > gnulib-hg
view lib/fatal.c @ 4359:3abffb51a661
*** empty log message ***
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Fri, 06 Jun 2003 19:46:10 +0000 (2003-06-06) |
parents | fcd34d3861a4 |
children | 9f5b3245e524 |
line wrap: on
line source
/* 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 <config.h> #endif /* FIXME: define EXIT_FAILURE */ #include <stdio.h> #if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC # include <stdarg.h> # define VA_START(args, lastarg) va_start(args, lastarg) #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 #if STDC_HEADERS || _LIBC # include <stdlib.h> # include <string.h> #else void exit (); #endif #ifdef _LIBC # define program_name program_invocation_name #else /* not _LIBC */ /* The calling program should define program_name and set it to the name of the executing program. */ 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) (); else { fflush (stdout); fprintf (stderr, "%s: ", program_name); } #ifdef VA_START VA_START (args, message); error (EXIT_FAILURE, errnum, message, args); va_end (args); #else error (EXIT_FAILURE, errnum, message, a1, a2, a3, a4, a5, a6, a7, a8); #endif }