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/tty/ttyclear.x | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 sys/tty/ttyclear.x (limited to 'sys/tty/ttyclear.x') diff --git a/sys/tty/ttyclear.x b/sys/tty/ttyclear.x new file mode 100644 index 00000000..86dac6ff --- /dev/null +++ b/sys/tty/ttyclear.x @@ -0,0 +1,31 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include +include "tty.h" + +# TTYCLEAR -- Clear the terminal screen. + +procedure ttyclear (fd, tty) + +int fd +pointer tty + +int status +bool ttygetb() +int ttyctrl() +errchk ttygetb, ttyctrl + +begin + # If hardcopy terminal, output formfeed instead of clear. + if (ttygetb (tty, "ht")) + status = ttyctrl (fd, tty, "ff", T_NLINES(tty)) + else + status = ERR + if (status == ERR) + status = ttyctrl (fd, tty, "cl", T_NLINES(tty)) + + # If ff or cl capability not found, the best we can do is output + # a newline. + if (status == ERR) + call putline (fd, "\n") +end -- cgit