HP-UX Reference (11i v1 05/09) - 3 Library Functions A-M (vol 6)

d
del_curterm(3X) del_curterm(3X)
(ENHANCED CURSES)
NAME
del_curterm(), restartterm(), set_curterm(), setupterm() - interfaces to the terminfo database
SYNOPSIS
#include <term.h>
int del_curterm(TERMINAL *oterm);
int restartterm(char *term, int fildes, int *errret);
TERMINAL *set_curterm(TERMINAL *nterm);
int setupterm(char *term, int fildes, int *errret);
extern TERMINAL *cur_term;
DESCRIPTION
These functions retrieve information from the terminfo database.
To gain access to the terminfo database,
setupterm() must be called first. It is automatically called
by
initscr() and newterm() . The setupterm() function initializes the other functions to use the
terminfo record for a specified terminal (which depends on whether use_env() was called). It sets
the cur_term 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;ifterm 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 terminal type.
The application must set fildes to a file descriptor, open for output, to the terminal device, before calling
setupterm() .Iferrret is not null, the integer it points to is set to one of the following 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 mes-
sage 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);
The set_curterm() function sets the variable cur_term to nterm, and makes all of the
terminfo
boolean, numeric, and string variables use the values from nterm.
The del_curterm() function frees the space pointed to by oterm and makes it available for further use.
If oterm is the same as cur_term, 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, set_curterm() returns the previous value of cur_term. Otherwise, it
returns a null pointer.
Upon successful completion, the other functions return OK. Otherwise, they return ERR.
ERRORS
No errors are defined.
APPLICATION USAGE
An application would call setupterm() if it required access to the terminfo database but did not oth-
erwise need to use Curses.
HP-UX 11i Version 1: September 2005 1 Hewlett-Packard Company Section 3133