Retrieves capabilities from the terminfo database.
Curses Library (libcurses.a)
#include <term.h> int tigetflag(char *capname,); int tigetnum(char *capname); char *tigetstr(char *capname); char *tparm(char *cap, long p1, long p2, long p3, long p4, long p5, long p6 long p7, long p8, long p9);
The tigetflag, tigetnum, and tigetstr subroutines obtain boolean, numeric, and string capabilities, respectively, from the selected record of the terminfo database. For each capability, the value to use as capname appears in the Capname column in the table in Section 6.1.3 on page 296.
The tparm subroutine takes as cap a string capability. If cap is parameterised (as described in Section A.1.2 on page 313), the tparm subroutine resolves the parameterisation. If the parameterised string refers to parameters %p1 through %p9, then the tparm subroutine substitutes the values of p1 through p9, respectively.
Upon successful completion, the tigetflag, tigetnum, and tigetstr subroutines return the specified capability. The tigetflag subroutine returns -1 if capname is not a boolean capability. The tigetnum subroutine returns -2 if capname is not a numeric capability. The tigetstr subroutine returns (char*)-1 if capname is not a string capability.
Upon successful completion, the tparm subroutine returns str with parameterisation resolved. Otherwise, it returns a null pointer.
*capname | |
*tparm | |
long p1 | |
long p2 | |
long p3 | |
long p4 | |
long p5 | |
long p6 | |
long p7 | |
long p8 | |
long p9 |
For the tigetflag subroutine:
To determine if erase overstrike is a defined boolean capability for the current terminal, use:
rc = tigetflag("eo");
For the tigetnum subroutine:
To determine if number of labels is a defined numeric capability for the current terminal, use:
rc = tigetnum("nlab");
For the tigetstr subroutine:
To determine if "turn on soft labels" is a defined string capability for the current terminal, do the following:
char *rc; rc = tigetstr("smln");
For the tparm subroutine:
home_sequence = tparm(cursor_home);
move_sequence = tparm(cursor_address, 18, 40);
The def_prog_mode (def_prog_mode, def_shell_mode, reset_prog_mode or reset_shell_mode Subroutine), tgetent (tgetent, tgetflag, tgetnum, tgetstr, or tgoto Subroutine), and putp (putp, tputs Subroutine) subroutines.
Curses Overview for Programming, List of Curses Subroutines
Understanding Terminals with Curses in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.