[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

initscr and newterm Subroutine

Purpose

Initializes curses and its data structures.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>
WINDOW *initscr(void);
SCREEN *newterm(char *type,
FILE *outfile,
FILE *infile);

Description

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

The newterm subroutine 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 TERM 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 subroutine should be called once for each terminal.

The initscr subroutine is equivalent to:

newterm(gentenv("TERM"), stdout, stdin); return stdscr;

If the current disposition for the signals SIGINT, SIGQUIT or SIGTSTP is SIGDFL, then the initscr subroutine 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 and newterm subroutines initialise the cur_term external variable.

initscr           CURSES           Curses Interfaces

Return Values

Upon successful completion, the initscr subroutine returns a pointer to stdscr. Otherwise, it does not return.

Upon successful completion, the newterm subroutine returns a pointer to the specified terminal. Otherwise, it returns a null pointer.

Example

To initialize curses so that other curses subroutines can be called, use:

initscr();

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The delscreen, doupdate, del_curterm, filter, slk_attroff, use_env subroutine, setupterm subroutine.

Curses Overview for Programming, Initializing Curses, List of Curses Subroutines in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Contents | Glossary | Home | Search ]