DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

curs_initscr(S-osr5)


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-osr5) is almost always the first routine that should be called. The exceptions are slk_init(S-osr5), filter(S-osr5), ripoffline(S-osr5), use_env(S-osr5) and, for multiple-terminal applications, newterm(S-osr5).

initscr(S-osr5) determines the terminal type and initializes all curses(S-osr5) data structures. It also causes the first call to refresh(S-osr5) 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-osr5) 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-osr5) after a temporary escape makes the program resume visual mode.

isendwin

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

set_term

set_term(S-osr5) 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-osr5) 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-osr5), curs_kernel(S-osr5), curs_refresh(S-osr5), curs_slk(S-osr5), curs_util(S-osr5)

Standards conformance

delscreen(S-osr5), endwin(S-osr5), initscr(S-osr5), isendwin(S-osr5), newterm(S-osr5), delscreen(S-osr5), and set_term(S-osr5) are not part of any currently supported standard; they were developed by UNIX System Laboratories, Inc. and are maintained by The SCO Group.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005