.TH tgetent() "" "" "termcap Function (libterm)"
.PC "Read termcap entry"
.B "#include <curses.h>"
.B "#include <term.h>"
\fBint tgetent(\fIbp, name\^\fB)\fR
\fBchar *\fIbp, *name\^\fB;\fR
.PP
.B tgetent()
is one of a set of functions that read a
.B termcap
terminal description.
It extracts the entry from file
.B /etc/termcap
for the terminal
.I name
and writes it into a buffer at address
.IR bp .
.I bp
should be a character buffer of 1,024 bytes and must be retained through
all subsequent calls to the other functions.
It
returns
.B \-1
if it cannot open
.BR /etc/termcap ,
zero if the terminal name given does not have an entry, and one
upon a successful search.
.PP
.B tgetent()
first looks in the environment to see if the
.B termcap
variable had already been set.
If it finds that the variable
.B termcap
has been set, that the value does \fInot\fR begin with a slash,
and that the terminal type name in the \fBtermcap\fR variable
is the same as that in the environment variable
.BR TERM ,
then \fBtgetent()\fR uses the
.B termcap
string instead of reading the file
.BR /etc/termcap .
However, if the
.B termcap
string does begin with a slash, then it is used as the path name
of a terminal-capabilities file other than
.B /etc/termcap.
This can speed entry into programs that call
.BR tgetent() ,
and can be used to help debug new terminal descriptions.
.SH Files
.nf
\fB/etc/termcap\fR \(em Terminal capabilities data base
\fB/usr/lib/libterm.a\fR \(em Function library
.fi
.SH "See Also"
.Xr "termcap" termcap
