aboutsummaryrefslogtreecommitdiff
path: root/sys/etc/syserr.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/etc/syserr.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/etc/syserr.x')
-rw-r--r--sys/etc/syserr.x49
1 files changed, 49 insertions, 0 deletions
diff --git a/sys/etc/syserr.x b/sys/etc/syserr.x
new file mode 100644
index 00000000..a14d516d
--- /dev/null
+++ b/sys/etc/syserr.x
@@ -0,0 +1,49 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+define SZ_ERRMSG SZ_LINE
+
+# SYSERR -- Process a system error. No arguments; print only the error
+# message from the system error message file.
+
+procedure syserr (errcode)
+
+int errcode
+
+begin
+ call syserrs (errcode, "")
+end
+
+
+# SYSERRS -- System error, with a user supplied string argument. We do not
+# want to search the system error message file until ERRACT is called to
+# output the error message and initiate error recovery, because if an IFERR
+# error handler is posted the message will never be used. Hence we encode
+# an error message of the form "123 user_string", where "123" is the encoded
+# system error message number. If a message is ever actually output the
+# 123 will be expanded into a readable error message.
+
+procedure syserrs (errcode, user_string)
+
+int errcode
+char user_string[ARB]
+
+char buf[SZ_ERRMSG]
+int ip, op
+int itoc()
+
+begin
+ # Encode error code, to be used to search error message file.
+ op = itoc (errcode, buf, SZ_ERRMSG) + 1
+
+ if (user_string[1] != EOS) {
+ buf[op] = ' '
+ op = op + 1
+ for (ip=1; op <= SZ_ERRMSG && user_string[ip] != EOS; ip=ip+1) {
+ buf[op] = user_string[ip]
+ op = op + 1
+ }
+ }
+ buf[op] = EOS
+
+ call error (errcode, buf)
+end