aboutsummaryrefslogtreecommitdiff
path: root/sys/tty/ttyclear.x
blob: 86dac6ffca4afe3bfbf3469835cd3c6e8ef52073 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<chars.h>
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