.\" 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.7 (Berkeley) 7/27/91
.Nd terminal dependent initialization
sets up your terminal when you first log in to a
It does terminal dependent processing such as setting
erase and kill characters, setting or resetting delays,
sending any sequences needed to properly initialized the terminal,
and then does necessary initializations and mode settings.
The type of terminal attached to each
Type names for terminals may be found in the
If a port is not wired permanently to a specific terminal (not hardwired)
it will be given an appropriate generic identifier such as
In the case where no arguments are specified,
simply reads the terminal type out of the environment variable
and re-initializes the terminal.
The rest of this manual concerns
itself with mode and environment initialization,
typically done once at login, and options
used at initialization time to determine the terminal type and set up
set the erase character to be the named character
the default being the backspace character on the terminal, usually ^H.
can either be typed directly, or entered using the hat
but for the line kill character rather than the erase character;
defaults to ^X (for purely historical reasons).
The kill characters is left alone if
The hat notation can also be used for this option.
but for the interrupt character rather than the erase character;
The hat notation can also be used for this option.
The name of the terminal finally decided upon is output on the
This is intended to be captured by the shell and placed in the
commands to initialize the environment variables
the name of the terminal finally decided upon.
Specify what terminal type to use on specific ports (i.e. map the
terminal type to a port as found in
specifies that the new tty driver modes should be initialized for this terminal.
modes are set only if the baud rate is 1200 or greater.
suppresses transmitting terminal initialization strings.
When used in a startup script
users) it is desirable to give information about the type of terminal
you will usually use on ports which are not hardwired.
These ports are identified in
what terminal type you usually use on these ports, the
(map) option flag is followed by the appropriate port type identifier,
an optional baud rate specification,
(The effect is to ``map'' from some conditions to a terminal type,
``If I'm on this kind of port, guess that I'm on that kind of terminal''.)
If more than one mapping is specified, the first applicable mapping prevails.
A missing port type identifier matches all identifiers.
Any of the alternate generic names given in
may be used for the identifier.
speed of the diagnostic output (which should be the control terminal).
may be any combination of:
inverts the sense of the test.
To avoid problems with metacharacters, it
is best to place the entire argument to
within ``\''' characters; users of
must also put a ``\e'' before any ``!'' used here.
.Bd -filled -offset indent
tset \-m \'dialup>300:adm3a\' -m dialup:dw2 -m \'plugboard:?adm3a\'
causes the terminal type to be set to an
if the port in use is a dialup at a speed greater than 300 baud;
if the port is (otherwise) a dialup (i.e. at 300 baud or less).
the examples given here appear to take up more than
one line, for text processing reasons.
commands, you must enter them entirely on one line.
begins with a question mark,
the user is asked if s/he really wants that type.
A null response means to use that type;
otherwise, another type can be entered which will be used instead.
Thus, in the above case, the user will be queried on a plugboard port
as to whether they are actually using an
If no mapping applies and a final
option, not preceded by a
is given on the command line
otherwise the type found in the
database will be taken to be the terminal type.
This should always be the case for hardwired ports.
It is usually desirable to return the terminal type, as finally determined by
and information about the terminal's capabilities
to a shell's environment.
This can be done using the
option; using the Bourne shell,
.Bd -literal -offset indent
export TERM; TERM=\`tset options ... \`
.Bd -literal -offset indent
setenv TERM \`tset \- options ... \`
it is preferable to use the following command in one's
environment variables at the same time.
.Bd -literal -offset indent
eval \`tset -s options ... \`
It is also convenient to make an alias in your .cshrc:
.Bd -literal -offset indent
alias tset \'eval \`tset \-s \e!*\`\'
to be invoked at any time to set the terminal and environment.
.Sy Note to Bourne Shell users:
possible to get this aliasing effect with a shell script,
because shell scripts cannot set the environment of their parent.
(If a process could set its parent's environment,
none of this nonsense would be necessary in the first place.)
to place the name of your terminal in the variable
Once the terminal type is known,
engages in terminal driver mode setting.
This normally involves sending an initialization sequence to the
terminal, setting the single character erase (and optionally
the line-kill (full line erase)) characters,
and setting special character delays.
Tab and newline expansion are turned off during transmission of
the terminal initialization sequence.
On terminals that can backspace but not overstrike
and when the erase character is the default erase character
(`#' on standard systems),
the erase character is changed to
it will set cooked and echo modes, turn off cbreak and raw modes,
turn on newline translation, and restore special characters
to a sensible state before any terminal dependent processing is done.
Any special character that is found to be
or ``\-1'' is reset to its default value.
This is most useful after a program dies leaving a terminal in a funny
may not work in this state.
Often none of this will echo.
These examples all assume the Bourne shell and use the
use one of the variations described above.
Note that a typical use of
These options have not been included here to keep the examples small.
some of the examples given here appear to take up more than
one line, for text processing reasons.
commands, you must enter them entirely on one line.
At the moment, you are on a
This is suitable for typing by hand but
.Pa .profile, unless you are
.Bd -literal -offset indent
export TERM; TERM=\`tset \- 2621\`
You have an h19 at home which you dial up on, but your office terminal
is hardwired and known in
.Bd -literal -offset indent
export TERM; TERM=\`tset \- \-m dialup:h19\`
You have a switch which connects everything to everything, making
it nearly impossible to key on what port you are coming in on.
You use a vt100 in your office at 9600 baud, and dial up to switch
ports at 1200 baud from home on a 2621.
Sometimes you use someone elses terminal at work,
so you want it to ask you to make sure what terminal
type you have at high speeds, but at 1200 baud you are
Note the placement of the question mark, and the quotes
to protect the greater than and question mark from
interpretation by the shell.
.Bd -literal -offset indent
export TERM; TERM=\`tset \- \-m 'switch>1200:?vt100'\e
All of the above entries will fall back on the terminal type
if none of the conditions hold.
The following entry is appropriate if
you always dial up, always at the same baud rate,
on many different kinds of terminals.
Your most common terminal is an adm3a.
It always asks you what kind of terminal you are on,
.Bd -literal -offset indent
export TERM; TERM=\`tset \- ?adm3a\`
is not properly installed and you want to
key entirely on the baud rate, the following can be used:
.Bd -literal -offset indent
export TERM; TERM=\`tset \- \-m '>1200:vt100' 2621\`
Here is a fancy example to illustrate the power of
and to hopelessly confuse anyone who has made it this far.
You dial up at 1200 baud or less on a concept100,
sometimes over switch ports and sometimes over regular dialups.
You use various terminals at speeds higher than 1200 over switch ports,
most often the terminal in your office, which is a vt100.
However, sometimes you log in from the university you used to go to,
in this case you are on an
You also often log in on various hardwired ports, such as the console,
all of which are properly entered in
You want your erase character set to control H,
your kill character set to control U,
.Dq Li Erase set to Backspace ,
.Dq Li Kill set to Control U
.Bd -literal -offset indent
export TERM; TERM=\`tset \-e \-k^U \-Q \-\e
\-m 'switch<=1200:concept100' \-m 'switch:?vt100'\e
\-m dialup:concept100 \-m arpanet:dm2500\`
.Bl -tag -width /usr/share/misc/termcap -compact
port name to terminal type mapping database
.It Pa /usr/share/misc/termcap
terminal capability database
command is one of the first commands a user must master when getting
Unfortunately, it is one of the most complex,
largely because of the extra effort the user must go through
to get the environment of the login shell set.
Something needs to be done to make all this simpler,
program should do this stuff,
or a default shell alias should be made,
or a way to set the environment of the parent should exist.
This program can't intuit personal choices for erase, interrupt
and line kill characters, so it leaves these set to the local system
.\" For compatibility with earlier versions of
.\" a number of flags are accepted whose use is discouraged:
.\" Sets the erase character to
.\" only if the terminal can backspace.
.\" prints the terminal type on the standard output
.\" prints the terminal type on the diagnostic output.