tset(C) 19 June 1992 tset(C) Name tset - set terminal modes Syntax tset [ - ] [ -hrsuIQS ] [ -e[c] ] [ -E[c] ] [ -k[c] ] [ -m [ident] [test baudrate ]:type ] [ type ] Description The tset command allows the user to set a terminal's ERASE and KILL char- acters, 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 ter- minfo 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 mapstr to read the func- tion key values. These values are in a mapstr format file in /usr/lib/keyboard/strings.d that corresponds to the terminal type. The mapstr utility 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 standard output. The informa- tion is in a form that can be used to set the current environment vari- ables. The exact form depends on the login shell from which tset was invoked. There are the following options: -e[c] Sets the ERASE character to c on all terminals. The default set- ting is the BACKSPACE, or CTRL-H. -E[c] Identical to the -e command except that it only operates on ter- minals that can BACKSPACE. -k[c] Sets the KILL character to c, defaulting to CTRL-U. - Prints the terminal type on the standard output. -s Outputs the setenv commands (for csh(C)), or export and assign- ment commands (for sh(C) or ksh(C)). The type of commands are determined by the user's login shell. For sh, set up the terminal with: eval `tset -s` -h Forces tset to search /etc/ttytype for information and to over- look the environment variable, TERM. -S Only outputs the strings to be placed in the environment vari- ables, without the shell commands printed for -s. To use this information to set up a terminal in csh, enter: set noglob set term=(`tset -S`) setenv TERM $term[1] setenv TERMCAP $term[2] unset term unset noglob -r Prints the terminal type on the diagnostic output. -Q Suppresses the printing of the ``Erase set to'' and ``Kill set to'' messages. -I Suppresses 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 mapstr(S). -m[ident][test baudrate]:type Allows a user to specify how a given serial port is to be mapped to an actual terminal type. The option applies to any serial port in /etc/ttytype whose type is indeterminate (for example, dialup, plugboard, etc.). The type specifies the terminal type to be used, and ident identifies the name of the indeterminate type to be matched. If no ident is given, all indeterminate types are matched. The test baudrate defines a test to be per- formed on the serial port before the type is assigned. The bau- drate must be as defined in stty(C). The test may be any combination of: >, =, <, @, and !. If the type begins with a question mark, the user is asked if they really want that type. A null response means to use that type; otherwise, another type can be entered which will be used instead. The question mark must be escaped to prevent filename expansion by the shell. If more than one -m option is given, the first correct mapping prevails. Examples Set the terminal type to gt42: tset gt42 Use the -m option to map the ``dialup'' terminal type: tset -mdialup\>300:adm3a -mdialup:dw2 -Qr -e# If the entry in /etc/ttytype corresponding to the login port is ``dialup'', and the port speed is greater than 300 baud, set the termianl type to adm3a. If the /etc/ttytype entry is ``dialup'' and the port 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 standard error. tset -m dial:ti733 -m plug:\?hp2621 -m unknown:\? -e -k^U If the /etc/ttytype entry begins with ``dial'', the terminal type becomes ti733. If the entry begins with ``plug'', tset prompts with: TERM = (hp2621) You would then press <Return> to accept hp2621 or type in an alternate terminal type and <Return>. If the entry is ``unknown'', tset prompts with: TERM = (unknown) In any case, erase is set to the terminal's backspace character, kill is set to CTRL-U, and the terminal type is displayed on standard error. Files /etc/ttytype Port name to terminal type map database /usr/lib/terminfo/* Terminal capability database See also csh(C), ksh(C), sh(C), stty(C), terminfo(F), termio(M), tput(C), tty(M) Credit This utility was developed at the University of California at Berkeley and is used with permission.