p .Va extern int LINES ;
p .Va extern int COLS ; .Sh DESCRIPTION These functions initialize terminals and screens.
p The .Fn newterm function initialises the curses data structures and pointers ready for use by curses. The .Fa type argument points to a .Xr terminfo 5 entry, or it may be .Dv NULL in which case the TERM environment variable is used. The .Fa outfd and .Fa infd are the output and input file descriptors for the terminal. The .Fn newterm function must only be called once per terminal.
p The .Fn set_term function can be used to switch between the screens defined by calling .Fn newterm , a pointer to the previous screen structure that was in use will be returned on success.
p Calling .Fn delscreen will destroy the given screen and free all allocated resources.
p Calling .Fn endwin will end the curses session and restore the saved terminal settings.
p The curses session must be initialised by calling .Fn initscr which saves the current terminal state and sets up the terminal and internal data structures to support the curses application. This function call must be, with few exceptions, the first Curses library call made. The exception to this rule is the .Fn newterm call which may be called prior to .Fn initscr . The size of the curses screen is determined by checking the .Xr tty 4 size and then the .Xr terminfo 5 entries for the terminal type. If the environment variables .Ev LINES or .Ev COLUMNS are set, then these will be used instead.
p When either .Fn newterm or .Fn initscr are called, the Curses library sets up signal handlers for .Dv SIGTSTP and .Dv SIGWINCH . If a signal handler is already installed for .Dv SIGWINCH , this will also be called when the Curses library handler is called.
p The .Fn isendwin function can be used to determine whether or not a refresh of the screen has occurred since the last call to .Fn endwin .
p The size of the screen may be changed by calling .Fn resizeterm with the updated number of lines and columns. This will resize the curses internal data structures to accommodate the changed terminal geometry. The .Dv curscr and .Dv stdscr windows and any of their subwindows will be resized to fit the new screen size. The application must redraw the screen after a call to .Fn resizeterm .
p The .Fn setterm function sets the terminal type for the current screen to the one passed, initialising all the curses internal data structures with information related to the named terminal. The .Fa name argument must be a valid name or alias in the .Xr terminfo 5 database for this function to succeed.
p The .Fn filter function changes the way the terminal is initialised. A subsequent call to .Fn initscr or .Fn newterm performs the following additonal actions: l -bullet -compact t Disable use of clear, cud, cud1, cup, cuu, cuu1 and vpa. t Set the value of the home string to the value of the cr string. t Set lines equal to 1. .El
p The .Fn use_env function determines whether the environment variables .Ev LINES and .Ev COLUMNS override the normal values. The default is true. Any call to .Fn use_env must precede calls to .Fn initscr , .Fn newterm , or .Fn setupterm . .Sh RETURN VALUES Functions returning pointers will return .Dv NULL if an error is detected. The functions that return an int will return one of the following values:
p l -tag -width ERR -compact t Er OK The function completed successfully. t Er ERR An error occurred in the function. .El .Sh SEE ALSO .Xr curses_window 3 , .Xr tty 4 , .Xr terminfo 5 , .Xr signal 7 .Sh STANDARDS The .Nx Curses library complies with the X/Open Curses specification, part of the Single Unix Specification. .Sh HISTORY The Curses package appeared in x 4.0 . The .Fn resizeterm function is a .Em ncurses extension to the Curses library and was added in .Nx 1.6 .