Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ tset(1) — SunOS 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

csh(1)

sh(1)

stty(1)

ttytype(5)

termcap(5)

environ(5)

TSET(1)  —  USER COMMANDS

NAME

tset − establish terminal characteristics for the environment

SYNOPSIS

tset [ − ] [ −ec ] [ −I ] [ −kc ] [ −n ] [ −Q ] [ −r ] [ −s ] [ −S ]

[ −m [port-ID[baudrate][:type] ... ] [ type ]

reset ...

DESCRIPTION

Tset sets up your terminal, typically  when you first log in.  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 the like.  Tset first determines the type of terminal involved, and then does necessary initializations and mode settings.  The type of terminal attached to each UNIX port is specified in the /etc/ttytype database.  Type names for terminals may be found in the termcap(5) database. If a port is not wired permanently to a specific terminal (not hardwired) it is given an appropriate generic identifier such as dialup.

Reset turns off cbreak and raw modes, output delays, and parity checking; turns on newline translation, echo, and tab expansion; and restores undefined special characters to their default state.   Then it sets the modes as usual, based on the terminal type (which will probably override some of the above).  (See stty(1) for more information.)  Reset also uses the rs= and rf= "reset string and file" instead of the initialization string and file from /etc/termcap. This is useful after a program dies and leaves the terminal in a funny state.  Often in this situation, characters will not echo as you type them. You may have to type “<LF>reset<LF>” since <CR> may not work. 
 

When no arguments are specified, tset simply reads the terminal type out of the TERM environment variable and re-initializes the terminal.  Tset also performs mode and environment initialization — typically done once at login — and options used at initialization time to determine the terminal type and set up terminal modes. 

When used in a startup script (.profile for sh(1) users or .login for csh(1) users) it is desirable to give information about the type of terminal you will usually use on ports that are not hardwired. These ports are identified in /etc/ttytype as dialup or plugboard, etc. Any of the alternate generic names given in termcap may be used for the identifier.  Refer to the −m option under OPTIONS for more information.  If no mapping applies and a final type option, not preceded by a −m, is given on the command line then that type is used; otherwise the identifier found in the /etc/ttytype database is used as 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 tset, and information about the terminal’s capabilities to a shell’s environment.  This can be done using the −, -s, or -S options.  Refer to OPTIONS for more information.  sh(1):

export TERM; TERM=`tset − options...`

or using the C shell, csh(1):

setenv TERM `tset − options...`

With csh it is convenient to make an alias in your .cshrc:

alias tset ´setenv TERM `tset − \!∗`´

Either of these aliases allow the command

tset 2621

to be invoked at any time from your login csh.  Note to Bourne Shell users: It is not 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. 

Once the terminal type is known, tset 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 (such as a CRT), and when the erase character is ‘#’, the erase character is changed as if -e had been used. 

OPTIONS

− The name of the terminal finally decided upon is output on the standard output.  This is intended to be captured by the shell and placed in the TERM environment variable. 

−ec Set the erase character to be the named character c on all terminals.  Default is the backspace key on the keyboard, usually ^H.  The character c can either be typed directly, or entered using the hat notation used here. 

−I Suppress transmitting terminal-initialization strings. 

−kc Set the line kill character to be the named character c on all terminals.  Default is ^U.  The kill character is left alone if −k is not specified.  The hat notation can also be used for this option. 

−n Specifies that the new tty driver modes should be initialized for this terminal.  Probably useless since stty new is the default. 

−Q Suppress printing the “Erase set to” and “Kill set to” messages. 

−r In addition to other actions, reports the terminal type. 

−s Output setenv commands for TERM and TERMCAP.  This can be used with

set noglob
eval `tset −s ...`
unset noglob

and is preferred to `setenv TERM `tset − . . .`’, because it makes programs such as vi(1) start up much faster. 

−S Similar to the −s option, but outputs two strings suitable for use in csh(1) .login files as follows:

set noglob
set t=(`tset −S ...`)
setenv TERM $t[1]
setenv TERMCAP "$t[2]"
unset t
unset noglob

−m [port-ID[baudrate]:type] ...
Specify ("map") a terminal type when connected to a generic port (such as dialup or plugboard) identified by port-ID. The baudrate argument (see also, stty(1)) can be used to check the baudrate of the port and set the terminal type accordingly.  The target rate is prefixed by any combination of the following operators:

>is greater than

@equals or "at"

<is less than

!it is not the case that (negates the above operators)

to specify the conditions under which the mapping is made. 

In the following example, the terminal type is set to adm3a if the port is a dialup with a speed of greater than 300 or to dw2 if the port is a dialup at 300 baud or less.  In the third case, the question mark preceeding the terminal type indicates that the user is to verify the type desired.  A null response indicates that the named type is correct.  Otherwise, the user’s response is taken to be the type desired. 

tset −m ’dialup>300:adm3a’ −m ’dialup:dw2’ −m ’plugboard:?adm3a’

To prevent interpratation as metacharacters, the entire argument to −m should be enclosed in single quotes.   When using the C-shell, exclamation points should be preceded by a backslash (\). 

EXAMPLES

These examples all assume the C-shell and use the −s option.  If you use the Bourne shell, use one of the variations described above.  Note that a typical use of tset in a .profile or .login will also use the −e and −k options, and often the −n or −Q options as well.  These options have not been included here to keep the examples small. 

At the moment, you are on a 2621.  This is suitable for typing by hand but not for a .profile, unless you are always on a 2621. 

set noglob; eval `tset −s 2621`; unset noglob

You have an h19 at home which you dial up on, but your office terminal is hardwired and known in /etc/ttytype. 

set noglob; eval `tset −s −m dialup:h19`; unset noglob

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 else’s 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 always on a 2621.  Note the placement of the question mark, and the quotes to protect the greater than and question mark from interpretation by the shell. 

set noglob; eval `tset −s −m ’switch>1200:?vt100’ −m ’switch<=1200:2621’`; unset noglob

All of the above entries will fall back on the terminal type specified in /etc/ttytype 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, defaulting to adm3a. 

set noglob; eval `tset −s ?adm3a`; unset noglob

If the file /etc/ttytype is not properly installed and you want to key entirely on the baud rate, the following can be used:

set noglob; eval `tset −s −m ’>1200:vt100’ 2621`; unset noglob

Here is a fancy example to illustrate the power of tset 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, over the ARPANET; in this case you are on an ALTO emulating a dm2500.  You also often log in on various hardwired ports, such as the console, all of which are properly entered in /etc/ttytype. You want your erase character set to control H, your kill character set to control U, and don’t want tset to print the “Erase set to Backspace, Kill set to Control U” message.  This example appears to take up more than one line.  When you type in real tset commands, you must enter them entirely on one line. 

set noglob; eval `tset −e −k^U −Q −s −m ’switch<=1200:concept100’ −m ’switch:?vt100’ −m dialup:concept100 −m arpanet:dm2500`; unset noglob

FILES

/etc/ttytypeport name to terminal type mapping database
/etc/termcapterminal capability database
/usr/lib/tabset/∗tab setting sequences for various terminals.  Pointed to by termcap
entries. 

SEE ALSO

csh(1), sh(1), stty(1), ttytype(5), termcap(5), environ(5)

BUGS

The tset command is one of the first commands a user must master when getting started on a UNIX system.  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, either the login(1) 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.

It could well be argued that the shell should be responsible for ensuring that the terminal remains in a sane state; this would eliminate the need for the reset program. 

Sun Release 2.0  —  Last change: 1 February 1985

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026