summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--error.c18
-rw-r--r--error.h3
-rw-r--r--execute_cmd.c2
3 files changed, 22 insertions, 1 deletions
diff --git a/error.c b/error.c
index 72da9f5..c6ea581 100644
--- a/error.c
+++ b/error.c
@@ -246,6 +246,24 @@ internal_error (format, va_alist)
va_end (args);
}
+#if defined (PREFER_STDARG)
+invalid_cmd (const char *format, ...)
+#else
+invalid_cmd (format, va_alist)
+ const char *format;
+ va_dcl
+#endif
+{
+ va_list args;
+
+ SH_VA_START (args, format);
+
+ vfprintf (stderr, format, args);
+ fprintf (stderr, "\n");
+
+ va_end (args);
+}
+
void
#if defined (PREFER_STDARG)
internal_warning (const char *format, ...)
diff --git a/error.h b/error.h
index e79ba3e..d5ec12f 100644
--- a/error.h
+++ b/error.h
@@ -47,6 +47,9 @@ extern void sys_error __P((const char *, ...)) __attribute__((__format__ (print
/* Report an internal error. */
extern void internal_error __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
+/* Report an invalid command. */
+extern void invalid_cmd __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
+
/* Report an internal warning. */
extern void internal_warning __P((const char *, ...)) __attribute__((__format__ (printf, 1, 2)));
diff --git a/execute_cmd.c b/execute_cmd.c
index e65a03f..df4094b 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -4571,7 +4571,7 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out,
hookf = find_function (NOTFOUND_HOOK);
if (hookf == 0)
{
- internal_error (_("%s: command not found"), pathname);
+ invalid_cmd (_("\n Invalid command: [%s]\n"), pathname);
exit (EX_NOTFOUND); /* Posix.2 says the exit status is 127 */
}