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
terminfo(4)).
They are emulation routines.
- tgetent()
Extracts the compiled entry for terminal
name
into buffers accessible by the programmer.
Unlike previous termcap routines,
all capability strings
(except cursor addressing 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 or if there is no capability file for
name,
and 0 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 file 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 addressing 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.
FILES
- /usr/lib/libcurses.a -lcurses
library
- /usr/share/lib/terminfo/?/*
data bases