blob: 785c1deb5a9f80ab39eee3d5d02aea3af4eb6293 [file] [log] [blame]
Jari Aalto726f6381996-08-26 18:22:31 +00001/* error.h -- External declarations of functions appearing in error.c. */
2
Chet Ramey8868eda2020-12-06 15:51:17 -05003/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
Jari Aalto726f6381996-08-26 18:22:31 +00004
5 This file is part of GNU Bash, the Bourne Again SHell.
6
Jari Aalto31859422009-01-12 13:36:28 +00007 Bash is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
Jari Aalto726f6381996-08-26 18:22:31 +000011
Jari Aalto31859422009-01-12 13:36:28 +000012 Bash is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
Jari Aalto726f6381996-08-26 18:22:31 +000016
Jari Aalto31859422009-01-12 13:36:28 +000017 You should have received a copy of the GNU General Public License
18 along with Bash. If not, see <http://www.gnu.org/licenses/>.
19*/
Jari Aalto726f6381996-08-26 18:22:31 +000020
Jari Aaltoccc6cda1996-12-23 17:02:34 +000021#if !defined (_ERROR_H_)
22#define _ERROR_H_
23
24#include "stdc.h"
25
Jari Aalto726f6381996-08-26 18:22:31 +000026/* Get the name of the shell or shell script for an error message. */
Chet Ramey8868eda2020-12-06 15:51:17 -050027extern char *get_name_for_error PARAMS((void));
Jari Aalto726f6381996-08-26 18:22:31 +000028
29/* Report an error having to do with FILENAME. */
Chet Ramey8868eda2020-12-06 15:51:17 -050030extern void file_error PARAMS((const char *));
Jari Aalto726f6381996-08-26 18:22:31 +000031
32/* Report a programmer's error, and abort. Pass REASON, and ARG1 ... ARG5. */
Chet Ramey8868eda2020-12-06 15:51:17 -050033extern void programming_error PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
Jari Aalto726f6381996-08-26 18:22:31 +000034
35/* General error reporting. Pass FORMAT and ARG1 ... ARG5. */
Chet Ramey8868eda2020-12-06 15:51:17 -050036extern void report_error PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
Jari Aaltoccc6cda1996-12-23 17:02:34 +000037
38/* Error messages for parts of the parser that don't call report_syntax_error */
Chet Ramey8868eda2020-12-06 15:51:17 -050039extern void parser_error PARAMS((int, const char *, ...)) __attribute__((__format__ (printf, 2, 3)));
Jari Aalto726f6381996-08-26 18:22:31 +000040
41/* Report an unrecoverable error and exit. Pass FORMAT and ARG1 ... ARG5. */
Chet Ramey8868eda2020-12-06 15:51:17 -050042extern void fatal_error PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
Jari Aaltoccc6cda1996-12-23 17:02:34 +000043
44/* Report a system error, like BSD warn(3). */
Chet Ramey8868eda2020-12-06 15:51:17 -050045extern void sys_error PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
Jari Aaltoccc6cda1996-12-23 17:02:34 +000046
47/* Report an internal error. */
Chet Ramey8868eda2020-12-06 15:51:17 -050048extern void internal_error PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
Jari Aaltoccc6cda1996-12-23 17:02:34 +000049
Jari Aaltocce855b1998-04-17 19:52:44 +000050/* Report an internal warning. */
Chet Ramey8868eda2020-12-06 15:51:17 -050051extern void internal_warning PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
Jari Aaltocce855b1998-04-17 19:52:44 +000052
Chet Ramey74091dd2022-09-26 11:49:46 -040053/* Report an internal warning for debugging purposes. */
54extern void internal_debug PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
55
Chet Rameya0c0a002016-09-15 16:59:08 -040056/* Report an internal informational notice. */
Chet Ramey8868eda2020-12-06 15:51:17 -050057extern void internal_inform PARAMS((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
Chet Rameya0c0a002016-09-15 16:59:08 -040058
Jari Aalto31859422009-01-12 13:36:28 +000059/* Debugging functions, not enabled in released version. */
Chet Ramey8868eda2020-12-06 15:51:17 -050060extern char *strescape PARAMS((const char *));
61extern void itrace PARAMS((const char *, ...)) __attribute__ ((__format__ (printf, 1, 2)));
62extern void trace PARAMS((const char *, ...)) __attribute__ ((__format__ (printf, 1, 2)));
Jari Aalto7117c2d2002-07-17 14:10:11 +000063
Jari Aaltob72432f1999-02-19 17:11:39 +000064/* Report an error having to do with command parsing or execution. */
Chet Ramey8868eda2020-12-06 15:51:17 -050065extern void command_error PARAMS((const char *, int, int, int));
Jari Aaltob72432f1999-02-19 17:11:39 +000066
Chet Ramey8868eda2020-12-06 15:51:17 -050067extern char *command_errstr PARAMS((int));
Jari Aaltob72432f1999-02-19 17:11:39 +000068
Chet Rameyac50fba2014-02-26 09:36:43 -050069/* Specific error message functions that eventually call report_error or
Jari Aalto7117c2d2002-07-17 14:10:11 +000070 internal_error. */
71
Chet Ramey8868eda2020-12-06 15:51:17 -050072extern void err_badarraysub PARAMS((const char *));
73extern void err_unboundvar PARAMS((const char *));
74extern void err_readonly PARAMS((const char *));
Jari Aaltof73dda02001-11-13 17:56:06 +000075
Chet Ramey74091dd2022-09-26 11:49:46 -040076#ifdef DEBUG
77# define INTERNAL_DEBUG(x) internal_debug x
78#else
79# define INTERNAL_DEBUG(x)
80#endif
81
Jari Aaltoccc6cda1996-12-23 17:02:34 +000082#endif /* !_ERROR_H_ */