]> git.ipfire.org Git - thirdparty/glibc.git/blame - misc/error.h
Thu Mar 28 03:25:10 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
[thirdparty/glibc.git] / misc / error.h
CommitLineData
196980f5 1/* error.h -- declaration for error-reporting function
19c3f208 2 Copyright (C) 1995, 1996 Software Foundation, Inc.
196980f5
RM
3
4This file is part of the GNU C Library. Its master source is NOT part of
5the C library, however. The master source lives in /gd/gnu/lib.
6
7The GNU C Library is free software; you can redistribute it and/or
8modify it under the terms of the GNU Library General Public License as
9published by the Free Software Foundation; either version 2 of the
10License, or (at your option) any later version.
11
12The GNU C Library is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15Library General Public License for more details.
16
17You should have received a copy of the GNU Library General Public
18License along with the GNU C Library; see the file COPYING.LIB. If
19not, write to the Free Software Foundation, Inc., 675 Mass Ave,
20Cambridge, MA 02139, USA. */
21
22#ifndef _error_h_
23#define _error_h_
24
25#ifndef __attribute__
26/* This feature is available in gcc versions 2.5 and later. */
27# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
28# define __attribute__(Spec) /* empty */
29# endif
30/* The __-protected variants of `format' and `printf' attributes
31 are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
32# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
33# define __format__ format
34# define __printf__ printf
35# endif
36#endif
37
19c3f208
RM
38#if defined (__STDC__) && __STDC__
39
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)'. */
43
44extern void error (int status, int errnum, const char *format, ...)
45 __attribute__ ((__format__ (__printf__, 3, 4)));
46
19bc17a9
RM
47extern void error_at_line (int status, int errnum, const char *fname,
48 unsigned int lineno, const char *format, ...)
49 __attribute__ ((__format__ (__printf__, 5, 6)));
50
19c3f208
RM
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. */
54extern void (*error_print_progname) (void);
55
196980f5
RM
56#else
57void error ();
19bc17a9 58void error_at_line ();
19c3f208 59extern void (*error_print_progname) ();
196980f5
RM
60#endif
61
62/* This variable is incremented each time `error' is called. */
63extern unsigned int error_message_count;
64
19bc17a9
RM
65/* Sometimes we want to have at most one error per line. This
66 variable controls whether this mode is selected or not. */
67extern int error_one_per_line;
68
196980f5 69#endif /* _error_h_ */