curs_initscr, initscr, newterm, endwin, isendwin, set_term, delscreen - Curses routines for screen initialization and manipulation
Curses Library (libcurses)
Interfaces documented on this reference page conform to industry standards as follows:
initscr, endwin, newterm, set_term: XPG4, XPG4-UNIX
isendwin, delscreen: XPG4-UNIX
Refer to the
reference page for more information
about industry standards and associated tags.
The initscr routine is almost always the first routine that applications call. (The exceptions are slk_init, filter, ripoffline, use_env and, for multiple-terminal applications, newterm). The initscr routine determines the terminal type and initializes all Curses data structures. The routine also causes the first call to refresh to clear the screen. If errors occur, initscr writes an appropriate error message to standard error and then exits; otherwise, the routine returns a pointer to stdscr. If the program needs an indication of error conditions, newterm should be used instead of initscr; initscr should only be called once per application.
A program that outputs to more than one terminal should use the newterm routine for each terminal instead of initscr. A program that needs an indication of error conditions, so it can continue to run in a line-oriented mode if the terminal cannot support a screen-oriented program, would also use newterm. An application calls newterm once for each terminal. The routine returns a variable of type SCREEN * that should be saved as a reference to that terminal. The routine's arguments are the type of the terminal to be used in place of $TERM, a file pointer for output to the terminal, and another file pointer for input from the terminal. (If type is NULL, $TERM is used). Before exiting Curses, the program must also call endwin for each terminal being used. If the program calls newterm more than once for the same terminal, the first terminal referred to must be the last one for which endwin is called.
A program should always call endwin before exiting or escaping from Curses mode temporarily. This routine restores tty modes, moves the cursor to the lower left-hand corner of the screen, and resets the terminal into the proper nonvisual mode. Calling refresh or doupdate after a temporary escape causes the program to resume visual mode.
The isendwin routine returns TRUE if endwin has been called without any subsequent calls to wrefresh; otherwise, the routine returns FALSE.
The set_term routine switches between different terminals. The screen reference new becomes the new current terminal. The routine returns the previous terminal. This is the only routine that manipulates SCREEN pointers; all other routines affect only the current terminal.
routine frees storage associated with
data structure. The
routine does not perform this operation, so applications should call
if a particular
is no longer needed. Applications must also close file pointers
The header file
includes the header file
The endwin routine returns the integer ERR upon failure and OK upon successful completion.
Routines that return pointers always return
Functions: curses(3), curs_kernel(3), curs_refresh(3), curs_slk(3), curs_util(3)