blob: 7df4b146ccdd6f8ddc5535594553f90c7c6ccd2e [file] [log] [blame]
Jari Aalto726f6381996-08-26 18:22:31 +00001/* error.c -- Functions for handling errors. */
Jari Aalto31859422009-01-12 13:36:28 +00002
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#include "config.h"
22
Jari Aaltod166f041997-06-05 14:59:13 +000023#include "bashtypes.h"
Jari Aalto726f6381996-08-26 18:22:31 +000024#include <fcntl.h>
25
Jari Aaltoccc6cda1996-12-23 17:02:34 +000026#if defined (HAVE_UNISTD_H)
27# include <unistd.h>
28#endif
29
30#if defined (PREFER_STDARG)
31# include <stdarg.h>
32#else
Jari Aalto7117c2d2002-07-17 14:10:11 +000033# include <varargs.h>
Jari Aalto726f6381996-08-26 18:22:31 +000034#endif
35
Jari Aaltod166f041997-06-05 14:59:13 +000036#include <stdio.h>
37
Jari Aalto726f6381996-08-26 18:22:31 +000038#include <errno.h>
39#if !defined (errno)
40extern int errno;
41#endif /* !errno */
42
43#include "bashansi.h"
Jari Aaltob80f6442004-07-27 13:29:18 +000044#include "bashintl.h"
45
46#include "shell.h"
Chet Rameyd233b482019-01-07 09:27:52 -050047#include "execute_cmd.h"
Jari Aalto726f6381996-08-26 18:22:31 +000048#include "flags.h"
Jari Aaltoccc6cda1996-12-23 17:02:34 +000049#include "input.h"
Jari Aalto726f6381996-08-26 18:22:31 +000050
Jari Aaltoccc6cda1996-12-23 17:02:34 +000051#if defined (HISTORY)
52# include "bashhist.h"
53#endif
54
Chet Ramey8868eda2020-12-06 15:51:17 -050055extern int executing_line_number PARAMS((void));
Jari Aalto7117c2d2002-07-17 14:10:11 +000056
Jari Aalto726f6381996-08-26 18:22:31 +000057#if defined (JOB_CONTROL)
58extern pid_t shell_pgrp;
Chet Ramey8868eda2020-12-06 15:51:17 -050059extern int give_terminal_to PARAMS((pid_t, int));
Jari Aalto726f6381996-08-26 18:22:31 +000060#endif /* JOB_CONTROL */
61
Jari Aaltob80f6442004-07-27 13:29:18 +000062#if defined (ARRAY_VARS)
Jari Aalto31859422009-01-12 13:36:28 +000063extern const char * const bash_badsub_errmsg;
Jari Aaltob80f6442004-07-27 13:29:18 +000064#endif
65
Chet Ramey8868eda2020-12-06 15:51:17 -050066static void error_prolog PARAMS((int));
Jari Aalto7117c2d2002-07-17 14:10:11 +000067
Jari Aaltoccc6cda1996-12-23 17:02:34 +000068/* The current maintainer of the shell. You change this in the
69 Makefile. */
70#if !defined (MAINTAINER)
Jari Aaltobb706242000-03-17 21:46:59 +000071#define MAINTAINER "bash-maintainers@gnu.org"
Jari Aaltoccc6cda1996-12-23 17:02:34 +000072#endif
73
Jari Aalto31859422009-01-12 13:36:28 +000074const char * const the_current_maintainer = MAINTAINER;
Jari Aaltoccc6cda1996-12-23 17:02:34 +000075
Jari Aaltob80f6442004-07-27 13:29:18 +000076int gnu_error_format = 0;
77
Jari Aalto7117c2d2002-07-17 14:10:11 +000078static void
79error_prolog (print_lineno)
80 int print_lineno;
81{
Jari Aaltob80f6442004-07-27 13:29:18 +000082 char *ename;
Jari Aalto7117c2d2002-07-17 14:10:11 +000083 int line;
84
Jari Aaltob80f6442004-07-27 13:29:18 +000085 ename = get_name_for_error ();
86 line = (print_lineno && interactive_shell == 0) ? executing_line_number () : -1;
Jari Aalto7117c2d2002-07-17 14:10:11 +000087
Jari Aaltob80f6442004-07-27 13:29:18 +000088 if (line > 0)
Jari Aalto31859422009-01-12 13:36:28 +000089 fprintf (stderr, "%s:%s%d: ", ename, gnu_error_format ? "" : _(" line "), line);
Jari Aaltob80f6442004-07-27 13:29:18 +000090 else
91 fprintf (stderr, "%s: ", ename);
Jari Aalto7117c2d2002-07-17 14:10:11 +000092}
93
Jari Aalto726f6381996-08-26 18:22:31 +000094/* Return the name of the shell or the shell script for error reporting. */
95char *
96get_name_for_error ()
97{
Jari Aaltoccc6cda1996-12-23 17:02:34 +000098 char *name;
Jari Aaltob80f6442004-07-27 13:29:18 +000099#if defined (ARRAY_VARS)
100 SHELL_VAR *bash_source_v;
101 ARRAY *bash_source_a;
102#endif
Jari Aalto726f6381996-08-26 18:22:31 +0000103
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000104 name = (char *)NULL;
105 if (interactive_shell == 0)
Jari Aaltob80f6442004-07-27 13:29:18 +0000106 {
107#if defined (ARRAY_VARS)
108 bash_source_v = find_variable ("BASH_SOURCE");
109 if (bash_source_v && array_p (bash_source_v) &&
110 (bash_source_a = array_cell (bash_source_v)))
111 name = array_reference (bash_source_a, 0);
Jari Aalto31859422009-01-12 13:36:28 +0000112 if (name == 0 || *name == '\0') /* XXX - was just name == 0 */
Jari Aaltob80f6442004-07-27 13:29:18 +0000113#endif
114 name = dollar_vars[0];
115 }
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000116 if (name == 0 && shell_name && *shell_name)
Jari Aalto726f6381996-08-26 18:22:31 +0000117 name = base_pathname (shell_name);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000118 if (name == 0)
119#if defined (PROGRAM)
120 name = PROGRAM;
121#else
Jari Aalto726f6381996-08-26 18:22:31 +0000122 name = "bash";
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000123#endif
Jari Aalto726f6381996-08-26 18:22:31 +0000124
125 return (name);
126}
127
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000128/* Report an error having to do with FILENAME. This does not use
129 sys_error so the filename is not interpreted as a printf-style
130 format string. */
Jari Aalto726f6381996-08-26 18:22:31 +0000131void
132file_error (filename)
Jari Aaltof73dda02001-11-13 17:56:06 +0000133 const char *filename;
Jari Aalto726f6381996-08-26 18:22:31 +0000134{
135 report_error ("%s: %s", filename, strerror (errno));
136}
137
Jari Aalto726f6381996-08-26 18:22:31 +0000138void
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000139#if defined (PREFER_STDARG)
140programming_error (const char *format, ...)
141#else
142programming_error (format, va_alist)
143 const char *format;
Jari Aalto726f6381996-08-26 18:22:31 +0000144 va_dcl
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000145#endif
Jari Aalto726f6381996-08-26 18:22:31 +0000146{
147 va_list args;
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000148 char *h;
Jari Aalto726f6381996-08-26 18:22:31 +0000149
150#if defined (JOB_CONTROL)
Jari Aaltof73dda02001-11-13 17:56:06 +0000151 give_terminal_to (shell_pgrp, 0);
Jari Aalto726f6381996-08-26 18:22:31 +0000152#endif /* JOB_CONTROL */
153
Jari Aalto7117c2d2002-07-17 14:10:11 +0000154 SH_VA_START (args, format);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000155
Jari Aalto726f6381996-08-26 18:22:31 +0000156 vfprintf (stderr, format, args);
157 fprintf (stderr, "\n");
158 va_end (args);
159
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000160#if defined (HISTORY)
161 if (remember_on_history)
162 {
163 h = last_history_line ();
Jari Aaltob80f6442004-07-27 13:29:18 +0000164 fprintf (stderr, _("last command: %s\n"), h ? h : "(null)");
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000165 }
166#endif
167
Jari Aaltobb706242000-03-17 21:46:59 +0000168#if 0
Jari Aaltod166f041997-06-05 14:59:13 +0000169 fprintf (stderr, "Report this to %s\n", the_current_maintainer);
Jari Aaltobb706242000-03-17 21:46:59 +0000170#endif
171
Jari Aaltob80f6442004-07-27 13:29:18 +0000172 fprintf (stderr, _("Aborting..."));
Jari Aalto726f6381996-08-26 18:22:31 +0000173 fflush (stderr);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000174
Jari Aalto726f6381996-08-26 18:22:31 +0000175 abort ();
176}
177
Jari Aalto7117c2d2002-07-17 14:10:11 +0000178/* Print an error message and, if `set -e' has been executed, exit the
179 shell. Used in this file by file_error and programming_error. Used
180 outside this file mostly to report substitution and expansion errors,
181 and for bad invocation options. */
Jari Aalto726f6381996-08-26 18:22:31 +0000182void
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000183#if defined (PREFER_STDARG)
184report_error (const char *format, ...)
185#else
186report_error (format, va_alist)
187 const char *format;
Jari Aalto726f6381996-08-26 18:22:31 +0000188 va_dcl
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000189#endif
Jari Aalto726f6381996-08-26 18:22:31 +0000190{
191 va_list args;
Jari Aalto726f6381996-08-26 18:22:31 +0000192
Jari Aalto7117c2d2002-07-17 14:10:11 +0000193 error_prolog (1);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000194
Jari Aalto7117c2d2002-07-17 14:10:11 +0000195 SH_VA_START (args, format);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000196
Jari Aalto726f6381996-08-26 18:22:31 +0000197 vfprintf (stderr, format, args);
198 fprintf (stderr, "\n");
199
200 va_end (args);
201 if (exit_immediately_on_error)
Chet Ramey98043132012-03-13 15:12:07 -0400202 {
203 if (last_command_exit_value == 0)
Chet Ramey8868eda2020-12-06 15:51:17 -0500204 last_command_exit_value = EXECUTION_FAILURE;
Chet Ramey98043132012-03-13 15:12:07 -0400205 exit_shell (last_command_exit_value);
206 }
Jari Aalto726f6381996-08-26 18:22:31 +0000207}
208
209void
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000210#if defined (PREFER_STDARG)
211fatal_error (const char *format, ...)
212#else
213fatal_error (format, va_alist)
214 const char *format;
Jari Aalto726f6381996-08-26 18:22:31 +0000215 va_dcl
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000216#endif
Jari Aalto726f6381996-08-26 18:22:31 +0000217{
218 va_list args;
Jari Aalto726f6381996-08-26 18:22:31 +0000219
Jari Aalto7117c2d2002-07-17 14:10:11 +0000220 error_prolog (0);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000221
Jari Aalto7117c2d2002-07-17 14:10:11 +0000222 SH_VA_START (args, format);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000223
Jari Aalto726f6381996-08-26 18:22:31 +0000224 vfprintf (stderr, format, args);
225 fprintf (stderr, "\n");
226
227 va_end (args);
Jari Aalto7117c2d2002-07-17 14:10:11 +0000228 sh_exit (2);
Jari Aalto726f6381996-08-26 18:22:31 +0000229}
230
231void
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000232#if defined (PREFER_STDARG)
233internal_error (const char *format, ...)
234#else
235internal_error (format, va_alist)
236 const char *format;
Jari Aalto726f6381996-08-26 18:22:31 +0000237 va_dcl
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000238#endif
Jari Aalto726f6381996-08-26 18:22:31 +0000239{
240 va_list args;
Jari Aalto726f6381996-08-26 18:22:31 +0000241
Jari Aalto7117c2d2002-07-17 14:10:11 +0000242 error_prolog (1);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000243
Jari Aalto7117c2d2002-07-17 14:10:11 +0000244 SH_VA_START (args, format);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000245
Jari Aalto726f6381996-08-26 18:22:31 +0000246 vfprintf (stderr, format, args);
247 fprintf (stderr, "\n");
248
249 va_end (args);
250}
251
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000252void
253#if defined (PREFER_STDARG)
Jari Aaltocce855b1998-04-17 19:52:44 +0000254internal_warning (const char *format, ...)
255#else
256internal_warning (format, va_alist)
257 const char *format;
258 va_dcl
259#endif
260{
261 va_list args;
262
Jari Aalto31859422009-01-12 13:36:28 +0000263 error_prolog (1);
264 fprintf (stderr, _("warning: "));
Jari Aaltocce855b1998-04-17 19:52:44 +0000265
Jari Aalto7117c2d2002-07-17 14:10:11 +0000266 SH_VA_START (args, format);
Jari Aaltocce855b1998-04-17 19:52:44 +0000267
268 vfprintf (stderr, format, args);
269 fprintf (stderr, "\n");
270
271 va_end (args);
272}
273
274void
275#if defined (PREFER_STDARG)
Chet Rameya0c0a002016-09-15 16:59:08 -0400276internal_inform (const char *format, ...)
277#else
278internal_inform (format, va_alist)
279 const char *format;
280 va_dcl
281#endif
282{
283 va_list args;
284
285 error_prolog (1);
286 /* TRANSLATORS: this is a prefix for informational messages. */
287 fprintf (stderr, _("INFORM: "));
288
289 SH_VA_START (args, format);
290
291 vfprintf (stderr, format, args);
292 fprintf (stderr, "\n");
293
294 va_end (args);
295}
296
297void
298#if defined (PREFER_STDARG)
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000299sys_error (const char *format, ...)
300#else
301sys_error (format, va_alist)
302 const char *format;
Jari Aalto726f6381996-08-26 18:22:31 +0000303 va_dcl
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000304#endif
Jari Aalto726f6381996-08-26 18:22:31 +0000305{
Jari Aalto7117c2d2002-07-17 14:10:11 +0000306 int e;
Jari Aalto726f6381996-08-26 18:22:31 +0000307 va_list args;
Jari Aalto726f6381996-08-26 18:22:31 +0000308
Jari Aalto7117c2d2002-07-17 14:10:11 +0000309 e = errno;
310 error_prolog (0);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000311
Jari Aalto7117c2d2002-07-17 14:10:11 +0000312 SH_VA_START (args, format);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000313
314 vfprintf (stderr, format, args);
Jari Aalto7117c2d2002-07-17 14:10:11 +0000315 fprintf (stderr, ": %s\n", strerror (e));
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000316
317 va_end (args);
318}
319
320/* An error from the parser takes the general form
321
322 shell_name: input file name: line number: message
323
324 The input file name and line number are omitted if the shell is
325 currently interactive. If the shell is not currently interactive,
326 the input file name is inserted only if it is different from the
327 shell name. */
328void
329#if defined (PREFER_STDARG)
330parser_error (int lineno, const char *format, ...)
331#else
332parser_error (lineno, format, va_alist)
333 int lineno;
334 const char *format;
335 va_dcl
336#endif
337{
338 va_list args;
339 char *ename, *iname;
340
341 ename = get_name_for_error ();
Jari Aalto7117c2d2002-07-17 14:10:11 +0000342 iname = yy_input_name ();
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000343
344 if (interactive)
345 fprintf (stderr, "%s: ", ename);
346 else if (interactive_shell)
Jari Aalto31859422009-01-12 13:36:28 +0000347 fprintf (stderr, "%s: %s:%s%d: ", ename, iname, gnu_error_format ? "" : _(" line "), lineno);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000348 else if (STREQ (ename, iname))
Jari Aalto31859422009-01-12 13:36:28 +0000349 fprintf (stderr, "%s:%s%d: ", ename, gnu_error_format ? "" : _(" line "), lineno);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000350 else
Jari Aalto31859422009-01-12 13:36:28 +0000351 fprintf (stderr, "%s: %s:%s%d: ", ename, iname, gnu_error_format ? "" : _(" line "), lineno);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000352
Jari Aalto7117c2d2002-07-17 14:10:11 +0000353 SH_VA_START (args, format);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000354
355 vfprintf (stderr, format, args);
356 fprintf (stderr, "\n");
357
358 va_end (args);
359
360 if (exit_immediately_on_error)
Chet Ramey00018032011-11-21 20:51:19 -0500361 exit_shell (last_command_exit_value = 2);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000362}
363
Jari Aalto28ef6c32001-04-06 19:14:31 +0000364#ifdef DEBUG
Chet Rameyac50fba2014-02-26 09:36:43 -0500365/* This assumes ASCII and is suitable only for debugging */
366char *
367strescape (str)
368 const char *str;
369{
370 char *r, *result;
371 unsigned char *s;
372
373 r = result = (char *)xmalloc (strlen (str) * 2 + 1);
374
375 for (s = (unsigned char *)str; s && *s; s++)
376 {
377 if (*s < ' ')
378 {
379 *r++ = '^';
380 *r++ = *s+64;
381 }
382 else if (*s == 127)
383 {
384 *r++ = '^';
385 *r++ = '?';
386 }
387 else
388 *r++ = *s;
389 }
390
391 *r = '\0';
392 return result;
393}
394
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000395void
396#if defined (PREFER_STDARG)
397itrace (const char *format, ...)
398#else
399itrace (format, va_alist)
400 const char *format;
401 va_dcl
402#endif
403{
404 va_list args;
405
Jari Aaltof73dda02001-11-13 17:56:06 +0000406 fprintf(stderr, "TRACE: pid %ld: ", (long)getpid());
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000407
Jari Aalto7117c2d2002-07-17 14:10:11 +0000408 SH_VA_START (args, format);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000409
Jari Aalto726f6381996-08-26 18:22:31 +0000410 vfprintf (stderr, format, args);
411 fprintf (stderr, "\n");
412
413 va_end (args);
414
415 fflush(stderr);
416}
417
Jari Aalto726f6381996-08-26 18:22:31 +0000418/* A trace function for silent debugging -- doesn't require a control
419 terminal. */
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000420void
421#if defined (PREFER_STDARG)
422trace (const char *format, ...)
423#else
424trace (format, va_alist)
425 const char *format;
Jari Aalto726f6381996-08-26 18:22:31 +0000426 va_dcl
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000427#endif
Jari Aalto726f6381996-08-26 18:22:31 +0000428{
429 va_list args;
Jari Aalto726f6381996-08-26 18:22:31 +0000430 static FILE *tracefp = (FILE *)NULL;
431
432 if (tracefp == NULL)
Jari Aaltobb706242000-03-17 21:46:59 +0000433 tracefp = fopen("/tmp/bash-trace.log", "a+");
Jari Aalto726f6381996-08-26 18:22:31 +0000434
435 if (tracefp == NULL)
436 tracefp = stderr;
437 else
438 fcntl (fileno (tracefp), F_SETFD, 1); /* close-on-exec */
439
Jari Aaltof73dda02001-11-13 17:56:06 +0000440 fprintf(tracefp, "TRACE: pid %ld: ", (long)getpid());
Jari Aalto726f6381996-08-26 18:22:31 +0000441
Jari Aalto7117c2d2002-07-17 14:10:11 +0000442 SH_VA_START (args, format);
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000443
Jari Aalto726f6381996-08-26 18:22:31 +0000444 vfprintf (tracefp, format, args);
445 fprintf (tracefp, "\n");
446
447 va_end (args);
448
449 fflush(tracefp);
450}
Jari Aaltoccc6cda1996-12-23 17:02:34 +0000451
Jari Aalto28ef6c32001-04-06 19:14:31 +0000452#endif /* DEBUG */
Jari Aaltob72432f1999-02-19 17:11:39 +0000453
Jari Aalto7117c2d2002-07-17 14:10:11 +0000454/* **************************************************************** */
455/* */
456/* Common error reporting */
457/* */
458/* **************************************************************** */
459
460
Jari Aalto31859422009-01-12 13:36:28 +0000461static const char * const cmd_error_table[] = {
Jari Aaltob80f6442004-07-27 13:29:18 +0000462 N_("unknown command error"), /* CMDERR_DEFAULT */
463 N_("bad command type"), /* CMDERR_BADTYPE */
464 N_("bad connector"), /* CMDERR_BADCONN */
465 N_("bad jump"), /* CMDERR_BADJUMP */
Jari Aaltob72432f1999-02-19 17:11:39 +0000466 0
467};
468
469void
470command_error (func, code, e, flags)
471 const char *func;
472 int code, e, flags; /* flags currently unused */
473{
474 if (code > CMDERR_LAST)
475 code = CMDERR_DEFAULT;
476
Jari Aaltob80f6442004-07-27 13:29:18 +0000477 programming_error ("%s: %s: %d", func, _(cmd_error_table[code]), e);
Jari Aaltob72432f1999-02-19 17:11:39 +0000478}
479
480char *
481command_errstr (code)
482 int code;
483{
484 if (code > CMDERR_LAST)
485 code = CMDERR_DEFAULT;
486
Jari Aaltob80f6442004-07-27 13:29:18 +0000487 return (_(cmd_error_table[code]));
Jari Aaltob72432f1999-02-19 17:11:39 +0000488}
Jari Aalto7117c2d2002-07-17 14:10:11 +0000489
490#ifdef ARRAY_VARS
491void
492err_badarraysub (s)
493 const char *s;
494{
Jari Aaltob80f6442004-07-27 13:29:18 +0000495 report_error ("%s: %s", s, _(bash_badsub_errmsg));
Jari Aalto7117c2d2002-07-17 14:10:11 +0000496}
497#endif
498
499void
500err_unboundvar (s)
501 const char *s;
502{
Jari Aaltob80f6442004-07-27 13:29:18 +0000503 report_error (_("%s: unbound variable"), s);
Jari Aalto7117c2d2002-07-17 14:10:11 +0000504}
505
506void
507err_readonly (s)
508 const char *s;
509{
Jari Aaltob80f6442004-07-27 13:29:18 +0000510 report_error (_("%s: readonly variable"), s);
Jari Aalto7117c2d2002-07-17 14:10:11 +0000511}