DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

curs_initscr(S)


curs_initscr: initscr, newterm, endwin, isendwin, set_term, delscreen -- curses screen initialization and manipulation routines

Syntax

cc ... -lcurses

#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);

Description

initscr

initscr(S) is almost always the first routine that should be called. The exceptions are slk_init(S), filter(S), ripoffline(S), use_env(S) and, for multiple-terminal applications, newterm(S).

initscr(S) determines the terminal type and initializes all curses(S) data structures. It also causes the first call to refresh(S) to clear the screen.

If errors occur, initscr( ) writes an error message to standard error and exits; otherwise, it returns a pointer to stdscr.

If the program needs an indication of error conditions, use newterm( ) instead of initscr( ), because initscr( ) should be called only once per application.

newterm

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, should also use newterm( ).

Call newterm( ) once for each terminal. It returns a variable of type SCREEN, which should be saved as a reference to that terminal. The arguments are the type of 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 from curses, the program must also call endwin(S) for each terminal being used. If newterm( ) is called more than once for the same terminal, the first terminal referred to must be the last one for which endwin( ) is called.

endwin

A program should always call endwin( ) before exiting or escaping from curses( ) mode temporarily. This routine does the following: Calling refresh( ) or doupdate(S) after a temporary escape makes the program resume visual mode.

isendwin

isendwin(S) returns TRUE if endwin( ) has been called without any subsequent calls to wrefresh(S), and FALSE otherwise.

set_term

set_term(S) is used to switch between different terminals. The screen reference new becomes the new current terminal. The previous terminal is returned by the routine.

This is the only routine that manipulates SCREEN pointers; all other routines affect only the current terminal.

delscreen

delscreen(S) frees storage associated with the SCREEN data structure. The routine endwin( ) does not do this, so call delscreen( ) after endwin( ) if a particular screen is no longer needed. The file pointers passed to newterm( ) must also be closed.

Return values

endwin( ) returns the integer ERR on failure and OK on successful completion.

Routines that return pointers always return NULL on error.

Warning

The header file curses.h automatically includes the header files stdio.h and unctrl.h.

The following can be macros: initscr( ) and newterm( ).

Files


/usr/lib/libcurses.a
the library

See also

curses(S), curs_kernel(S), curs_refresh(S), curs_slk(S), curs_util(S)

Standards conformance

delscreen(S), endwin(S), initscr(S), isendwin(S), newterm(S), delscreen(S), and set_term(S) are not part of any currently supported standard; they were developed by UNIX System Laboratories, Inc. and are maintained by The SCO Group.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003