]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - error.c
Bash-5.0 patch 4: the wait builtin without arguments only waits for known children...
[thirdparty/bash.git] / error.c
diff --git a/error.c b/error.c
index 1eac01c4a173820aadcf3a9b0335cf89febde11e..417c902e9124777f6e46dc4c9b285452009d8850 100644 (file)
--- a/error.c
+++ b/error.c
@@ -44,6 +44,7 @@ extern int errno;
 #include "bashintl.h"
 
 #include "shell.h"
+#include "execute_cmd.h"
 #include "flags.h"
 #include "input.h"
 
@@ -53,8 +54,6 @@ extern int errno;
 
 extern int executing_line_number __P((void));
 
-extern int last_command_exit_value;
-extern char *shell_name;
 #if defined (JOB_CONTROL)
 extern pid_t shell_pgrp;
 extern int give_terminal_to __P((pid_t, int));
@@ -272,6 +271,29 @@ internal_warning (format, va_alist)
   va_end (args);
 }
 
+void
+#if defined (PREFER_STDARG)
+internal_inform (const char *format, ...)
+#else
+internal_inform (format, va_alist)
+     const char *format;
+     va_dcl
+#endif
+{
+  va_list args;
+
+  error_prolog (1);
+  /* TRANSLATORS: this is a prefix for informational messages. */
+  fprintf (stderr, _("INFORM: "));
+
+  SH_VA_START (args, format);
+
+  vfprintf (stderr, format, args);
+  fprintf (stderr, "\n");
+
+  va_end (args);
+}
+
 void
 #if defined (PREFER_STDARG)
 sys_error (const char *format, ...)
@@ -340,6 +362,36 @@ parser_error (lineno, format, va_alist)
 }
 
 #ifdef DEBUG
+/* This assumes ASCII and is suitable only for debugging */
+char *
+strescape (str)
+     const char *str;
+{
+  char *r, *result;
+  unsigned char *s;
+
+  r = result = (char *)xmalloc (strlen (str) * 2 + 1);
+
+  for (s = (unsigned char *)str; s && *s; s++)
+    {
+      if (*s < ' ')
+       {
+         *r++ = '^';
+         *r++ = *s+64;
+       }
+      else if (*s == 127)
+       {
+         *r++ = '^';
+         *r++ = '?';
+       }
+     else
+       *r++ = *s;
+    }
+
+  *r = '\0';
+  return result;
+}
+
 void
 #if defined (PREFER_STDARG)
 itrace (const char *format, ...)