del_curterm(3X) del_curterm(3X)
NAME
delcurterm, restartterm, setcurterm, setupterm - interfaces to the
terminfo database
SYNOPSIS
cc [flag ...] file ... -lcurses [library ...]
#include <term.h>
int delcurterm(TERMINAL *oterm);
int restartterm(char *term, int fildes, int *errret);
TERMINAL *setcurterm(TERMINAL *nterm);
int setupterm(char *term, int fildes, int *errret);
DESCRIPTION
These functions retrieve information from the terminfo(4) database.
To gain access to the terminfo database, setupterm() must be called
first. It is automatically called by initscr() and newterm(). The
setupterm() function initialises the other functions to use the
terminfo record for a specified terminal (which depends on whether
useenv() was called). It sets the curterm external variable to a
TERMINAL structure that contains the record from the terminfo database
for the specified terminal.
The terminal type is the character string term; if term is a null
pointer, the environment variable TERM is used. If TERM is not set or
if its value is an empty string, then "unknown" is used as the termi-
nal type. The application must set fildes to a file descriptor, open
for output, to the terminal device, before calling setupterm(). If
errret is not null, the integer it points to is set to one of the fol-
lowing values to report the function outcome:
-1 The terminfo database was not found (function fails).
0 The entry for the terminal was not found in terminfo (function
fails).
1 Success.
If setupterm() detects an error and errret is a null pointer,
setupterm() writes a diagnostic message and exits.
A simple call to setupterm() that uses all the defaults and sends the
output to stdout is:
setupterm((char *)0, fileno(stdout), (int *)0);
Page 1 Reliant UNIX 5.44 Printed 11/98
del_curterm(3X) del_curterm(3X)
The setcurterm() function sets the variable curterm to nterm, and
makes all of the terminfo boolean, numeric, and string variables use
the values from nterm.
The delcurterm() function frees the space pointed to by oterm and
makes it available for further use. If oterm is the same as curterm,
references to any of the terminfo boolean, numeric, and string vari-
ables thereafter may refer to invalid memory locations until
setupterm() is called again.
The restartterm() function assumes a previous call to setupterm()
(perhaps from initscr() or newterm()). It lets the application specify
a different terminal type in term and updates the information returned
by baudrate() based on fildes, but does not destroy other information
created by initscr(), newterm() or setupterm().
RETURN VALUE
Upon successful completion, setcurterm() returns the previous value
of curterm. Otherwise, it returns a null pointer.
Upon successful completion, the other functions return OK. Otherwise,
they return ERR.
ERRORS
No errors are defined.
NOTES
An application would call setupterm() if it required access to the
terminfo database but did not otherwise need to use Curses.
SEE ALSO
putc(3S), baudrate(3X), curses(3X), erasechar(3X), hasic(3X),
longname(3X), termattrs(3X), termname(3X), tgetent(3X), tigetflag(3X),
useenv(3X), terminfo(4), term(5).
Page 2 Reliant UNIX 5.44 Printed 11/98