tput(1) DG/UX 4.30 tput(1)
NAME
tput - query terminfo database
SYNOPSIS
tput [ -Ttype ] capname [ parameters... ]
tput -S [ -Ttype ]
DESCRIPTION
Tput uses the terminfo(4) database to make terminal-
dependent capabilities and information available to the
shell, to initialize or reset the terminal, or to return the
long name of the terminal. Tput outputs a string if the
attribute (capability name) is of type string, or an integer
if the attribute is of type integer. If the attribute is of
type boolean, tput sets the exit code (0 for TRUE if the
terminal has the capability, 1 for FALSE if it does not),
and produces no output. Before using a value returned on
standard output, you should test the exit code from tput to
make sure it is 0, indicating that the capability was found
and output correctly. (See the EXIT CODES and DIAGNOSTICS
sections.)
Options
-Ttype Find information for the terminal named type in the
terminfo(4) database. Normally this option is
unnecessary, because the default is taken from the
environment variable $TERM. If -T is specified,
then the environment variables $LINES and $COLUMNS
will not be used to override the defined size of
the terminal screen.
-S Allow more than one capability per invocation of
tput. The capabilities must be passed to tput from
the standard input instead of from the command
line. Only one capname is allowed per line (as
shown in the EXAMPLES section). The -S option
changes the meaning of the 0 and 1 boolean and
string exit codes (see the EXIT CODES section).
Arguments
capname Output the value of the attribute named capname
from the terminfo(4) database. See terminfo(4) for
a complete list of capabilities and the capname
associated with each. Special capability names
additionally recognized by tput are described in
the Special Capabilities section.
parameters
If the attribute is a string that takes parameters,
the arguments parameters will be instantiated into
the string. An all numeric argument will be passed
Licensed material--property of copyright holder(s) Page 1
tput(1) DG/UX 4.30 tput(1)
to the attribute as a number.
Special Capabilities
init If the terminfo(4) database is present and an entry
for the user's terminal exists (see -Ttype, above),
the following will occur: (1) if present, the
terminal's initialization strings will be output
(is1, is2, is3, if, iprog), (2) any delays (e.g.,
newline) specified in the entry will be set in the
tty driver, (3) tabs expansion will be turned on or
off according to the specification in the entry,
and (4) if tabs are not expanded, standard tabs
will be set (every 8 spaces). If an entry does not
contain the information needed for any of the four
above activities, that activity will silently be
skipped.
reset Instead of putting out initialization strings, the
terminal's reset strings, if present, will be
output (rs1, rs2, rs3, rf). If the reset strings
are not present, but initialization strings are,
the initialization strings will be output.
Otherwise, reset acts identically to init.
longname If the terminfo(4) database is present and an entry
for the user's terminal exists (see -Ttype above),
then the long name of the terminal will be put out.
The long name is the last name in the first line of
the terminal's description in the terminfo(4)
database (see term(5)).
EXAMPLES
$ tput init
This command initializes your terminal. It would normally
appear in your .profile or .login file (see profile(4)) to
set your terminal to a reasonable state for normal use.
$ tput clear
This command will echo the clear-screen sequence for your
terminal type.
$ tput -Tvt100 lines
This command will display the number of lines for a VT100
terminal.
$ tput hc
This form of the command will set the exit code to indicate
Licensed material--property of copyright holder(s) Page 2
tput(1) DG/UX 4.30 tput(1)
if the current terminal is a hardcopy terminal. This can be
useful if you are writing a shell script that must be
executed on a variety of terminal types.
$ tput -S <<!
> clear
> cup 10 10
> bold
> !
This example shows tput processing several capabilities in
one invocation. This example clears the screen; moves the
cursor to position 10, 10; and turns on bold (extra bright)
mode. The list is terminated by an exclamation mark (!) on
a line by itself.
FILES
/usr/lib/terminfo/?/* Compiled terminal description
database
/usr/include/term.h Terminfo(4) header file
/usr/lib/tabset/* Tab setting files for certain
terminals; for more information,
see the "Tabs and Initialization"
section of terminfo(4).
EXIT CODES
If capname is of type boolean, a value of 0 is set for TRUE
and 1 for FALSE unless the -S option is used.
If capname is of type string, a value of 0 is set if the
capname is defined for this terminal type (the value of
capname is returned on standard output); a value of 1 is set
if capname is not defined for this terminal type (a null
value is returned on standard output).
If capname is of type boolean or string and the -S option is
used, a value of 0 is returned to indicate that all lines
were successful. No indication of which line failed can be
given, so exit code 1 will never appear. Exit codes 2, 3,
and 4 retain their usual interpretation.
If capname is of type integer, a value of 0 is always set,
whether or not capname is defined for this terminal type.
To determine if capname is defined for this terminal type,
the user must test the value of standard output. A value of
-1 means that capname is not defined for this terminal type.
Any other exit code indicates an error; see DIAGNOSTICS,
below.
Licensed material--property of copyright holder(s) Page 3
tput(1) DG/UX 4.30 tput(1)
DIAGNOSTICS
tput prints the following error messages and sets the
corresponding exit codes.
exit
code error message
0 -1 (capname is a numeric variable that is not
specified in the terminfo(4) database for this terminal
type, e.g. tput -T450 lines and tput -T2621 xmc)
1 no error message is printed, see EXIT CODES,
above.
2 usage error
3 unknown terminal type or no terminfo(4)
database
4 unknown terminfo(4) capability capname
SEE ALSO
stty(1).
profile(4), terminfo(4), term(5) in the Programmer's
Reference for the DG/UX System.
Licensed material--property of copyright holder(s) Page 4