summaryrefslogtreecommitdiffstats
path: root/lib/libncurses/lib_endwin.c
blob: 4e07e8fc24bde5a8a49b3ad725383003c2fe45b3 (plain)
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
49
50

/* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for   *
*  details. If they are missing then this copy is in violation of    *
*  the copyright conditions.                                        */

/*
**	lib_endwin.c
**
**	The routine endwin().
**
*/

#include "terminfo.h"
#include "curses.priv.h"

int isendwin()
{
	if (SP == NULL)
		return FALSE;
	return SP->_endwin;
}

int
endwin()
{
	T(("endwin() called"));

	SP->_endwin = TRUE;

	if (change_scroll_region)
		putp(tparm(change_scroll_region, 0, lines - 1));

	mvcur(-1, -1, lines - 1, 0);

	if (exit_ca_mode)
	    putp(exit_ca_mode);

	if (SP->_coloron == TRUE)
		putp(orig_pair);

	if (curscr  &&  (curscr->_attrs != A_NORMAL))
	    vidattr(curscr->_attrs = A_NORMAL);

	if (SP->_cursor != 1)
	    putp(cursor_normal);

	fflush(SP->_ofp);

	return(reset_shell_mode());
}
OpenPOWER on IntegriCloud