xref: /freebsd/contrib/diff/lib/error.h (revision 18fd37a72c3a7549d2d4f6c6ea00bdcd2bdaca01)
118fd37a7SXin LI /* Declaration for error-reporting function
218fd37a7SXin LI    Copyright (C) 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
318fd37a7SXin LI    This file is part of the GNU C Library.
418fd37a7SXin LI 
518fd37a7SXin LI    This program is free software; you can redistribute it and/or modify
618fd37a7SXin LI    it under the terms of the GNU General Public License as published by
718fd37a7SXin LI    the Free Software Foundation; either version 2, or (at your option)
818fd37a7SXin LI    any later version.
918fd37a7SXin LI 
1018fd37a7SXin LI    This program is distributed in the hope that it will be useful,
1118fd37a7SXin LI    but WITHOUT ANY WARRANTY; without even the implied warranty of
1218fd37a7SXin LI    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1318fd37a7SXin LI    GNU General Public License for more details.
1418fd37a7SXin LI 
1518fd37a7SXin LI    You should have received a copy of the GNU General Public License along
1618fd37a7SXin LI    with this program; if not, write to the Free Software Foundation,
1718fd37a7SXin LI    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
1818fd37a7SXin LI 
1918fd37a7SXin LI #ifndef _ERROR_H
2018fd37a7SXin LI #define _ERROR_H 1
2118fd37a7SXin LI 
2218fd37a7SXin LI #ifndef __attribute__
2318fd37a7SXin LI /* This feature is available in gcc versions 2.5 and later.  */
2418fd37a7SXin LI # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
2518fd37a7SXin LI #  define __attribute__(Spec) /* empty */
2618fd37a7SXin LI # endif
2718fd37a7SXin LI /* The __-protected variants of `format' and `printf' attributes
2818fd37a7SXin LI    are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
2918fd37a7SXin LI # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
3018fd37a7SXin LI #  define __format__ format
3118fd37a7SXin LI #  define __printf__ printf
3218fd37a7SXin LI # endif
3318fd37a7SXin LI #endif
3418fd37a7SXin LI 
3518fd37a7SXin LI #ifdef	__cplusplus
3618fd37a7SXin LI extern "C" {
3718fd37a7SXin LI #endif
3818fd37a7SXin LI 
3918fd37a7SXin LI /* Print a message with `fprintf (stderr, FORMAT, ...)';
4018fd37a7SXin LI    if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
4118fd37a7SXin LI    If STATUS is nonzero, terminate the program with `exit (STATUS)'.  */
4218fd37a7SXin LI 
4318fd37a7SXin LI extern void error (int __status, int __errnum, const char *__format, ...)
4418fd37a7SXin LI      __attribute__ ((__format__ (__printf__, 3, 4)));
4518fd37a7SXin LI 
4618fd37a7SXin LI extern void error_at_line (int __status, int __errnum, const char *__fname,
4718fd37a7SXin LI 			   unsigned int __lineno, const char *__format, ...)
4818fd37a7SXin LI      __attribute__ ((__format__ (__printf__, 5, 6)));
4918fd37a7SXin LI 
5018fd37a7SXin LI /* If NULL, error will flush stdout, then print on stderr the program
5118fd37a7SXin LI    name, a colon and a space.  Otherwise, error will call this
5218fd37a7SXin LI    function without parameters instead.  */
5318fd37a7SXin LI extern void (*error_print_progname) (void);
5418fd37a7SXin LI 
5518fd37a7SXin LI /* This variable is incremented each time `error' is called.  */
5618fd37a7SXin LI extern unsigned int error_message_count;
5718fd37a7SXin LI 
5818fd37a7SXin LI /* Sometimes we want to have at most one error per line.  This
5918fd37a7SXin LI    variable controls whether this mode is selected or not.  */
6018fd37a7SXin LI extern int error_one_per_line;
6118fd37a7SXin LI 
6218fd37a7SXin LI #ifdef	__cplusplus
6318fd37a7SXin LI }
6418fd37a7SXin LI #endif
6518fd37a7SXin LI 
6618fd37a7SXin LI #endif /* error.h */
67