tput(1) DG/UX R4.11MU05 tput(1)
NAME
tput - initialize a terminal or query terminfo database
SYNOPSIS
tput [ -Ttype ] capname [ parameter ... ]
tput [ -Ttype ] init
tput [ -Ttype ] reset
tput [ -Ttype ] longname
tput [ -Ttype ] -S
where:
capname The attribute from the terminfo database.
parameters An argument to be instantiated into the string.
DESCRIPTION
tput uses the terminfo(4) database to make the values of terminal-
dependent capabilities and information available to users, to
initialize or reset the terminal, or to return the long name of the
requested terminal type. If the attribute (capability name) is of
type string, tput outputs the string value of the attribute. If the
attribute is of type integer, tput outputs a string representation of
the integer value of the attribute. If the attribute is of type
boolean, tput simply 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, shell
scripts should test the exit code to be sure it is 0. (See the EXIT
CODES section.)
If capname represents a string that takes parameters, the arguments
parameters will be instantiated into the string. An all numeric
argument will be passed to the attribute as a number. For a complete
list of capabilities and the capname associated with each, see
terminfo(4).
Options are:
-T type 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 and the dimensions
stored in the line discipline (see stty(1)) 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 (see the EXAMPLES
section). Only one capname is allowed per line. The -S
option changes the meaning of the 0 and 1 boolean and
string exit codes (see the EXIT CODES section).
Special Capabilities
init If the terminfo database is present and an entry for the
user's terminal exists (see -T type, 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) tab 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 will be output if present (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 -T type 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
Initialize your terminal for normal use, according to the terminal
type given by the environment variable TERM. This command would
normally appear in your .profile or .login after the environment
variable TERM has been exported (see profile(4)).
tput -T vt100 reset
Reset a VT100 terminal, overriding the type of terminal given by the
environment variable TERM.
tput cup 0 0
Send the sequence to move the cursor to row 0, column 0 (the upper
left corner of the screen, usually known as the "home" cursor
position).
tput clear
Echo the clear-screen sequence for your type of terminal.
tput cols
Print the number of columns for your type of terminal.
tput -T D462-unix cols
Print the number of columns for a Data General D462+ terminal.
bold=`tput smso`
offbold=`tput rmso`
Set the shell variables bold and offbold to the sequences to begin
and end stand-out mode (respectively) for the current terminal.
These variables could be used in a shell script to highlight a
prompt:
echo "${bold}Please type in your name: ${offbold}\c"
tput hc
Set the exit code to indicate if the current terminal is a hardcopy
terminal.
tput cup 23 4
Send a sequence to move the cursor to row 23, column 4.
tput longname
Print the long name from the terminfo database for the type of
terminal specified by the environment variable TERM.
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/share/lib/terminfo/?/*
Compiled terminal description database.
/usr/include/curses.h
curses(3X) header file.
/usr/include/term.h
terminfo(4) header file.
/usr/share/lib/tabset/*
Tab setting files for certain terminals, in a format
appropriate to be output to the terminal (escape sequences
that set margins and tabs). For more information, see the
"Tabs and Initialization" section of terminfo(4).
EXIT CODES
0 capname is of type boolean, and the capname is TRUE for this
terminal type.
0 capname is of type integer; an exit status of 0 is always
returned, whether or not capname is defined for this terminal
type. The user must check standard output to determine if
capname is defined. The message -1 means that capname is not
specified in the terminfo(4) database for this terminal type
(e.g., tput -T450 lines and tput -T2621 xmc).
0 capname is of type string, and the capname is defined for this
terminal type.
1 capname is of type boolean, and the capname is FALSE for this
terminal type. (See -S Option below.)
1 capname is of type string, and capname is not defined for this
terminal type. (See -S Option below.)
2 The command line contains invalid syntax, or some other usage
error was found.
3 Terminal type is unknown, or the terminfo(4) database is
inaccessible.
4 capname is not a valid terminfo(4) capability.
-S Option
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.
SEE ALSO
clear(1), stty(1), tabs(1), curses(3X), profile(4), terminfo(4),
term(5)
Licensed material--property of copyright holder(s)