The ncurses library relies on the terminfo database to look up the special character sequences it needs to output to a terminal. The terminfo database is the lower-level library upon which ncurses is built.
It is sometimes useful to check the terminfo database to see if it has information on a terminal, or to see which escape sequences need to be executed to perform these low level operations. This library provides two procedures to query this database.
When called with one string argument – a string with the name of a
terminal as it would appear in the terminfo database –
setupterm the terminfo database for the terminal with the given
name. When called with zero arguments, the name of terminal in the
TERM environment variable is used. If it is found, one of the symbols
hardcopy is returned. If the terminal is
not found in the terminfo database, #f is returned.
If the terminal is found, then the
tiget procedure can be used
to query terminfo capabilities for this terminal.
This procedure searches the terminfo database for the currently active terminal for information on capability, which is a short string that contains a terminfo capability, such as ‘am’ or ‘blink’.
If a capability by that name is found for the current terminal, an
integer, string, or boolean will be returned depending on the
capability. If a capability by that name is not found,
be returned. It is not possible to distinguish between capabilities
that are false, and capabilities that are not present.