(to_wc): Mark as const. (to_mb): Likewise.
[glibc.git] / misc / error.h
blob3638bc6e9845fdb62a20d853e3577eb007f20834
1 /* Declaration for error-reporting function
2 Copyright (C) 1995, 1996, 1997, 2003 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 #if defined __STDC__ && __STDC__
42 /* Print a message with `fprintf (stderr, FORMAT, ...)';
43 if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
44 If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
46 extern void error (int __status, int __errnum, const char *__format, ...)
47 __attribute__ ((__format__ (__printf__, 3, 4)));
49 extern void error_at_line (int __status, int __errnum, const char *__fname,
50 unsigned int __lineno, const char *__format, ...)
51 __attribute__ ((__format__ (__printf__, 5, 6)));
53 /* If NULL, error will flush stdout, then print on stderr the program
54 name, a colon and a space. Otherwise, error will call this
55 function without parameters instead. */
56 extern void (*error_print_progname) (void);
58 #else
59 void error ();
60 void error_at_line ();
61 extern void (*error_print_progname) ();
62 #endif
64 /* This variable is incremented each time `error' is called. */
65 extern unsigned int error_message_count;
67 /* Sometimes we want to have at most one error per line. This
68 variable controls whether this mode is selected or not. */
69 extern int error_one_per_line;
71 #ifdef __cplusplus
73 #endif
75 #endif /* error.h */