DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

tset(C)


tset -- set terminal modes

Syntax

tset [ - ] [ -hrsuIQS ] [ -e[c] ] [ -E[c] ] [ -k[c] ]
[ -m[ident][test baudrate]:type] [ type ]

Description

The tset command allows you to set a terminal's ERASE and KILL characters, and define the terminal's type and capabilities by creating values for the TERM environment variable. It is driven by the /etc/ttytype file and the terminfo database.

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) 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:


-
Print the terminal type on the standard output.

-e[c]
Set the ERASE character to c on all terminals. The default setting is BACKSPACE, or <Ctrl>H.

-E[c]
Identical to the -e option except that it only operates on terminals that can BACKSPACE.

-h
Force tset to search /etc/ttytype for information and to overlook the environment variable, TERM.

-I
Suppress printing of the terminal initialization strings; for example, spawns tput reset instead of tput init. If the terminal is in scancode mode, set -I will prevent the invocation of mapkey(M).

-k[c]
Set the KILL character to c, defaulting to <Ctrl>U.

-m[ident][test baudrate]:type
Allows you to specify the terminal type that is to be mapped to a serial port defined in /etc/ttytype. This option is usually applied to any serial port in /etc/ttytype whose type is indeterminate (dialup and unknown, for example).

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:


!
not

@

=
equal to

>
greater than

<
less than

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.


-Q
Suppress the printing of the ``Erase set to'' and ``Kill set to'' messages.

-r
Print the terminal type on the standard error output.

-s
Output the setenv commands (for csh(C)), or export and assignment commands (for sh(C) or ksh(C)). The type of commands are determined by your login shell.

For sh, set up the terminal with:

eval `tset -s`

-S
Output the string to be placed in the environment variable TERM without the shell commands printed for -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

Examples

Set the terminal type to gt42:
   tset gt42
The -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^U
If 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

Files


/etc/ttytype
database mapping serial ports to terminal types

/usr/lib/terminfo/*
terminal capability database

See also

csh(C), ksh(C), mapstr(M), sh(C), stty(C), terminfo(F), termio(M), tput(C), tty(M)

Standards conformance

tset is not part of any currently supported standard; it is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003