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/putc.x | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 sys/fio/putc.x (limited to 'sys/fio/putc.x') diff --git a/sys/fio/putc.x b/sys/fio/putc.x new file mode 100644 index 00000000..3021347d --- /dev/null +++ b/sys/fio/putc.x @@ -0,0 +1,38 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include +include + +# PUTC -- Put a character to a file. + +procedure putc (fd, ch) + +int fd # output file +char ch # character to be output + +int and() +errchk flsbuf +include + +begin + if (iop[fd] < bufptr[fd] || iop[fd] >= otop[fd]) + call flsbuf (fd, 0) + + Memc[iop[fd]] = ch + iop[fd] = iop[fd] + 1 + + if (ch == '\n') # end of line of text? + if (and (FF_FLUSH, fflags[fd]) != 0) + call flsbuf (fd, 0) +end + + +# PUTCHAR -- Put a character to the standard output. + +procedure putchar (ch) + +char ch # character to be output + +begin + call putc (STDOUT, ch) +end -- cgit