3 /* Declaration for error-reporting function
4 Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
7 NOTE: The canonical source of this file is maintained with the GNU C Library.
8 Bugs can be reported to bug-glibc@prep.ai.mit.edu.
10 This program is free software; you can redistribute it and/or modify it
11 under the terms of the GNU General Public License as published by the
12 Free Software Foundation; either version 2, or (at your option) any
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
29 /* This feature is available in gcc versions 2.5 and later. */
30 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
31 # define __attribute__(Spec) /* empty */
33 /* The __-protected variants of `format' and `printf' attributes
34 are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
35 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
36 # define __format__ format
37 # define __printf__ printf
45 #if defined (__STDC__) && __STDC__
47 /* Print a message with `fprintf (stderr, FORMAT, ...)';
48 if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
49 If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
51 extern void error (int status
, int errnum
, const char *format
, ...)
52 __attribute__ ((__format__ (__printf__
, 3, 4)));
54 extern void error_at_line (int status
, int errnum
, const char *fname
,
55 unsigned int lineno
, const char *format
, ...)
56 __attribute__ ((__format__ (__printf__
, 5, 6)));
58 /* If NULL, error will flush stdout, then print on stderr the program
59 name, a colon and a space. Otherwise, error will call this
60 function without parameters instead. */
61 extern void (*error_print_progname
) (void);
65 void error_at_line ();
66 extern void (*error_print_progname
) ();
69 /* This variable is incremented each time `error' is called. */
70 extern unsigned int error_message_count
;
72 /* Sometimes we want to have at most one error per line. This
73 variable controls whether this mode is selected or not. */
74 extern int error_one_per_line
;