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