xref: /illumos-gate/usr/src/ucblib/libcurses/endwin.c (revision 9b9d39d2a32ff806d2431dbcc50968ef1e6d46b2)
1 /*
2  * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
7 /*	  All Rights Reserved  	*/
8 
9 /*
10  * Copyright (c) 1980 Regents of the University of California.
11  * All rights reserved.  The Berkeley software License Agreement
12  * specifies the terms and conditions for redistribution.
13  */
14 
15 /*LINTLIBRARY*/
16 
17 #ifndef lint
18 static char
19 sccsid[] = "@(#)endwin.c 1.6 88/02/08 SMI"; /* from UCB 5.1 85/06/07 */
20 #endif /* not lint */
21 
22 /*
23  * Clean things up before exiting
24  */
25 
26 #include	<sgtty.h>
27 #include	<malloc.h>
28 #include	"curses.ext"
29 #include	<term.h>
30 
31 int
32 endwin(void)
33 {
34 	resetty();
35 	(void) _puts(VE);
36 	(void) _puts(TE);
37 	if (curscr) {
38 		if (curscr->_flags & _STANDOUT) {
39 			(void) _puts(SE);
40 			curscr->_flags &= ~_STANDOUT;
41 		}
42 		_endwin = TRUE;
43 	}
44 	return (OK);
45 }
46