tset Command

Purpose

Initializes terminals.

Syntax

tset [ -e ] [ -k ] [ -i ] [ - ] [ -s ] [ -I ] [ -Q ] [  -m [ Identifier ] [ TestBaudRate :Type ] ... [ Type ]

Description

The tset command enables you to set the characteristics of your terminal. It performs terminal-dependent processing, such as setting erase and kill characters, setting or resetting delays, and sending any sequences needed to properly initialize the terminal.

The tset command first determines the type of terminal involved (specified by the Type parameter). It then performs necessary initializations and mode settings. The type of terminal attached to each port is specified in the Object Data Manager (ODM) database. The terminfo database contains possible type names for terminals. If a port is not wired permanently to a specific terminal (that is, it is not hardwired), the tset command gives it an appropriate generic identifier, such as dialup.

When no flags are specified, the tset command reads the terminal type out of the TERM environment variable and re-initializes the terminal.

When the tset command is used in a startup script (the .profile file for sh users or the .login file for csh users), the script should include information about the type of terminal you will usually use on ports that are not hardwired. These ports are identified in the ODM database as dialup, plugboard, or ARPANET, among others. To specify which terminal type you usually use on these ports, use the -m flag (followed by the appropriate port type identifier), an optional baud rate specification, and the terminal type. 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 the terminfo database can be used as the identifier.

You can specify the baud rate in the tset command as you would with the stty command. The baud rate is compared with the speed of the diagnostic output (which should be the control terminal). The baud rate test can be any combination of the following characters:

The @ (at sign) stands for the preposition at, and the ! (exclamation point) inverts the sense of the test. To avoid problems with metacharacters, place the -m flag argument inside '' (single quotes). Users of the csh command must also put a \ (backslash) before any ! (exclamation point).

The following example sets the terminal type to adm3a if the port in use is a dialup at a speed greater than 300 baud. It sets the terminal type to dw2 if the port is a dialup port at a speed of 300 baud or less:

tset -m 'dialup>300:adm3a' -m dialup:dw2 -m 'plugboard:?adm3a'

If the Type parameter begins with a ? (question mark), you are prompted to verify the type. To use the specified type, press Enter. To use a different type, enter the type you want. In the example given, you are prompted to verify the adm3 plugboard port type.

If no mapping applies and a final type option (not preceded by an -m flag) is given on the command line, that type is used. Otherwise, the default terminal type is the one identified in the ODM database. Hardwired ports should always be identified in the ODM database.

When the terminal type is known, the tset command engages in terminal driver mode setting. This usually involves setting:

Tab and new-line 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 default erase character (# on standard systems), the erase character is changed to Backspace (Ctrl-H).

Flags

Item Description
-e C Sets the erase character to the character specified by the C parameter.The default is the backspace character.
-I Suppresses transmission of terminal initialization strings.
-i C Sets the interrupt character to the character specified by the C parameter. The C parameter defaults to ^C (caret C). The ^ (caret) character can also be used for this option.
-k C Sets the line-kill character to the character specified by the C parameter. The C parameter defaults to ^X (caret X). The ^ (caret) character can also be used for this option.
-m IdentifierTestbaudRate:Type Specifies which terminal type (in the Type parameter) is usually used on the port identified in the Identifier parameter. A missing identifier matches all identifiers. You can optionally specify the baud rate in the TestBaudRate parameter.
-Q Suppresses printing of the Erase set to and Kill set to messages.
-s Prints the sequence of csh commands that initialize the TERM environment variable, based on the name of the terminal decided upon.
- The name of the terminal decided upon is output to standard output. This is the TERM environment variable.

Examples

The following examples all assume the Bourne shell and usage of the - flag. If you use the csh command, use the preceding variations. A typical use of the tset command in a .profile or .login file includes the -e and -k flags, and often the -n or -Q flags as well. To streamline the examples, these flags have not been included here.
Note: Make sure to enter the tset command all on one line regardless of the number of lines used in the example.
  1. Now you are a 2621 terminal. Do not use the following example in your .profile file, unless you are always a 2621 terminal.
    export TERM; TERM=\'tset \- 2621\'
  2. You have an h19 terminal at home that you dial up on, but your office terminal is hardwired and specified in the ODM database.
    export TERM; TERM=\'tset \- \-m dialup:h19"'
  3. You have a switch that connects everything to everything, making it nearly impossible to key on what port you are coming in. You use a vt100 in your office at 9600 baud and dial up from home on a 2621 to switch ports at 1200 baud. Sometimes, you use a different terminal at work. At high speeds, you want to verify your terminal type, but at 1200 baud, you are always on a 2621. Note how the quotation marks protect the greater-than sign and the question mark from interpretation by the shell.
    export TERM; TERM=\'tset \- \-m 'switch>1200:?vt100' \-m
    'switch<=1200:2621'
    If none of the conditions hold, the terminal type specified in the ODM database is used.
  4. The following entry is appropriate if you always dial up at the same baud rate on many different terminals. Your most common terminal is an adm3a. You are always prompted to verify the terminal type, which defaults to adm3a.
    export TERM; TERM=\'tset \- \?adm3a\'
  5. If the ODM database is not properly installed and you want to key entirely on the baud rate, type:
    export TERM; TERM=\'tset \- \-m 'switch>1200:?vt100' \-m
    'switch<=1200:2621'
  6. 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 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 the ODM database. To set your erase character to Ctrl-H and your kill character to Ctrl-U, type:
    export TERM
    TERM=\'tset \-e \-k(hat)U \-Q \- "-m 'switch<1200:concept100'
    "-m 'switch:?vt100' \-m dialup:concept100 "1-m arpanet: dm2500"'
    This also prevents the tset command from printing the following line:
    Erase set to Backspace, Kill set to Ctrl-U
  7. To set the erase character to a control character, type:
    tset -e ^Y

Files

Item Description
/usr/share/lib/terminfo Contains the terminal capability database.