4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
40 #pragma ident "%Z%%M% %I% %E% SMI"
44 /* Clean things up before exiting. */
47 #include <sys/types.h>
48 #include "curses_inc.h"
50 #ifdef _VR2_COMPAT_CODE
52 #endif /* _VR2_COMPAT_CODE */
58 * The test below must stay at TRUE because the value of 2
59 * has special meaning to wrefresh but does not mean that
60 * endwin has been called.
62 if (SP
&& (SP
->fl_endwin
== TRUE
))
71 /* make sure we're in program mode */
73 /* If endwin is equal to 2 it means we just did a newscreen. */
74 if (SP
->fl_endwin
== TRUE
) {
75 (void) reset_prog_mode();
77 (void) tputs(keypad_xmit
, 1, _outch
);
79 (void) tputs(meta_on
, 1, _outch
);
80 if (cur_term
->_cursorstate
!= 1)
81 _PUTS(cur_term
->cursor_seq
82 [cur_term
->_cursorstate
], 0);
84 _PUTS(enter_ca_mode
, 1);
85 (void) tputs(ena_acs
, 1, _outch
);
86 if (exit_attribute_mode
)
87 _PUTS(tparm_p0(exit_attribute_mode
), 1);
90 * If there is no exit_attribute mode, then vidupdate
91 * could only possibly turn off one of the below three
92 * so that's all we ask it turn off.
95 (A_ALTCHARSET
| A_STANDOUT
| A_UNDERLINE
), _outch
);
97 SP
->fl_endwin
= FALSE
;
99 #ifdef _VR2_COMPAT_CODE
100 _endwin
= (char) FALSE
;
101 #endif /* _VR2_COMPAT_CODE */
104 /* See comment above why this test is explicitly against TRUE. */
105 if (SP
->fl_endwin
== TRUE
)
108 /* Flush out any output not output due to typeahead. */
110 (void) force_doupdate();
112 /* Close things down. */
115 (void) tputs(meta_off
, 1, _outch
);
116 (void) mvcur(curscr
->_cury
, curscr
->_curx
, curscr
->_maxy
- 1, 0);
119 (void) tputs(keypad_local
, 1, _outch
);
120 if (cur_term
->_cursorstate
!= 1)
121 (void) tputs(cursor_normal
, 0, _outch
);
123 /* don't bother turning off colors: it will be done later anyway */
124 curscr
->_attrs
&= ~A_COLOR
; /* SS: colors */
126 if ((curscr
->_attrs
!= A_NORMAL
) &&
127 (magic_cookie_glitch
< 0) && (!ceol_standout_glitch
))
128 _VIDS(A_NORMAL
, curscr
->_attrs
);
133 SP
->fl_endwin
= TRUE
;
135 #ifdef _VR2_COMPAT_CODE
137 #endif /* _VR2_COMPAT_CODE */
139 curscr
->_clear
= TRUE
;
140 (void) reset_shell_mode();
141 (void) tputs(exit_ca_mode
, 0, _outch
);
143 /* restore colors and default color pair. SS: colors */
145 (void) tputs(orig_colors
, 1, _outch
);
147 (void) tputs(tparm_p0(orig_pair
), 1, _outch
);
149 /* SS-mouse: free the mouse. */
152 (void) tputs(tparm_p1(get_mouse
, 0), 1, _outch
);
154 (void) fflush(SP
->term_file
);
162 char chars_onQ
= cur_term
->_chars_on_queue
;
166 * This will cause _chkinput to return FALSE which will force wrefresh
167 * to think there is no input waiting and it will finish its refresh.
170 cur_term
->_chars_on_queue
= INP_QSIZE
;
172 cur_term
->_chars_on_queue
= chars_onQ
;