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/fio/xerputc.x | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 sys/fio/xerputc.x (limited to 'sys/fio/xerputc.x') diff --git a/sys/fio/xerputc.x b/sys/fio/xerputc.x new file mode 100644 index 00000000..5fda4026 --- /dev/null +++ b/sys/fio/xerputc.x @@ -0,0 +1,37 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include +include +include + +# XERPUTC -- Low level routine, called by the error handling code, to +# accumulate an error command, and send it off to the CL. Clumsy, but +# necessary to avoid recursion if an error abort occurs in a routine +# such as PUTC or FLSBUF. The buffer is automatically flushed to CLOUT +# when newline is encountered. + +procedure xerputc (ch) + +char ch +int op, junk, nchars +char msg[SZ_LINE+1] +include +data op /1/ + +begin + msg[op] = ch + + if (ch == '\n' || op > SZ_PATHNAME) { + fp = fiodes[CLOUT] + nchars = op + op = 0 + + if (FTYPE(fp) == TEXT_FILE) + call fputtx (CLOUT, msg, nchars, junk) + else { + call zcall4 (ZAWRBF(fp), FCHAN(fp), msg, nchars * SZB_CHAR, 0) + } + } + + op = op + 1 +end -- cgit