1/* Declaration for error-reporting function
2 Copyright (C) 1995-2020 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
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.
9
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.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _ERROR_H
20#define _ERROR_H 1
21
22#include <features.h>
23
24
25__BEGIN_DECLS
26
27/* Print a message with `fprintf (stderr, FORMAT, ...)';
28 if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
29 If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
30
31extern void error (int __status, int __errnum, const char *__format, ...)
32 __attribute__ ((__format__ (__printf__, 3, 4)));
33
34extern void error_at_line (int __status, int __errnum, const char *__fname,
35 unsigned int __lineno, const char *__format, ...)
36 __attribute__ ((__format__ (__printf__, 5, 6)));
37
38/* If NULL, error will flush stdout, then print on stderr the program
39 name, a colon and a space. Otherwise, error will call this
40 function without parameters instead. */
41extern void (*error_print_progname) (void);
42
43/* This variable is incremented each time `error' is called. */
44extern unsigned int error_message_count;
45
46/* Sometimes we want to have at most one error per line. This
47 variable controls whether this mode is selected or not. */
48extern int error_one_per_line;
49
50#ifdef __LDBL_COMPAT
51# include <bits/error-ldbl.h>
52#else
53/* Do not inline error and error_at_line when long double has the same
54 size of double, because that would invalidate the redirections to the
55 compatibility functions. */
56# if defined __extern_always_inline && defined __va_arg_pack
57# include <bits/error.h>
58# endif
59#endif
60
61__END_DECLS
62
63#endif /* error.h */
64