summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1999-02-19 17:11:39 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:52 +0000
commitb72432fdcc59300c6fe7c9d6c8a31ad3447933f5 (patch)
treeb9899162338c2ff3fd83a8aef8831cb119e85cd7 /error.c
parentbc4cd23ce958feda898c618215f94d8a4e8f4ffa (diff)
downloadbash-b72432fdcc59300c6fe7c9d6c8a31ad3447933f5.tar.gz
Imported from ../bash-2.03.tar.gz.
Diffstat (limited to 'error.c')
-rw-r--r--error.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/error.c b/error.c
index 816546fc..0652efe8 100644
--- a/error.c
+++ b/error.c
@@ -496,3 +496,32 @@ trace (format, va_alist)
#endif /* 0 */
#endif /* USE_VARARGS */
+
+static char *cmd_error_table[] = {
+ "unknown command error", /* CMDERR_DEFAULT */
+ "bad command type", /* CMDERR_BADTYPE */
+ "bad connector", /* CMDERR_BADCONN */
+ "bad jump", /* CMDERR_BADJUMP */
+ 0
+};
+
+void
+command_error (func, code, e, flags)
+ const char *func;
+ int code, e, flags; /* flags currently unused */
+{
+ if (code > CMDERR_LAST)
+ code = CMDERR_DEFAULT;
+
+ programming_error ("%s: %s: %d", func, cmd_error_table[code], e);
+}
+
+char *
+command_errstr (code)
+ int code;
+{
+ if (code > CMDERR_LAST)
+ code = CMDERR_DEFAULT;
+
+ return (cmd_error_table[code]);
+}