xref: /freebsd-src/contrib/diff/lib/error.h (revision 18fd37a72c3a7549d2d4f6c6ea00bdcd2bdaca01)
1*18fd37a7SXin LI /* Declaration for error-reporting function
2*18fd37a7SXin LI    Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
3*18fd37a7SXin LI    This file is part of the GNU C Library.
4*18fd37a7SXin LI 
5*18fd37a7SXin LI    This program is free software; you can redistribute it and/or modify
6*18fd37a7SXin LI    it under the terms of the GNU General Public License as published by
7*18fd37a7SXin LI    the Free Software Foundation; either version 2, or (at your option)
8*18fd37a7SXin LI    any later version.
9*18fd37a7SXin LI 
10*18fd37a7SXin LI    This program is distributed in the hope that it will be useful,
11*18fd37a7SXin LI    but WITHOUT ANY WARRANTY; without even the implied warranty of
12*18fd37a7SXin LI    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*18fd37a7SXin LI    GNU General Public License for more details.
14*18fd37a7SXin LI 
15*18fd37a7SXin LI    You should have received a copy of the GNU General Public License along
16*18fd37a7SXin LI    with this program; if not, write to the Free Software Foundation,
17*18fd37a7SXin LI    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
18*18fd37a7SXin LI 
19*18fd37a7SXin LI #ifndef _ERROR_H
20*18fd37a7SXin LI #define _ERROR_H 1
21*18fd37a7SXin LI 
22*18fd37a7SXin LI #ifndef __attribute__
23*18fd37a7SXin LI /* This feature is available in gcc versions 2.5 and later.  */
24*18fd37a7SXin LI # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
25*18fd37a7SXin LI #  define __attribute__(Spec) /* empty */
26*18fd37a7SXin LI # endif
27*18fd37a7SXin LI /* The __-protected variants of `format' and `printf' attributes
28*18fd37a7SXin LI    are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
29*18fd37a7SXin LI # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
30*18fd37a7SXin LI #  define __format__ format
31*18fd37a7SXin LI #  define __printf__ printf
32*18fd37a7SXin LI # endif
33*18fd37a7SXin LI #endif
34*18fd37a7SXin LI 
35*18fd37a7SXin LI #ifdef	__cplusplus
36*18fd37a7SXin LI extern "C" {
37*18fd37a7SXin LI #endif
38*18fd37a7SXin LI 
39*18fd37a7SXin LI /* Print a message with `fprintf (stderr, FORMAT, ...)';
40*18fd37a7SXin LI    if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
41*18fd37a7SXin LI    If STATUS is nonzero, terminate the program with `exit (STATUS)'.  */
42*18fd37a7SXin LI 
43*18fd37a7SXin LI extern void error (int __status, int __errnum, const char *__format, ...)
44*18fd37a7SXin LI      __attribute__ ((__format__ (__printf__, 3, 4)));
45*18fd37a7SXin LI 
46*18fd37a7SXin LI extern void error_at_line (int __status, int __errnum, const char *__fname,
47*18fd37a7SXin LI 			   unsigned int __lineno, const char *__format, ...)
48*18fd37a7SXin LI      __attribute__ ((__format__ (__printf__, 5, 6)));
49*18fd37a7SXin LI 
50*18fd37a7SXin LI /* If NULL, error will flush stdout, then print on stderr the program
51*18fd37a7SXin LI    name, a colon and a space.  Otherwise, error will call this
52*18fd37a7SXin LI    function without parameters instead.  */
53*18fd37a7SXin LI extern void (*error_print_progname) (void);
54*18fd37a7SXin LI 
55*18fd37a7SXin LI /* This variable is incremented each time `error' is called.  */
56*18fd37a7SXin LI extern unsigned int error_message_count;
57*18fd37a7SXin LI 
58*18fd37a7SXin LI /* Sometimes we want to have at most one error per line.  This
59*18fd37a7SXin LI    variable controls whether this mode is selected or not.  */
60*18fd37a7SXin LI extern int error_one_per_line;
61*18fd37a7SXin LI 
62*18fd37a7SXin LI #ifdef	__cplusplus
63*18fd37a7SXin LI }
64*18fd37a7SXin LI #endif
65*18fd37a7SXin LI 
66*18fd37a7SXin LI #endif /* error.h */
67