+.SS Initialization
+.PP
+The \fBtgetent\fP routine loads the entry for \fIname\fP.
+It returns:
+.RS 3
+.TP 3
+1
+on success,
+.TP 3
+0
+if there is no such entry
+(or that it is a generic type, having too little information for curses
+applications to run), and
+.TP 3
+\-1
+if the terminfo database could not be found.
+.RE
+.PP
+This differs from the \fItermcap\fP library in two ways:
+.RS 3
+.bP
+The emulation ignores the buffer pointer \fIbp\fP.
+The \fItermcap\fP library would store a copy of the terminal
+description in the area referenced by this pointer.
+However, ncurses stores its terminal descriptions in compiled
+binary form, which is not the same thing.
+.bP
+There is a difference in return codes.
+The \fItermcap\fP library does not check if the terminal
+description is marked with the \fIgeneric\fP capability,
+or if the terminal description has cursor-addressing.
+.RE
+.SS Capability Values
+.PP
+The \fBtgetflag\fP routine gets the boolean entry for \fIid\fP,
+or zero if it is not available.
+.PP
+The \fBtgetnum\fP routine gets the numeric entry for \fIid\fP,
+or \-1 if it is not available.
+.PP
+The \fBtgetstr\fP routine returns the string entry for \fIid\fP,
+or zero if it is not available.
+Use \fBtputs\fP to output the returned string.
+The \fIarea\fP parameter is used as follows:
+.RS 3
+.bP
+It is assumed to be the address of a pointer to a buffer managed by the
+calling application.
+.bP
+However, ncurses checks to ensure that \fBarea\fP is not NULL,
+and also that the resulting buffer pointer is not NULL.
+If either check fails, the \fIarea\fP parameter is ignored.
+.bP
+If the checks succeed, ncurses also copies the return value to
+the buffer pointed to by \fIarea\fP,
+and the \fIarea\fP value will be updated to point past the null ending
+this value.
+.bP
+The return value itself is an address in the terminal description which
+is loaded into memory.
+.RE
+.PP
+Only the first two characters of the \fBid\fP parameter of
+\fBtgetflag\fP,
+\fBtgetnum\fP and
+\fBtgetstr\fP are compared in lookups.
+.SS Formatting Capabilities
+.PP
+The \fBtgoto\fP routine expands the given capability using the parameters.
+.bP
+Because the capability may have padding characters,
+the output of \fBtgoto\fP should be passed to \fBtputs\fP
+rather than some other output function such as \fBprintf\fP(3).
+.bP
+While \fBtgoto\fP is assumed to be used for the two-parameter
+cursor positioning capability,
+termcap applications also use it for single-parameter capabilities.
+.IP
+Doing this shows a quirk in \fBtgoto\fP: most hardware
+terminals use cursor addressing with \fIrow\fP first,
+but the original developers of the termcap interface chose to
+put the \fIcolumn\fP parameter first.
+The \fBtgoto\fP function swaps the order of parameters.
+It does this also for calls requiring only a single parameter.
+In that case, the first parameter is merely a placeholder.
+.bP
+Normally the ncurses library is compiled with terminfo support.
+In that case, \fBtgoto\fP uses \fBtparm\fP(3X) (a more capable formatter).
+.IP
+However, \fBtparm\fP is not a \fItermcap\fP feature,
+and portable \fItermcap\fP applications should not rely upon its availability.
+.PP
+The \fBtputs\fP routine is described on the \fBcurs_terminfo\fP(3X) manual
+page.
+It can retrieve capabilities by either termcap or terminfo name.
+.SS Global Variables
+.PP
+The variables
+\fBPC\fP,
+\fBUP\fP and
+\fBBC\fP
+are set by \fBtgetent\fP to the terminfo entry's data for
+\fBpad_char\fP,
+\fBcursor_up\fP and
+\fBbackspace_if_not_bs\fP,
+respectively.
+\fBUP\fP is not used by ncurses.
+\fBPC\fP is used in the \fBtdelay_output\fP function.
+\fBBC\fP is used in the \fBtgoto\fP emulation.
+The variable \fBospeed\fP is set by ncurses in a system-specific coding
+to reflect the terminal speed.
+.SS Releasing Memory
+The termcap functions provide no means for freeing memory,
+because legacy termcap implementations used only the buffer
+areas provided by the caller via \fBtgetent\fP and \fBtgetstr\fP.
+Those buffers are unused in terminfo.
+.PP
+On the other hand, terminfo allocates memory.
+It uses \fBsetupterm\fP to retrieve the data used by \fBtgetent\fP
+and the functions which return capability values such as \fBtgetstr\fP.
+One could use
+.sp
+ \fBdel_curterm(cur_term);\fP
+.sp
+.PP
+to free this memory, but there is an additional complication with ncurses.
+It uses a fixed-size \fIpool\fP of storage locations,
+one per setting of the \fBTERM\fP variable when \fBtgetent\fP is called.
+The \fBscreen\fP(1) program relies upon this arrangement,
+to improve its performance.
+.PP
+An application which uses only the low-level termcap functions could
+free the memory using \fBdel_curterm\fP,
+because the pool is freed using other functions
+(see \fBcurs_memleaks\fP(3X)).
+.