766 lines
24 KiB
HTML
766 lines
24 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of tput</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>tput</H1>
|
|
Section: User Commands (1)<BR>Updated: <BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
<B>tput</B>, <B>reset</B> - initialize a terminal or query terminfo database
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>tput</B> [<B>-T</B><I>type</I>] <I>capname</I> [<I>parameters</I>]
|
|
<BR>
|
|
|
|
<B>tput</B> [<B>-T</B><I>type</I>] [<B>-x</B>] <B>clear</B>
|
|
<BR>
|
|
|
|
<B>tput</B> [<B>-T</B><I>type</I>] <B>init</B>
|
|
<BR>
|
|
|
|
<B>tput</B> [<B>-T</B><I>type</I>] <B>reset</B>
|
|
<BR>
|
|
|
|
<B>tput</B> [<B>-T</B><I>type</I>] <B>longname</B>
|
|
<BR>
|
|
|
|
<B>tput -S</B> <B><<</B>
|
|
<BR>
|
|
|
|
<B>tput -V</B>
|
|
<BR>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
The <B>tput</B> utility uses the <B>terminfo</B> database to make the
|
|
values of terminal-dependent capabilities and information available to
|
|
the shell (see <B><A HREF="/cgi-bin/man/man2html?1+sh">sh</A></B>(1)), to initialize or reset the terminal, or
|
|
return the long name of the requested terminal type.
|
|
The result depends upon the capability's type:
|
|
<DL COMPACT><DT id="1"><DD>
|
|
<DL COMPACT>
|
|
<DT id="2">string<DD>
|
|
<B>tput</B> writes the string to the standard output.
|
|
No trailing newline is supplied.
|
|
<DT id="3">integer<DD>
|
|
<B>tput</B> writes the decimal value to the standard output,
|
|
with a trailing newline.
|
|
<DT id="4">boolean<DD>
|
|
<B>tput</B> simply sets the exit code
|
|
(<B>0</B> for TRUE if the terminal has the capability,
|
|
<B>1</B> for FALSE if it does not),
|
|
and writes nothing to the standard output.
|
|
</DL>
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Before using a value returned on the standard output,
|
|
the application should test the exit code
|
|
(e.g., <B>$?</B>, see <B><A HREF="/cgi-bin/man/man2html?1+sh">sh</A></B>(1)) to be sure it is <B>0</B>.
|
|
(See the <B>EXIT CODES</B> and <B>DIAGNOSTICS</B> sections.)
|
|
For a complete list of capabilities
|
|
and the <I>capname</I> associated with each, see <B><A HREF="/cgi-bin/man/man2html?5+terminfo">terminfo</A></B>(5).
|
|
<A NAME="lbAE"> </A>
|
|
<H3>Options</H3>
|
|
|
|
<DL COMPACT>
|
|
<DT id="5"><B>-S</B><DD>
|
|
allows more than one capability per invocation of <B>tput</B>. The
|
|
capabilities must be passed to <B>tput</B> from the standard input
|
|
instead of from the command line (see example).
|
|
Only one <I>capname</I> is allowed per line.
|
|
The <B>-S</B> option changes the
|
|
meaning of the <B>0</B> and <B>1</B> boolean and string exit codes (see the
|
|
EXIT CODES section).
|
|
<DT id="6"><DD>
|
|
Because some capabilities may use
|
|
<I>string</I> parameters rather than <I>numbers</I>,
|
|
<B>tput</B> uses a table and the presence of parameters in its input
|
|
to decide whether to use <B><A HREF="/cgi-bin/man/man2html?3X+tparm">tparm</A></B>(3X),
|
|
and how to interpret the parameters.
|
|
<DT id="7"><B>-T</B><I>type</I><DD>
|
|
indicates the <I>type</I> of terminal.
|
|
Normally this option is
|
|
unnecessary, because the default is taken from the environment
|
|
variable <B>TERM</B>.
|
|
If <B>-T</B> is specified, then the shell
|
|
variables <B>LINES</B> and <B>COLUMNS</B> will also be ignored.
|
|
<DT id="8"><B>-V</B><DD>
|
|
reports the version of ncurses which was used in this program, and exits.
|
|
<DT id="9"><B>-x</B>
|
|
|
|
<DD>
|
|
do not attempt to clear the terminal's scrollback buffer
|
|
using the extended ``E3'' capability.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Commands</H3>
|
|
|
|
A few commands (<B>init</B>, <B>reset</B> and <B>longname</B>) are
|
|
special; they are defined by the <B>tput</B> program.
|
|
The others are the names of <I>capabilities</I> from the terminal database
|
|
(see <B><A HREF="/cgi-bin/man/man2html?5+terminfo">terminfo</A></B>(5) for a list).
|
|
Although <B>init</B> and <B>reset</B> resemble capability names,
|
|
<B>tput</B> uses several capabilities to perform these special functions.
|
|
<DL COMPACT>
|
|
<DT id="10"><I>capname</I><DD>
|
|
indicates the capability from the terminal database.
|
|
<DT id="11"><DD>
|
|
If the capability is a string that takes parameters, the arguments
|
|
following the capability will be used as parameters for the string.
|
|
<DT id="12"><DD>
|
|
Most parameters are numbers.
|
|
Only a few terminal capabilities require string parameters;
|
|
<B>tput</B> uses a table to decide which to pass as strings.
|
|
Normally <B>tput</B> uses <B><A HREF="/cgi-bin/man/man2html?3X+tparm">tparm</A></B>(3X) to perform the substitution.
|
|
If no parameters are given for the capability,
|
|
<B>tput</B> writes the string without performing the substitution.
|
|
<DT id="13"><B>init</B><DD>
|
|
If the terminal database is present and an entry for the user's
|
|
terminal exists (see <B>-T</B><I>type</I>, above), the following will
|
|
occur:
|
|
<DL COMPACT><DT id="14"><DD>
|
|
<DL COMPACT>
|
|
<DT id="15">(1)<DD>
|
|
first, <B>tput</B> retrieves the current terminal mode settings
|
|
for your terminal.
|
|
It does this by successively testing
|
|
<DL COMPACT><DT id="16"><DD>
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
the standard error,
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
standard output,
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
standard input and
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
ultimately ``/dev/tty''
|
|
</DL>
|
|
|
|
<DT id="17"><DD>
|
|
to obtain terminal settings.
|
|
Having retrieved these settings, <B>tput</B> remembers which
|
|
file descriptor to use when updating settings.
|
|
<DT id="18">(2)<DD>
|
|
if the window size cannot be obtained from the operating system,
|
|
but the terminal description (or environment, e.g., <B>LINES</B>
|
|
and <B>COLUMNS</B> variables specify this),
|
|
update the operating system's notion of the window size.
|
|
<DT id="19">(3)<DD>
|
|
the terminal modes will be updated:
|
|
<DL COMPACT><DT id="20"><DD>
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
any delays (e.g., newline) specified in the entry will
|
|
be set in the tty driver,
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
tabs expansion will be turned on or off according to
|
|
the specification in the entry, and
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
if tabs are not expanded,
|
|
standard tabs will be set (every 8 spaces).
|
|
</DL>
|
|
|
|
<DT id="21">(4)<DD>
|
|
if present, the terminal's initialization strings will be
|
|
output as detailed in the <B><A HREF="/cgi-bin/man/man2html?5+terminfo">terminfo</A></B>(5) section on
|
|
<I>Tabs and Initialization</I>,
|
|
|
|
<DT id="22">(5)<DD>
|
|
output is flushed.
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="23"><DD>
|
|
If an entry does not
|
|
contain the information needed for any of these activities,
|
|
that activity will silently be skipped.
|
|
<DT id="24"><B>reset</B><DD>
|
|
This is similar to <B>init</B>, with two differences:
|
|
<DL COMPACT><DT id="25"><DD>
|
|
<DL COMPACT>
|
|
<DT id="26">(1)<DD>
|
|
before any other initialization,
|
|
the terminal modes will be reset to a ``sane'' state:
|
|
<DL COMPACT><DT id="27"><DD>
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
set cooked and echo modes,
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
turn off cbreak and raw modes,
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
turn on newline translation and
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
reset any unset special characters to their default values
|
|
</DL>
|
|
|
|
<DT id="28">(2)<DD>
|
|
Instead of putting out <I>initialization</I> strings, the terminal's
|
|
<I>reset</I> strings will be output if present
|
|
(<B>rs1</B>, <B>rs2</B>, <B>rs3</B>, <B>rf</B>).
|
|
If the <I>reset</I> strings are not present, but <I>initialization</I>
|
|
strings are, the <I>initialization</I> strings will be output.
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="29"><DD>
|
|
Otherwise, <B>reset</B> acts identically to <B>init</B>.
|
|
<DT id="30"><B>longname</B><DD>
|
|
If the terminal database is present and an entry for the
|
|
user's terminal exists (see <B>-T</B><I>type</I> 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
|
|
<B>terminfo</B> database [see <B><A HREF="/cgi-bin/man/man2html?5+term">term</A></B>(5)].
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Aliases</H3>
|
|
|
|
<B>tput</B> handles the <B>clear</B>, <B>init</B> and <B>reset</B>
|
|
commands specially:
|
|
it allows for the possibility that it is invoked by a link with those names.
|
|
<P>
|
|
|
|
If <B>tput</B> is invoked by a link named <B>reset</B>, this has the
|
|
same effect as <B>tput reset</B>.
|
|
The <B><A HREF="/cgi-bin/man/man2html?1+tset">tset</A></B>(1) utility also treats a link named <B>reset</B> specially.
|
|
<P>
|
|
|
|
Before ncurses 6.1, the two utilities were different from each other:
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
<B>tset</B> utility reset the terminal modes and special characters
|
|
(not done with <B>tput</B>).
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
On the other hand, <B>tset</B>'s repertoire of terminal capabilities for
|
|
resetting the terminal was more limited,
|
|
i.e., only <B>reset_1string</B>, <B>reset_2string</B> and <B>reset_file</B>
|
|
in contrast to the tab-stops and margins which are set by this utility.
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
The <B>reset</B> program is usually an alias for <B>tset</B>,
|
|
because of this difference with resetting terminal modes and special characters.
|
|
<P>
|
|
|
|
With the changes made for ncurses 6.1, the <I>reset</I> feature of the
|
|
two programs is (mostly) the same.
|
|
A few differences remain:
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
The <B>tset</B> program waits one second when resetting,
|
|
in case it happens to be a hardware terminal.
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
The two programs write the terminal initialization strings
|
|
to different streams (i.e., the standard error for <B>tset</B> and the
|
|
standard output for <B>tput</B>).
|
|
<DL COMPACT>
|
|
<DT id="31"><DD>
|
|
<B>Note:</B> although these programs write to different streams,
|
|
redirecting their output to a file will capture only part of their actions.
|
|
The changes to the terminal modes are not affected by redirecting the output.
|
|
</DL>
|
|
<P>
|
|
|
|
If <B>tput</B> is invoked by a link named <B>init</B>, this has the
|
|
same effect as <B>tput init</B>.
|
|
Again, you are less likely to use that link because another program
|
|
named <B>init</B> has a more well-established use.
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Terminal Size</H3>
|
|
|
|
<P>
|
|
|
|
Besides the special commands (e.g., <B>clear</B>),
|
|
tput treats certain terminfo capabilities specially:
|
|
<B>lines</B> and <B>columns</B>.
|
|
tput calls <B><A HREF="/cgi-bin/man/man2html?3X+setupterm">setupterm</A></B>(3X) to obtain the terminal size:
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
first, it gets the size from the terminal database
|
|
(which generally is not provided for terminal emulators
|
|
which do not have a fixed window size)
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
then it asks the operating system for the terminal's size
|
|
(which generally works, unless connecting via a serial line which
|
|
does not support <I>NAWS</I>: negotiations about window size).
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
finally, it inspects the environment variables <B>LINES</B> and <B>COLUMNS</B>
|
|
which may override the terminal size.
|
|
<P>
|
|
|
|
If the <B>-T</B> option is given
|
|
tput ignores the environment variables by calling <B>use_tioctl(TRUE)</B>,
|
|
relying upon the operating system (or finally, the terminal database).
|
|
<A NAME="lbAI"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="32"><B>tput init</B><DD>
|
|
Initialize the terminal according to the type of
|
|
terminal in the environmental variable <B>TERM</B>. This
|
|
command should be included in everyone's .profile after
|
|
the environmental variable <B>TERM</B> has been exported, as
|
|
illustrated on the <B><A HREF="/cgi-bin/man/man2html?5+profile">profile</A></B>(5) manual page.
|
|
<DT id="33"><B>tput -T5620 reset</B><DD>
|
|
Reset an AT&T 5620 terminal, overriding the type of
|
|
terminal in the environmental variable <B>TERM</B>.
|
|
<DT id="34"><B>tput cup 0 0</B><DD>
|
|
Send the sequence to move the cursor to row <B>0</B>, column <B>0</B>
|
|
(the upper left corner of the screen, usually known as the ``home''
|
|
cursor position).
|
|
<DT id="35"><B>tput clear</B><DD>
|
|
Echo the clear-screen sequence for the current terminal.
|
|
<DT id="36"><B>tput cols</B><DD>
|
|
Print the number of columns for the current terminal.
|
|
<DT id="37"><B>tput -T450 cols</B><DD>
|
|
Print the number of columns for the 450 terminal.
|
|
<DT id="38"><B>bold=`tput smso` offbold=`tput rmso`</B><DD>
|
|
Set the shell variables <B>bold</B>, to begin stand-out mode
|
|
sequence, and <B>offbold</B>, to end standout mode sequence,
|
|
for the current terminal.
|
|
This might be followed by a
|
|
prompt: <B>echo "${bold}Please type in your name: ${offbold}\c"</B>
|
|
<DT id="39"><B>tput hc</B><DD>
|
|
Set exit code to indicate if the current terminal is a hard copy terminal.
|
|
<DT id="40"><B>tput cup 23 4</B><DD>
|
|
Send the sequence to move the cursor to row 23, column 4.
|
|
<DT id="41"><B>tput cup</B><DD>
|
|
Send the terminfo string for cursor-movement, with no parameters substituted.
|
|
<DT id="42"><B>tput longname</B><DD>
|
|
Print the long name from the <B>terminfo</B> database for the
|
|
type of terminal specified in the environmental
|
|
variable <B>TERM</B>.
|
|
</DL>
|
|
<P>
|
|
|
|
<DL COMPACT><DT id="43"><DD>
|
|
<B>tput -S <<!</B>
|
|
<BR>
|
|
|
|
<B>> clear</B>
|
|
<BR>
|
|
|
|
<B>> cup 10 10</B>
|
|
<BR>
|
|
|
|
<B>> bold</B>
|
|
<BR>
|
|
|
|
<B>> !</B>
|
|
</DL>
|
|
|
|
<DL COMPACT>
|
|
<DT id="44"><DD>
|
|
This example shows <B>tput</B> processing several capabilities
|
|
in one invocation.
|
|
It 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 (<B>!</B>) on a line by itself.
|
|
</DL>
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>FILES</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="45"><B>/etc/terminfo</B><DD>
|
|
compiled terminal description database
|
|
<DT id="46"><B>/usr/share/tabset/*</B><DD>
|
|
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
|
|
<I>Tabs and Initialization</I>,
|
|
|
|
section of <B><A HREF="/cgi-bin/man/man2html?5+terminfo">terminfo</A></B>(5)
|
|
</DL>
|
|
<A NAME="lbAK"> </A>
|
|
<H2>EXIT CODES</H2>
|
|
|
|
If the <B>-S</B> option is used,
|
|
<B>tput</B> checks for errors from each line,
|
|
and if any errors are found, will set the exit code to 4 plus the
|
|
number of lines with errors.
|
|
If no errors are found, the exit code is <B>0</B>.
|
|
No indication of which line failed can be given so
|
|
exit code <B>1</B> will never appear.
|
|
Exit codes <B>2</B>, <B>3</B>, and
|
|
<B>4</B> retain their usual interpretation.
|
|
If the <B>-S</B> option is not used,
|
|
the exit code depends on the type of <I>capname</I>:
|
|
<DL COMPACT><DT id="47"><DD>
|
|
<DL COMPACT>
|
|
<DT id="48"><I>boolean</I>
|
|
|
|
<DD>
|
|
a value of <B>0</B> is set for TRUE and <B>1</B> for FALSE.
|
|
<DT id="49"><I>string</I>
|
|
|
|
<DD>
|
|
a value of <B>0</B> is set if the
|
|
<I>capname</I> is defined for this terminal <I>type</I> (the value of
|
|
<I>capname</I> is returned on standard output);
|
|
a value of <B>1</B> is set if <I>capname</I>
|
|
is not defined for this terminal <I>type</I>
|
|
(nothing is written to standard output).
|
|
<DT id="50"><I>integer</I>
|
|
|
|
<DD>
|
|
a value of <B>0</B> is always set,
|
|
whether or not <I>capname</I> is defined for this terminal <I>type</I>.
|
|
To determine if <I>capname</I> is defined for this terminal <I>type</I>,
|
|
the user must test the value written to standard output.
|
|
A value of <B>-1</B>
|
|
means that <I>capname</I> is not defined for this terminal <I>type</I>.
|
|
<DT id="51"><I>other</I>
|
|
|
|
<DD>
|
|
<B>reset</B> or <B>init</B> may fail to find their respective files.
|
|
In that case, the exit code is set to 4 + <B>errno</B>.
|
|
</DL>
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Any other exit code indicates an error; see the DIAGNOSTICS section.
|
|
<A NAME="lbAL"> </A>
|
|
<H2>DIAGNOSTICS</H2>
|
|
|
|
<B>tput</B> prints the following error messages and sets the corresponding exit
|
|
codes.
|
|
<P>
|
|
|
|
|
|
<TABLE>
|
|
<TR VALIGN=top><TD>exit code</TD><TD>error message<BR></TD></TR>
|
|
<TR VALIGN=top><TD COLSPAN=2><HR><HR></TD></TR>
|
|
<TR VALIGN=top><TD><B>0</B></TD><TD>
|
|
(<I>capname</I> is a numeric variable that is not specified in the
|
|
<B><A HREF="/cgi-bin/man/man2html?5+terminfo">terminfo</A></B>(5) database for this terminal type, e.g.
|
|
<B>tput -T450 lines</B> and <B>tput -T2621 xmc</B>)
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>1</B></TD><TD>no error message is printed, see the <B>EXIT CODES</B> section.<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>2</B></TD><TD>usage error<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>3</B></TD><TD>unknown terminal <I>type</I> or no <B>terminfo</B> database<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>4</B></TD><TD>unknown <B>terminfo</B> capability <I>capname</I><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>>4</B></TD><TD>error occurred in -S<BR></TD></TR>
|
|
<TR VALIGN=top><TD COLSPAN=2><HR><HR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAM"> </A>
|
|
<H2>HISTORY</H2>
|
|
|
|
The <B>tput</B> command was begun by Bill Joy in 1980.
|
|
The initial version only cleared the screen.
|
|
<P>
|
|
|
|
AT&T System V provided a different <B>tput</B> command,
|
|
whose <B>init</B> and <B>reset</B> subcommands
|
|
(more than half the program) were incorporated from
|
|
the <B>reset</B> feature of BSD <B>tset</B> written by Eric Allman.
|
|
<P>
|
|
|
|
Keith Bostic replaced the BSD <B>tput</B> command in 1989
|
|
with a new implementation
|
|
based on the AT&T System V program <B>tput</B>.
|
|
Like the AT&T program, Bostic's version
|
|
accepted some parameters named for <I>terminfo capabilities</I>
|
|
(<B>clear</B>, <B>init</B>, <B>longname</B> and <B>reset</B>).
|
|
However (because he had only termcap available),
|
|
it accepted <I>termcap names</I> for other capabilities.
|
|
Also, Bostic's BSD <B>tput</B> did not modify the terminal I/O modes
|
|
as the earlier BSD <B>tset</B> had done.
|
|
<P>
|
|
|
|
At the same time, Bostic added a shell script named ``clear'',
|
|
which used <B>tput</B> to clear the screen.
|
|
<P>
|
|
|
|
Both of these appeared in 4.4BSD,
|
|
becoming the ``modern'' BSD implementation of <B>tput</B>.
|
|
<P>
|
|
|
|
This implementation of <B>tput</B> began from a different source than
|
|
AT&T or BSD: Ross Ridge's <I>mytinfo</I> package, published on
|
|
<I>comp.sources.unix</I> in December 1992.
|
|
Ridge's program made more sophisticated use of the terminal capabilities
|
|
than the BSD program.
|
|
Eric Raymond used that <B>tput</B> program
|
|
(and other parts of <I>mytinfo</I>) in ncurses in June 1995.
|
|
Using the portions dealing with terminal capabilities
|
|
almost without change,
|
|
Raymond made improvements to the way the command-line parameters
|
|
were handled.
|
|
<A NAME="lbAN"> </A>
|
|
<H2>PORTABILITY</H2>
|
|
|
|
<P>
|
|
|
|
This implementation of <B>tput</B> differs from AT&T <B>tput</B> in
|
|
two important areas:
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
<B>tput</B> <I>capname</I> writes to the standard output.
|
|
That need not be a regular terminal.
|
|
However, the subcommands which manipulate terminal modes
|
|
may not use the standard output.
|
|
<DL COMPACT>
|
|
<DT id="52"><DD>
|
|
The AT&T implementation's <B>init</B> and <B>reset</B> commands
|
|
use the BSD (4.1c) <B>tset</B> source, which manipulates terminal modes.
|
|
It successively tries standard output, standard error, standard input
|
|
before falling back to ``/dev/tty'' and finally just assumes
|
|
a 1200Bd terminal.
|
|
When updating terminal modes, it ignores errors.
|
|
<DT id="53"><DD>
|
|
Until changes made after ncurses 6.0,
|
|
<B>tput</B> did not modify terminal modes.
|
|
<B>tput</B> now uses a similar scheme,
|
|
using functions shared with <B>tset</B>
|
|
(and ultimately based on the 4.4BSD <B>tset</B>).
|
|
If it is not able to open a terminal, e.g., when running in <B>cron</B>,
|
|
<B>tput</B> will return an error.
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
AT&T <B>tput</B> guesses the type of its <I>capname</I> operands by seeing if
|
|
all of the characters are numeric, or not.
|
|
<DT id="54"><DD>
|
|
Most implementations which provide support for <I>capname</I> operands
|
|
use the <I>tparm</I> function to expand parameters in it.
|
|
That function expects a mixture of numeric and string parameters,
|
|
requiring <B>tput</B> to know which type to use.
|
|
<DT id="55"><DD>
|
|
This implementation uses a table to determine the parameter types for
|
|
the standard <I>capname</I> operands, and an internal library
|
|
function to analyze nonstandard <I>capname</I> operands.
|
|
</DL>
|
|
<P>
|
|
|
|
This implementation (unlike others) can accept both <I>termcap</I>
|
|
and <I>terminfo</I> names for the <I>capname</I> feature,
|
|
if
|
|
<I>termcap</I> support is compiled in.
|
|
However, the predefined <I>termcap</I> and <I>terminfo</I> names have two
|
|
ambiguities in this case (and the <I>terminfo</I> name is assumed):
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
The <I>termcap</I> name <B>dl</B> corresponds to
|
|
the <I>terminfo</I> name <B>dl1</B> (delete one line).
|
|
<BR>
|
|
|
|
The <I>terminfo</I> name <B>dl</B> corresponds to
|
|
the <I>termcap</I> name <B>DL</B> (delete a given number of lines).
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
The <I>termcap</I> name <B>ed</B> corresponds to
|
|
the <I>terminfo</I> name <B>rmdc</B> (end delete mode).
|
|
<BR>
|
|
|
|
The <I>terminfo</I> name <B>ed</B> corresponds to
|
|
the <I>termcap</I> name <B>cd</B> (clear to end of screen).
|
|
<P>
|
|
|
|
The <B>longname</B> and <B>-S</B> options, and the parameter-substitution
|
|
features used in the <B>cup</B> example,
|
|
were not supported in BSD curses before 4.3reno (1989) or in
|
|
AT&T/USL curses before SVr4 (1988).
|
|
<P>
|
|
|
|
IEEE Std 1003.1/The Open Group Base Specifications Issue 7 (POSIX.1-2008)
|
|
documents only the operands for <B>clear</B>, <B>init</B> and <B>reset</B>.
|
|
There are a few interesting observations to make regarding that:
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
In this implementation, <B>clear</B> is part of the <I>capname</I> support.
|
|
The others (<B>init</B> and <B>longname</B>) do not correspond to terminal
|
|
capabilities.
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
Other implementations of <B>tput</B> on
|
|
SVr4-based systems such as Solaris, IRIX64 and HPUX
|
|
as well as others such as AIX and Tru64
|
|
provide support for <I>capname</I> operands.
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
A few platforms such as FreeBSD recognize termcap names rather
|
|
than terminfo capability names in their respective <B>tput</B> commands.
|
|
Since 2010, NetBSD's <B>tput</B> uses terminfo names.
|
|
Before that, it (like FreeBSD) recognized termcap names.
|
|
<P>
|
|
|
|
Because (apparently) <I>all</I> of the certified Unix systems
|
|
support the full set of capability names, the reasoning for documenting
|
|
only a few may not be apparent.
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
X/Open Curses Issue 7 documents <B>tput</B> differently, with <I>capname</I>
|
|
and the other features used in this implementation.
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
That is, there are two standards for <B>tput</B>:
|
|
POSIX (a subset) and X/Open Curses (the full implementation).
|
|
POSIX documents a subset to avoid the complication of including X/Open Curses
|
|
and the terminal capabilities database.
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
While it is certainly possible to write a <B>tput</B> program
|
|
without using curses,
|
|
none of the systems which have a curses implementation provide
|
|
a <B>tput</B> utility which does not provide the <I>capname</I> feature.
|
|
<P>
|
|
|
|
X/Open Curses Issue 7 (2009) is the first version to document utilities.
|
|
However that part of X/Open Curses does not follow existing practice
|
|
(i.e., Unix features documented in SVID 3):
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
It assigns exit code 4 to ``invalid operand'',
|
|
which may be the same as <I>unknown capability</I>.
|
|
For instance, the source code for Solaris' xcurses uses the term
|
|
``invalid'' in this case.
|
|
|
|
<BR> .IP • 4
|
|
|
|
|
|
It assigns exit code 255 to a numeric variable that is not specified in
|
|
the terminfo database.
|
|
That likely is a documentation error,
|
|
confusing the <B>-1</B> written to the standard output for an absent
|
|
or cancelled numeric value versus an (unsigned) exit code.
|
|
<P>
|
|
|
|
The various Unix systems (AIX, HPUX, Solaris) use the same exit-codes
|
|
as ncurses.
|
|
<P>
|
|
|
|
NetBSD curses documents different exit codes which do not correspond
|
|
to either ncurses or X/Open.
|
|
<A NAME="lbAO"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+clear">clear</A></B>(1),
|
|
<B><A HREF="/cgi-bin/man/man2html?1+stty">stty</A></B>(1),
|
|
<B><A HREF="/cgi-bin/man/man2html?1+tabs">tabs</A></B>(1),
|
|
<B><A HREF="/cgi-bin/man/man2html?1+tset">tset</A></B>(1),
|
|
<B><A HREF="/cgi-bin/man/man2html?5+terminfo">terminfo</A></B>(5),
|
|
<B>termcap</B>(3NCURSES).
|
|
<P>
|
|
|
|
This describes <B>ncurses</B>
|
|
version 6.2 (patch 20200212).
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="56"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="57"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="58"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DL>
|
|
<DT id="59"><A HREF="#lbAE">Options</A><DD>
|
|
<DT id="60"><A HREF="#lbAF">Commands</A><DD>
|
|
<DT id="61"><A HREF="#lbAG">Aliases</A><DD>
|
|
<DT id="62"><A HREF="#lbAH">Terminal Size</A><DD>
|
|
</DL>
|
|
<DT id="63"><A HREF="#lbAI">EXAMPLES</A><DD>
|
|
<DT id="64"><A HREF="#lbAJ">FILES</A><DD>
|
|
<DT id="65"><A HREF="#lbAK">EXIT CODES</A><DD>
|
|
<DT id="66"><A HREF="#lbAL">DIAGNOSTICS</A><DD>
|
|
<DT id="67"><A HREF="#lbAM">HISTORY</A><DD>
|
|
<DT id="68"><A HREF="#lbAN">PORTABILITY</A><DD>
|
|
<DT id="69"><A HREF="#lbAO">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:28 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|