Content-type: text/html
curs_initscr, initscr, newterm, endwin, isendwin, set_term, delscreen - Curses routines for screen initialization and manipulation
#include <curses.h>
WINDOW *initscr(
void
);
int endwin(
void
);
int isendwin(
void
);
SCREEN *newterm(
char *type,
FILE *outfd,
FILE *infd
);
SCREEN *set_term(
SCREEN *new
);
void delscreen(
SCREEN *sp
);
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
standards(5)
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.
The
delscreen
routine frees storage associated with
the
SCREEN
data structure. The
endwin
routine does not perform this operation, so applications should call
delscreen
after
endwin
if a particular
SCREEN
is no longer needed. Applications must also close file pointers
passed to
newterm.
The header file
<curses.h>
automatically
includes the header file
<stdio.h>.
The endwin routine returns the integer ERR upon failure and OK upon successful completion.
Routines that return pointers always return
NULL
on error.
Functions: curses(3), curs_kernel(3), curs_refresh(3), curs_slk(3), curs_util(3)
Others: standards(5)