.\" authorization. *
.\"***************************************************************************
.\"
-.\" $Id: tput.1,v 1.42 2016/07/30 21:01:09 tom Exp $
+.\" $Id: tput.1,v 1.46 2016/10/22 19:57:25 tom Exp $
.TH @TPUT@ 1 ""
.ds d @TERMINFO@
.ds n 1
name in the first line of the terminal's description in the
\fBterminfo\fR database [see \fBterm\fR(5)].
.SS Aliases
-\fB@TPUT@\fR handles the \fBinit\fP and \fBreset\fP commands specially:
+\fB@TPUT@\fR handles the \fBclear\fP, \fBinit\fP and \fBreset\fP
+commands specially:
it allows for the possibility that it is invoked by a link with those names.
.PP
If \fB@TPUT@\fR is invoked by a link named \fBreset\fR, this has the
same effect as \fB@TPUT@ reset\fR.
-The \fB@TSET@\fR(\*n) utility also treats a link named \fBreset\fP specially:
+The \fB@TSET@\fR(\*n) utility also treats a link named \fBreset\fP specially.
+.PP
+Before ncurses 6.1, the two utilities were different from each other:
.bP
-That utility resets the terminal modes and special characters (not done here).
+\fB@TSET@\fP utility reset the terminal modes and special characters
+(not done with \fB@TPUT@\fP).
.bP
-On the other hand, @TSET@'s repertoire of terminal capabilities for
-resetting the terminal is more limited, i.e., only \fBreset_1string\fP, \fBreset_2string\fP and \fBreset_file\fP
+On the other hand, \fB@TSET@\fP's repertoire of terminal capabilities for
+resetting the terminal was more limited, i.e., only \fBreset_1string\fP, \fBreset_2string\fP and \fBreset_file\fP
in contrast to the tab-stops and margins which are set by this utility.
.bP
-The \fBreset\fP program is usually an alias for @TSET@,
-due to the resetting of terminal modes and special characters.
+The \fBreset\fP program is usually an alias for \fB@TSET@\fP,
+because of this difference with resetting terminal modes and special characters.
.PP
If \fB@TPUT@\fR is invoked by a link named \fBinit\fR, this has the
same effect as \fB@TPUT@ init\fR.
The \fBtput\fP command was begun by Bill Joy in 1980.
The initial version only cleared the screen.
.PP
-Keith Bostic replaced this in 1989 with a new implementation
-based on the AT&T SystemV program \fBtput\fP.
+AT&T System V provided a different \fBtput\fP command,
+whose \fBinit\fP and \fBreset\fP subcommands
+(more than half the program) were incorporated from
+the \fBreset\fP feature of BSD \fBtset\fP written by Eric Allman.
+Later the corresponding source code for \fIreset\fP
+was removed from the BSD \fBtset\fP
+(in June 1993, released in 4.4BSD-Lite a year later).
+.PP
+Keith Bostic replaced the BSD \fBtput\fP command in 1989 with a new implementation
+based on the AT&T System V program \fBtput\fP.
Like the AT&T program, Bostic's version
accepted some parameters named for \fIterminfo capabilities\fP
(\fBclear\fP, \fBinit\fP, \fBlongname\fP and \fBreset\fP).
However (because he had only termcap available),
it accepted \fItermcap names\fP for other capabilities.
+Also, Bostic's BSD \fBtput\fP did not modify the terminal I/O modes
+as the earlier BSD \fBtset\fP had done.
.PP
At the same time, Bostic added a shell script named \*(lqclear\*(rq,
which used \fBtput\fP to clear the screen.
This implementation of \fBtput\fP differs from AT&T \fBtput\fP in
two important areas:
.bP
-@TPUT@ writes to the standard output.
+\fB@TPUT@\fP \fIcapname\fP 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.
.IP
The AT&T implementation's \fBinit\fP and \fBreset\fP commands
-use the \fBtset\fP source, which manipulates terminal modes.
+use the BSD (4.1c) \fBtset\fP source, which manipulates terminal modes.
It successively tries standard output, standard error, standard input
before falling back to \*(lq/dev/tty\*(rq and finally just assumes
a 1200Bd terminal.
When updating terminal modes, it ignores errors.
+.IP
+Until changes made after ncurses 6.0, \fB@TPUT@\fP did not modify terminal modes.
+\fB@TPUT@\fP now uses a similar scheme,
+using functions shared with \fB@TSET@\fP
+(and ultimately based on the 4.4BSD \fBtset\fP).
+If it is not able to open a terminal, e.g., when running in \fBcron\fP,
+\fB@TPUT@\fP will return an error.
.bP
AT&T \fBtput\fP guesses the type of its \fIcapname\fP operands by seeing if
all of the characters are numeric, or not.