[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 2

tigetflag, tigetnum, tigetstr, or tparm Subroutine

Purpose

Retrieves capabilities from the terminfo database.

Library

Curses Library (libcurses.a)

Syntax

#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);

Description

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.

Return Values

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.

Parameters

*capname  
*tparm  
long p1  
long p2  
long p3  
long p4  
long p5  
long p6  
long p7  
long p8  
long p9  

Examples

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:

  1. To save the escape sequence used to home the cursor in the user-defined variable home_sequence, enter:

    home_sequence = tparm(cursor_home);
  2. To save the escape sequence used to move the cursor to the coordinates X=40, Y=18 in the user-defined variable move_sequence, enter:

    move_sequence = tparm(cursor_address, 18, 40);

Related Information

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.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]