aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/tedit/display/screen/psend.x
blob: 1d86e6df0d505f5dfc5c180256e3778a61f68a45 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# PS_END -- Terminate physical display package
#
# B.Simon	18-Jan-89	Original
# B.Simon	26-Sep-90	Updated to use screen buffer

procedure ps_end()

#--
include	"screen.com"

char	newline
data	newline	/ '\n' /

begin
	# Restore terminal to original state and release termcap structure

	if (term != NULL) {
	    call ps_sendcap ("ve", 1)
	    call ps_sendcap ("te", 1)

	    if (ttyout != NULL) {
		call ttygoto (ttyout, term, 1, lines)
		call putc (ttyout, newline)
	    }
	    call ttyclose (term)
	    term = NULL
	}

	# Release screen memory

	if (termscr != NULL) {
	    call mfree (termscr, TY_CHAR)
	    termscr = NULL
	}

	# Close terminal descriptor

	if (ttyin != NULL) {
	    call close (ttyin)
	    ttyin = NULL
	}

	if (ttyout != NULL) {
	    call close (ttyout)
	    ttyout = NULL
	}

end