]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libncurses/lib_endwin.c
Make bdev userland access work like cdev userland access unless
[FreeBSD/FreeBSD.git] / lib / libncurses / lib_endwin.c
1
2 /* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for   *
3 *  details. If they are missing then this copy is in violation of    *
4 *  the copyright conditions.                                        */
5
6 /*
7 **      lib_endwin.c
8 **
9 **      The routine endwin().
10 **
11 */
12
13 #include "terminfo.h"
14 #include "curses.priv.h"
15
16 int isendwin()
17 {
18         if (SP == NULL)
19                 return FALSE;
20         return SP->_endwin;
21 }
22
23 int
24 endwin()
25 {
26         T(("endwin() called"));
27
28         SP->_endwin = TRUE;
29
30         if (change_scroll_region)
31                 putp(tparm(change_scroll_region, 0, lines - 1));
32
33         mvcur(-1, -1, lines - 1, 0);
34
35         if (exit_ca_mode)
36             putp(exit_ca_mode);
37
38         if (SP->_coloron == TRUE)
39                 putp(orig_pair);
40
41         if (curscr  &&  (curscr->_attrs != A_NORMAL))
42             vidattr(curscr->_attrs = A_NORMAL);
43
44         if (SP->_cursor != 1)
45             putp(cursor_normal);
46
47         fflush(SP->_ofp);
48
49         return(reset_shell_mode());
50 }