1131554Stjr/* Declaration for error-reporting function 2131554Stjr Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. 3131554Stjr 4131554Stjr 5131554Stjr NOTE: The canonical source of this file is maintained with the GNU C Library. 6131554Stjr Bugs can be reported to bug-glibc@prep.ai.mit.edu. 7131554Stjr 8131554Stjr This program is free software; you can redistribute it and/or modify it 9131554Stjr under the terms of the GNU General Public License as published by the 10131554Stjr Free Software Foundation; either version 2, or (at your option) any 11131554Stjr later version. 12131554Stjr 13131554Stjr This program is distributed in the hope that it will be useful, 14131554Stjr but WITHOUT ANY WARRANTY; without even the implied warranty of 15131554Stjr MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16131554Stjr GNU General Public License for more details. 17131554Stjr 18131554Stjr You should have received a copy of the GNU General Public License 19131554Stjr along with this program; if not, write to the Free Software 20131554Stjr Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 21131554Stjr USA. */ 22131554Stjr 23131554Stjr#ifndef _ERROR_H 24131554Stjr#define _ERROR_H 1 25131554Stjr 26131554Stjr#ifndef __attribute__ 27131554Stjr/* This feature is available in gcc versions 2.5 and later. */ 28131554Stjr# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ 29131554Stjr# define __attribute__(Spec) /* empty */ 30131554Stjr# endif 31131554Stjr/* The __-protected variants of `format' and `printf' attributes 32131554Stjr are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ 33131554Stjr# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) 34131554Stjr# define __format__ format 35131554Stjr# define __printf__ printf 36131554Stjr# endif 37131554Stjr#endif 38131554Stjr 39131554Stjr#ifdef __cplusplus 40131554Stjrextern "C" { 41131554Stjr#endif 42131554Stjr 43131554Stjr#if defined (__STDC__) && __STDC__ 44131554Stjr 45131554Stjr/* Print a message with `fprintf (stderr, FORMAT, ...)'; 46131554Stjr if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). 47131554Stjr If STATUS is nonzero, terminate the program with `exit (STATUS)'. */ 48131554Stjr 49131554Stjrextern void error (int status, int errnum, const char *format, ...) 50131554Stjr __attribute__ ((__format__ (__printf__, 3, 4))); 51131554Stjr 52131554Stjrextern void error_at_line (int status, int errnum, const char *fname, 53131554Stjr unsigned int lineno, const char *format, ...) 54131554Stjr __attribute__ ((__format__ (__printf__, 5, 6))); 55131554Stjr 56131554Stjr/* If NULL, error will flush stdout, then print on stderr the program 57131554Stjr name, a colon and a space. Otherwise, error will call this 58131554Stjr function without parameters instead. */ 59131554Stjrextern void (*error_print_progname) (void); 60131554Stjr 61131554Stjr#else 62131554Stjrvoid error (); 63131554Stjrvoid error_at_line (); 64131554Stjrextern void (*error_print_progname) (); 65131554Stjr#endif 66131554Stjr 67131554Stjr/* This variable is incremented each time `error' is called. */ 68131554Stjrextern unsigned int error_message_count; 69131554Stjr 70131554Stjr/* Sometimes we want to have at most one error per line. This 71131554Stjr variable controls whether this mode is selected or not. */ 72131554Stjrextern int error_one_per_line; 73131554Stjr 74131554Stjr#ifdef __cplusplus 75131554Stjr} 76131554Stjr#endif 77131554Stjr 78131554Stjr#endif /* error.h */ 79