'\"macro stdmacro
.if n .pH g1.tput @(#)tput	40.7 of 1/8/90
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} tput 1 "Terminal Information Utilities" "\&"
.if \nX=1 .ds x} tput 1 "Terminal Information Utilities"
.if \nX=2 .ds x} tput 1 "" "\&"
.if \nX=3 .ds x} tput "" "" "\&"
.TH \*(x}
.SH NAME
\f4tput\f1 \- initialize a terminal or query terminfo database
.SH "SYNOPSIS"
\f4tput\f1 [\f4\-T\f2type\f1] \f2capname\f1 [\f2parms ... \f1]
.sp .5
\f4tput\f1
[\f4-T\f2type\f1]\f4 init\f1
.sp .5
\f4tput\f1
\f1[\f4-T\f2type\f1]\f4 reset\f1
.sp .5
\f4tput\f1
[\f4-T\f2type\f1]\f4 longname\f1
.sp .5
\f4tput-S  <<\f1
.SH "DESCRIPTION"
\f4tput\fP
uses the
\f4terminfo\fP
database to make the values of
terminal-dependent capabilities and information available to
the shell
(see \f4sh\fP(1)), to initialize or reset the terminal,
or return the long name of the requested terminal type.
\f4tput\fP
outputs a string if the attribute
.RI ( cap ability " name" )
is of type string, or an integer if the attribute is of type integer.
If the attribute is of type boolean, \f4tput\fP simply sets the exit code
(\f40\f1 for \s-1TRUE\s+1
if the terminal has the capability,
\f41\f1 for \s-1FALSE\s+1 if it does not),
and produces no output.
Before using a value returned on standard output,
the user should test the exit code [\f4$?\f1, see \f4sh\fP(1)]
to be sure it is \f40\f1.
(See the
.SM EXIT CODES
and
.SM DIAGNOSTICS
sections.)
For a complete list of capabilities and the
\f2capname\f1 associated with each, see \f4terminfo\fP(4).
.PP
.TP 11
\f4\-T\f2type\f1
indicates the \f2type\f1 of terminal.
Normally this option is unnecessary,
because the default is taken from the
environment variable
\f4TERM\f1.
If \f4-T\f1 is specified, then the shell variables
\f4LINES\f1 and \f4COLUMNS\f1
and the layer size [see \f4layers\fP(1)] will
not be referenced.
.TP
.I capname
indicates the attribute from the
\f4terminfo\fP
database.
.TP
.I parms
If the attribute is a string that takes parameters, the arguments
.I parms
will be instantiated into the string.
An all numeric argument will be passed to the attribute as a number.
.TP
\f4\-S\f1
allows more than one capability per invocation of \f4tput\f1.
The capabilities must be passed to \f4tput\f1 from the standard
input instead of from the command line (see example).
Only one \f2capname\f1 is allowed per line.
The \f4\-S\f1 option changes the meaning of the \f40\f1 and \f41\f1
boolean and string exit codes (see the
.SM EXIT CODES
section).
.TP
\f4init\f1
If the \f4terminfo\fP database is present
and an entry for the user's terminal
exists (see
\f4\-T\f2type,\f1
above), the following will occur:
(1) if present, the terminal's initialization
strings will be output
\f1(\f4is1\f1,
\f4is2\f1,
\f4is3\f1,
\f4if\f1,
\f4iprog\f1),
(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.
.TP
\f4reset\f1
Instead of putting out initialization strings,
the terminal's reset strings will be output
if present
\f1(\f4rs1\f1,
\f4rs2\f1,
\f4rs3\f1,
\f4rf\f1).
If the reset strings are not present,
but initialization strings are, the initialization
strings will be output.
Otherwise, \f4reset\f1 acts identically to \f4init\f1.
.br
.ne 10
.TP
\f4longname\f1
If the
\f4terminfo\fP
database is present and an entry for the user's
terminal exists
(see
\f4\-T\f2type\f1
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
\f4terminfo\fP
database
[see \f4term\fP(5)].
.PP
.SH EXAMPLES
.TP 18
\f4tput init\f1
Initialize the terminal according to the
type of terminal in the environmental variable
\f4TERM\f1.
This command should be included in everyone's
\&.profile after the environmental variable \f4TERM\f1
has been exported, as illustrated on the \f4profile\fP(4)
manual page.
.TP
\f4tput \-T5620 reset\f1
Reset an AT&T 5620 terminal,
overriding the type of terminal in
the environmental variable
\f4TERM\f1.
.TP
\f4tput cup 0 0\f1
Send the sequence to move the cursor to row \f40\f1,
column \f40\f1 (the upper left corner of the screen,
usually known as the "home" cursor position).
.TP
\f4tput clear\f1
Echo the clear-screen sequence for the current terminal.
.TP
\f4tput cols\f1
Print the number of columns for the current terminal.
.TP
\f4tput -T450 cols\f1
Print the number of columns for the 450 terminal.
.TP
\f4bold=\f4`\fPtput smso\f4`\fP\f1
.TP
\f4offbold=\f4`\fPtput rmso\f4`\fP\f1
Set the shell variables \f4bold\f1,
to begin stand-out mode sequence,
and \f4offbold\f1, to end standout mode sequence,
for the current terminal.
This might be followed by a prompt:
.sp 0
\f4echo "${bold}Please type in your name: ${offbold}\\c"\f1
.TP
\f4tput hc\f1
Set exit code to indicate if the current terminal is a hardcopy terminal.
.TP
\f4tput cup 23 4\f1
Send the sequence to move the cursor to row 23, column 4.
.TP
\f4tput longname\f1
Print the long name from the
\f4terminfo\fP
database for the type of terminal
specified in the environmental variable
\f4TERM\f1.
.PD 0
.TP
\f4tput -S <<!\f1
.TP
\f4> clear\f1
.TP
\f4> cup 10 10\f1
.TP
\f4> bold\f1
.TP
\f4> !\f1
.sp -5
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 (\f4!\f1)
on a line by itself.
.PD
.br
.ne 1.5i
.SH FILES
.PD 0
.TP 25
\f4/usr/share/lib/terminfo/?/\(**\f1
compiled terminal description database
.TP 25
\f4/usr/include/curses.h\f1
\f4curses\fP(3X) header file
.TP 25
\f4/usr/include/term.h\f1
\f4terminfo\fP header file
.TP 25
\f4/usr/lib/tabset/\(**\f1
tab settings for some 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
\f4terminfo\fP(4)
.PD
.SH "SEE ALSO"
\f4clear\fP(1),
\f4stty\fP(1),
\f4tabs\fP(1).
.br
\f4profile\fP(4), \f4terminfo\fP(4)
in the
\f2System Administrator's Reference Manual\f1.
.br
Chapter 10 of the
.I
Programmer's Guide.
.SH EXIT CODES
If \f2capname\f1 is of type boolean,
a value of \f40\f1 is set for
\s-1TRUE\s0 and \f41\f1 for \s-1FALSE\s0
unless the \f4\-S\f1 option is used.
.PP
If \f2capname\f1 is of type string,
a value of \f40\f1 is set if the
.I capname
is defined for this terminal
.I type
(the value of
.I capname
is returned on standard output);
a value of
\f41\f1
is set if
.I capname
is not defined for this terminal
.I type
(a null value is returned on standard output).
.PP
If \f2capname\f1 is of type boolean or string and the \f4\-S\f1
option is used,
a value of \f40\f1 is returned to indicate
that all lines were successful.
No indication of which line failed can be given so exit code \f41\f1
will never appear.
Exit codes \f42\f1, \f43\f1, and \f44\f1 retain their usual interpretation.
.PP
If
.I capname
is of type integer,
a value of
\f40\f1
is always set,
whether or not
.I capname
is defined for this terminal
.IR type .
To determine if
.I capname
is defined for this terminal
.IR type ,
the user must test the value of standard output.
A value of
\f4\-1\f1
means that
.I capname
is not defined for this terminal
.IR type .
.P
Any other exit code indicates an error;
see the
.SM DIAGNOSTICS
section.
.SH DIAGNOSTICS
\f4tput\fP
prints the following error messages and
sets the corresponding exit codes.
.in +3
.ta .5i
.nf
exit
code	\0\0\0\0\0\0\0\0\0\0\0\0error message
.sp
\0\f40\f1	\-1  (\f2capname\f1 is a numeric variable that is not specified in the
	\f4terminfo\fP(4) database for this terminal type, e.g.
	\f4tput \-T450 lines\f1 and \f4tput \-T2621 xmc\f1)
\0\f41\f1	no error message is printed, see the \f3\s-1EXIT CODES\s0\f1 section.
\0\f42\f1	usage error
\0\f43\f1	unknown terminal \f2type\f1 or no \f4terminfo\fP database
\0\f44\f1	unknown \f4terminfo\fP capability \f2capname\f1
.in -3
.Ee
