.\" Copyright (c) 1985, 1990 The Regents of the University of California.
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" @(#)tset.1 6.10 (Berkeley) 12/24/91
.Nd terminal initialization
first determines the type of terminal that you are using.
This determination is done as follows, using the first terminal type found.
.Bl -bullet -compact -offset indent
argument specified on the command line.
The terminal type associated with the standard error output device in the
The default terminal type, ``unknown''.
If the terminal type was not specified on the command-line, the
option mappings are then applied (see below for more information).
Then, if the terminal type begins with a question mark (``?''), the user is
prompted for confirmation of the terminal type.
An empty response confirms the type, or, another type can be entered to
Once the terminal type has been determined, the termcap entry for the terminal
If no termcap entry is found for the type, the user is prompted for another
Once the termcap entry is retrieved, the window size, backspace, interrupt
and line kill characters (among many other things) are set and the terminal
and tab initialization strings are sent to the standard error output.
Finally, if the erase, interrupt and line kill characters have changed,
or are not set to their default values, their values are displayed to the
sets cooked and echo modes, turns off cbreak and raw modes, turns on
newline translation and resets any unset special characters to their
default values before doing the terminal initialization described above.
This is useful after a program dies leaving a terminal in a abnormal state.
Note, you may have to type
(the line-feed character is normally control-J) to get the terminal
to work, as carriage-return may no longer work in the abnormal state.
Also, the terminal will often not echo the command.
The options are as follows:
The terminal type is displayed to the standard output, and the terminal is
not initialized in any way.
Set the erase character to
Do not send the terminal or tab initialization strings to the terminal.
Set the interrupt character to
Set the line kill character to
Specify a mapping from a port type to a terminal.
See below for more information.
Print the terminal type to the standard error output.
Print the sequence of shell commands to initialize the environment variables
Don't display any values for the erase, interrupt and line kill characters.
options may either be entered as actual characters or by using the
notation, i.e. control-h may be specified as
.Sh SETTING THE ENVIRONMENT
It is often desirable to set the terminal type and information about the
terminal's capabilities in the shell's environment.
option; when this option is specified, the commands to enter the information
into the shell's environment are output to the standard output.
environmental variable ends in ``csh'', the output commands are for the
Note, the output commands for the
set and unset the shell variable
The following line in the
files will initialize the environment correctly:
.Bd -literal -offset indent
eval \`tset -s options ... \`
.Sh TERMINAL TYPE MAPPING
When the terminal is not hardwired into the system (or the current system
information is incorrect) the terminal type derived from the
environmental variable is often something generic like
is used in a startup script
users) it is often desirable to provide information about the type of
terminal used on such ports.
from some set of conditions to a terminal type, that is, to
``If I'm on this port at a particular speed, guess that I'm on that
option consists of an optional port type, an optional operator, an optional
baud rate specification, an optional colon (``:'') character and a terminal
The port type is a string (delimited by either the operator or the colon
The operator may be any combination of:
inverts the sense of the test.
The baud rate is specified as a number and is compared with the speed
of the standard error output (which should be the control terminal).
The terminal type is a string.
If the terminal type is not specified on the command line, the
mappings are applied to the terminal type.
If the port type and baud rate match the mapping, the terminal type specified
in the mapping replaces the current type.
If more than one mapping is specified, the first applicable mapping is used.
For example, consider the following:
.Dq Li dialup>9600:vt100 .
the baud rate specification is
The result of this mapping is to specify that if the terminal type is
and the baud rate is greater than 9600 baud, a terminal type of
If no port type is specified, the terminal type will match any port type,
.Dq Li -m dialup:vt100 -m :?xterm
will cause any dialup port, regardless of baud rate, to match the terminal
and any non-dialup port type to match the terminal type
Note, because of the leading question mark, the user will be
queried on a default port as to whether they are actually using an
No whitespace characters are permitted in the
Also, to avoid problems with metacharacters, it is suggested that the entire
option argument be placed within single quote characters, and that
users insert a backslash character (``\e'') before any exclamation
.Bl -tag -width /usr/share/misc/termcap -compact
system port name to terminal type mapping database
.It Pa /usr/share/misc/termcap
terminal capability database
options have been deleted from the
None of them were documented in 4.3BSD and all are of limited utility at
options are similarly not documented or useful, but were retained as they
appear to be in widespread use.
It is strongly recommended that any usage of these three options be
option remains, but has no effect.
It is still permissible to specify the
options without arguments, although it is strongly recommended that such
usage be fixed to explicitly specify the character.
Also, the interaction between the
argument in some historic implementations of
implementation has been completely redone (as part of the addition to the
compliant terminal interface) and will no longer compile on systems with
older terminal interfaces.