HP-UX Reference (11i v1 05/09) - 3 Library Functions N-Z (vol 7)

t
termcap(3X) termcap(3X)
TO BE OBSOLETED TO BE OBSOLETED
NAME
termcap: tgetent(), tgetflag(), tgetnum(), tgetstr(), tgoto(), tputs() - emulate /usr/share/lib/termcap access
routines
SYNOPSIS
#include <curses.h>
int tgetent(char *bp, const char *name);
int tgetnum(const char *id);
int tgetflag(const char *id);
char *tgetstr(const char *id, char **area);
char *tgoto(char *cm, int destcol, int destline);
int tputs(char *cp, int affcnt, int (*outc)(int));
DESCRIPTION
These functions extract and use capabilities from the compiled terminal capability data bases (see ter-
minfo(4)). They are emulation routines that are provided as a part of the Curses library (see
curses_intro(3X) and curses(5)).
tgetent() Extracts the compiled entry for terminal name into buffers accessible by the program-
mer. Unlike previous termcap routines, all capability strings (except cursor address-
ing and padding information) are already compiled and stored internally upon return
from tgetent() . The buffer pointer bp is redundant in the emulation, and is
ignored. It should not be relied upon to point to meaningful information.
tgetent() returns -1 if it cannot access the terminfo directory, 0 if there is no capa-
bility file for name, and 1 if all goes well. If a TERMINFO environment variable is set,
tgetent() first looks for TERMINFO/?/ name (where ? is the first character of
name), and if that le is not accessible, it looks for
/usr/share/lib/terminfo/?/
name.
tgetnum() Gets the numeric value of capability id, returning -1 if it is not given for the terminal.
tgetnum() is useful only with capabilities having numeric values.
tgetflag() Returns 1 if the specified capability is present in the terminal’s entry, and 0 if it is not.
tgetflag() is useful only with capabilities that are boolean in nature (i.e. either
present or missing in terminfo(4)).
tgetstr() Returns a pointer to the string value of capability id. In addition, if area is not a
NULL pointer,
tgetstr() places the capability in the buffer at area and advances
the area pointer. The returned string capability is compiled except for cursor address-
ing and padding information. tgetstr() is useful only with capabilities having
string values.
tgoto() Returns a cursor addressing string decoded from cm to go to column destcol in line
destline. (Programs that call
tgoto() should be sure to turn off the TAB3 bit or
bits, since
tgoto() can now output a tab. See termio(7)). Note that programs using
termcap should in general turn off TAB3 anyway since some terminals use Ctrl-I for
other functions, such as nondestructive space.) If a % sequence is given that is not
understood, tgoto() returns [OOPS].
tputs() Decodes the padding information of the string cp. affcnt gives the number of lines
affected by the operation, or 1 if this is not applicable. outc is a routine that is called
with each character in turn. The terminfo variable pad_char should contain a pad
character to be used (from the pc capability) if a null (ˆ@) is inappropriate.
WARNINGS
These routines are not meant to be used by programs running in the background.
Obsolescent Interfaces
tgetent(), tgetnum(), tgetflag() , tgetstr() , tgoto(), and tputs() are to be obsoleted
at a future date.
HP-UX 11i Version 1: September 2005 1 Hewlett-Packard Company Section 31007