tset initializes or resets the terminal with tput(C).
The type of terminal is specified by the type argument. The type may be any type given in the terminfo database. If the type is not specified with the -s option, tset creates information for a terminal of the type defined by the value of the environment variable, TERM, unless the -h or -m option is given. If the TERM variable is defined, tset uses the terminfo database entry. If the -h or -m options are used, tset searches the /etc/ttytype file for the terminal type corresponding to the current serial port; it then creates information for a terminal based on this type. If the serial port is not found in /etc/ttytype, the terminal type is set to unknown.
When the tty is in isscancode mode, tset invokes the mapstr(M) utility to read the function key values. These values are in a mapstr format file in /usr/lib/keyboard/strings.d that corresponds to the terminal type. mapstr then issues an ioctl(S-osr5) call to put the values into the kernel.
tset is most useful when included in the .login (for csh) or .profile (for sh or ksh) file executed automatically at login, with -m mapping used to specify the terminal type you most frequently dial in on.
tset displays the created information on the standard output. The information is in a form that can be used to set the current environment variables. The exact form depends on the login shell from which tset was invoked.
tset accepts the following options:
ident is the name of the indeterminate type to be matched. If no ident is given, all indeterminate types are matched. Only the first few characters of ident need be specified if several terminal types are to be matched. For example, wy matches wy60 or wy75.
test is a test to be performed on the serial line's speed
(its baudrate as defined in
stty(C)).
The possible tests are formed from a combination of the
following operators:
For example, the test \<=300 means the line speed must be equal to 300 baud. The tests \!= and \<\> both mean not equal to.
The operators !, >, and < must be escaped (quoted) to prevent them being interpreted by the shell.
type specifies the terminal type to be used if the serial line passes the test. If type is preceded by a question mark, tset prompts you to accept the terminal type by pressing <Return>, or to enter an alternative type.
If more than one -m option is specified, the first successful mapping is used.
For sh, set up the terminal with:
eval `tset -s`
To use this information to set up a terminal in csh, you
could enter:
set noglob
set term=(`tset -S`)
setenv TERM $term
unset term
unset noglob
For ksh and sh, you could use:
set -f
TERM=`tset -S`
export TERM
set +f
tset gt42The -m option is often used to map the ``dialup'' terminal type. If the entry in /etc/ttytype corresponding to the serial port is ``dialup'', and the line speed is greater than 300 baud, set the terminal type to adm3a. If the /etc/ttytype entry is ``dialup'' and the line speed is less than or equal to 300 baud, set the terminal type to dw2. Set the erase character to ``#'', and display the terminal type (but not the erase or kill characters) on the standard error output:
tset -mdialup\>300:adm3a -mdialup:dw2 -Qr -e#If the /etc/ttytype entry begins with ``dial'', the terminal type becomes ti733:
tset -m dial:ti733 -m plug:\?hp2621 -m unknown:\? -e -k^UIf the entry begins with ``plug'', tset prompts with:
TERM = (hp2621)Press <Return> to accept hp2621, or enter an alternate terminal type.
If the entry is ``unknown'', tset prompts with:
TERM = (unknown)ERASE is set to the terminal's backspace character, the kill character is set to <Ctrl>U, and the terminal type is displayed on the standard error output.
The following example is a typical entry from .profile (for someone whose login shell is the Bourne or Korn shell):
eval `tset -m ansi:ansi -m wy60:wy60 -m :\?${TERM:-ansi} -r -s -Q`If the serial line is not set up to expect connection to ansi or wy60 terminals, tset prompts for the terminal type. TERM is used as the default type; if TERM is not set, ansi is used instead.
For the C shell, a typical entry in .login might be:
set noglob set term = (`tset -m ansi:ansi -m wy60:wy60 -m :\?wy60 -r -S -Q`) if ( $status == 0 ) then setenv TERM "$term" endif unset term noglob