From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/etc/syserr.x | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 sys/etc/syserr.x (limited to 'sys/etc/syserr.x') 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 -- cgit