DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

initscr(3curses)


initscr -- screen initialisation functions

Synopsis

cc [options] file -lcurses
#include <curses.h>

WINDOW *initscr(void);

SCREEN *newterm(char *type, FILE *outfile, FILE *infile);

Description

The initscr(3curses) function determines the terminal type and initialises all implementation data structures. The environment variable specifies the terminal type. The initscr(3curses) function also causes the first refresh operation to clear the screen. If errors occur, initscr(3curses) writes an appropriate error message to standard error and exits. The only functions that can be called before initscr(3curses) or newterm(3curses) are filter(3curses), ripoffline(3curses), slk_init(3curses), use_env(3curses) and the functions whose prototypes are defined in <term.h>. Portable applications must not call initscr(3curses) twice.

The newterm(3curses) function can be called as many times as desired to attach a terminal device. The type argument points to a string specifying the terminal type, except that if type is a null pointer, the environment variable is used. The outfile and infile arguments are file pointers for output to the terminal and input from the terminal, respectively. It is unspecified whether Curses modifies the buffering mode of these file pointers. The newterm(3curses) function should be called once for each terminal.

The initscr(3curses) function is equivalent to:

   newterm(getenv("TERM"), stdout, stdin);
   return stdscr;
If the current disposition for the signals SIGINT, SIGQUIT or SIGTSTP is SIGDFL, then initscr(3curses) may also install a handler for the signal, which may remain in effect for the life of the process or until the process changes the disposition of the signal.

The initscr(3curses) and newterm(3curses) functions initialise the cur_term external variable.

Return value

Upon successful completion, initscr(3curses) returns a pointer to stdscr. Otherwise, it does not return.

Upon successful completion, newterm(3curses) returns a pointer to the specified terminal. Otherwise, it returns a null pointer.

Errors

No errors are defined.

Usage

A program that outputs to more than one terminal should use newterm(3curses) for each terminal instead of initscr(3curses). 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 this function.

Applications should perform any required handling of the SIGINT, SIGQUIT, or SIGTSTP signals before calling initscr(3curses).

Standards Conformance

The Single UNIX Specification, Version 2; The Open Group.

References

delscreen(3curses), doupdate(3curses), del_curterm(3curses), filter(3curses), slk_attroff(3curses), use_env(3curses), curses(4)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004