Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > D


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


del_curterm(), restartterm(), set_curterm(), setupterm() — interfaces to the terminfo database


#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;


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; 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 terminal 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 following values to report the function outcome:


The terminfo database was not found (function fails).


The entry for the terminal was not found in terminfo (function fails).



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);

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 variables 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().


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.


No errors are defined.


An application would call setupterm() if it required access to the terminfo database but did not otherwise need to use Curses.


baudrate(3X), erasechar(3X), has_ic(3X), longname(3X), putc(3S), termattrs(3X), termname(3X), tgetent(3X), tigetflag(3X), use_env(3X), terminfo(4), see section Selecting a Terminal, <term.h>.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.