newterm.c revision 2
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License, Version 1.0 only 2N/A * (the "License"). You may not use this file except in compliance 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 1995-1999 by Sun Microsystems, Inc. 2N/A * All rights reserved. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved. 2N/A * Assume terminal has only one screen line by restricting those 2N/A * capabilities that assume more than one line. This function must 2N/A * be called before initscr() or newterm(). 2N/A * This flag will reset after initscr() or newterm() so that subsequent 2N/A * calls to newterm(), without a preceding call to filter(), will load 2N/A * an unmodified terminal. THIS IS NOT HISTORICAL PRACTICE, BUT DEEMED 2N/A * Only permit SIGTSTP if the curent process is the process 2N/A * group leader. If the process is not the current group 2N/A * leader, then suspending the current process will suspend 2N/A * other members of the process group, such as the parent 2N/A#
endif /* SIG_UNBLOCK */ 2N/A#
else /* no SIGTSTP */ 2N/A * Do real soft label key initialisation once setupterm() have been called 2N/A * to load the current terminal. Determine whether the terminal supplies 2N/A * soft label keys, or whether we have to fake it by using the last line 2N/A * of a terminal screen. 2N/A /* Does the terminal have a method to program the soft label key? */ 2N/A /* We have to fake it. */ 2N/A /* Test suite seems to expect this */ 2N/A * The XCurses specification is unclear how ripoffline() would 2N/A * affect newterm(). We assume that it can't be used with newterm() 2N/A * and that it only affects initscr(), which is responsible for 2N/A * If line is positive (1), one line is removed from the beginning of 2N/A * stdscr; else if line is negative (-1), one line is removed from the end. 2N/A * Create a new terminal screen. Used if a program is going to be sending 2N/A * output to more than one terminal. It returns a SCREEN* for the terminal. 2N/A * The parameters are a terminal name, output FILE*, and input FILE*. If 2N/A * the terminal name is null then $TERM is used. The program must also 2N/A * call endwin() for each terminal being used before exiting from curses. 2N/A * If newterm() is called more than once for the same terminal, the first 2N/A * terminal referred to must be the last one for which endwin() is called. 2N/A * Input stream should be unbuffered so that m_tfgetc() works 2N/A * correctly on BSD and SUN systems. 2N/A * Not sure whether we really want to concern ourselves with the output 2N/A * buffer scheme. Might be best to leave it upto the application to 2N/A * deal with buffer schemes and when to perform flushes. 2N/A * MKS Vi uses MKS Curses and so must support the ability to switch in 2N/A * and out of Curses mode when switching from Vi to Ex and back. 2N/A * Problem is that in Vi mode you would prefer full buffered output to 2N/A * give updates a smoother appearance and Ex mode you require line 2N/A * buffered in order to see prompts and messages. 2N/A * Maximum length of a multbyte key sequence, including 2N/A * multibyte characters and terminal function keys. 2N/A /* Setup wide input for XCurses. */ 2N/A /* Assume only one line. */ 2N/A /* Disable capabilities that assume more than one line. */ 2N/A /* Re-evaluate the cursor motion costs. */ 2N/A /* Reset flag for subsequent calls to newterm(). */ 2N/A * doupdate() will perform the final screen preparations like 2N/A * enter_ca_mode, reset_prog_mode() (to assert the termios 2N/A /* Assert that __m_screen is set to the new terminal. */ 2N/A /* Disable echo in tty driver, Curses does software echo. */ 2N/A /* Enable mappnig of cr -> nl on input and nl -> crlf on output. */ 2N/A /* Use real tabs. */ 2N/A * Default to 'cbreak' mode as per 2N/A * Default to 'idcok' mode as per 2N/A * Create and initialise ripped off line windows. 2N/A * It is the application's responsiblity to free the 2N/A * windows when the application terminates. 2N/A for (i = 0; i < n; ++i) {
2N/A * Free storage associated with a screen structure. 2N/A * NOTE endwin() does not do this. 2N/A * Switch current terminal for Curses layer.