TSET(1) COMMAND REFERENCE TSET(1) NAME tset, reset - set up terminal modes and environment SYNOPSIS tset [ - ] [ -A ] [ -E[c] ] [ -I ] [ -P ] [ -Q ] [ -S ] [ -atype ] [ -dtype ] [ -e[c] ] [ -h ] [ -k[c] ] [ -m [identifier][speed- expression]:[[?]type] ] [ -n ] [ -ptype ] [ -r ] [ -s ] [ -t ] reset tset options DESCRIPTION Tset and reset are used to set up the terminal and the environment. Tset is usually used in the shell startup file ($HOME/.profile for users of sh(1sh) and $HOME/.login for users of csh(1csh)) to set up the terminal at login. Reset is used to put the terminal back into a ``sane'' state, usually after abnormal termination of a command that has changed the terminal port modes, or after a line problem has messed up the terminal itself. First, the terminal type is obtained. There are a number of steps taken to do this. First, the value of the environment variable TERM is obtained. If this is not set, the file /etc/ttytype is read to find the default terminal type for the port. At this point, the -m option(s) are processed if given (See Mapping below). Using the terminal type, the file /etc/termcap (or the file named by the value of the environment variable TERMCAP) is read to find the termcap entry for the terminal type. Next, the terminal modes, such as the erase and kill characters and the proper tty driver, are set. In addition, the initialization or reset strings are printed. If the command is invoked as tset, the value of the termcap entry ``is'', or the contents of the file named by the value of the entry ``if'' is printed. If invoked as reset, the entries ``rs'' and ``rf'' are used instead. Parity Setting If the termcap entry for the terminal contains the flag entry ``EP'', even parity is set. If ``OP'' is present, odd parity is set. If neither of these are given, both odd and even parity are set, unless the flag entry ``NP'' (no parity) is present. If the -P option is given, none of this processing takes place, thus the current parity setting is retained. Mapping Printed 5/12/88 1
TSET(1) COMMAND REFERENCE TSET(1) The -m option is used when the value of the TERM variable or information in /etc/ttytype may not be correct. This is useful with terminal types such as ``dialup'', ``network'', ``arpanet'', or ``plugboard'', whenever the port may be shared by users with different terminals, or when the terminal has more than one possible setup or variation. The syntax of the -m option is: -m [identifier][speed-expression]:[[?]type] The identifier is a terminal type string. The speed- expression is an expression that involves a combination of the relational operators `=' (equality), `@' (equality), `<' (less than), `>' (greater than), and `!' (not), and a baudrate number (optionally preceded by the character `B'). The type is the name of the terminal type to map to. The default for type is ``unknown''. The meaning of the -m option is that if the currently-known terminal type is the same as identifier (which defaults to any terminal type) and the speed-expression is true for the currently-known baudrate, the type given is to be used instead of the currently-known type. If the type string begins with a `?', the user is asked if the terminal type is the correct one to use. The user may then type a carriage return to accept the value printed, or may enter the terminal type desired. The -A option also accomplishes this. Here are a few examples of the -m option. -m dialup@1200:4105 This mapping says that if the terminal type is ``dialup'' and the baudrate is 1200, the terminal type to be used is 4105. -m network:?aaa-48 This mapping says that if the terminal type is ``network'' the user is to be asked if the terminal type should be ``aaa-48''. -m 4107-s-vb<1200:?4107 This mapping says that if the terminal type is ``4107-s-vb'' and the baudrate is less than 1200, the user is to be asked if the terminal type should be 4107 (in this case, it may be that the user might not want to use the status line and visual bells at such a slow baudrate). Printed 5/12/88 2
TSET(1) COMMAND REFERENCE TSET(1) Environment Variable Setting One of the most useful features of tset is to set up the environment variables TERM and possibly TERMCAP. The simplest way to use tset to set up the environment is to use the option -, which prints the terminal type. For example, a user of sh(1sh) might use the command line: export TERM; TERM=`tset - (options)` where (options) would be any mappings or other options (but not -s or -S). This sets the variable TERM to the value used by tset to set up the terminal. Since /etc/termcap contains a lot of entries, it is often desirable to have the environment variable TERMCAP contain the actual terminal capability entry instead of just the name of the file that contains the entry. By having the entry in the environment, programs that use this information, such as vi(1) and more(1), spend much less time locating this information. This can be done by using the -s option (and -S in some cases). This option causes commands to be printed which would set the environment variables TERM and TERMCAP. The content of the commands is determined by the value of the environment variable SHELL. If the value ends with ``csh'', the commands printed will look like: set noglob; setenv TERM '(type)'; setenv TERMCAP '(termcap entry)'; unset noglob; Otherwise, the shell is assumed to be sh(1sh) and the commands printed will look like: TERM='(type)'; TERMCAP='(termcap entry)'; export TERM TERMCAP; When csh(1csh) is being used, it is also possible to use the -S option. This option only prints the values of the TERM and TERMCAP variables; no commands. See the EXAMPLES section for sample uses of the -s and -S options. OPTIONS - Report the terminal type, checking to make sure it is valid. No initialization is done. -A Ask the user if the terminal type being used is the one desired. Printed 5/12/88 3
TSET(1) COMMAND REFERENCE TSET(1) -E[c] Set the erase character to c unless terminal can not backspace (like model 33 Teletype). If no c is given, ^H (backspace) is used. -I Do not initialize. No initialization sequence (``is'' in the termcap entry) or reset sequence (``rs'' in the termcap entry) is printed. -P Leave parity alone. See Parity Setting above. -Q Do not print the value of the erase and kill characters. -S Print the terminal name and termcap entry text. -atype Equivalent to -m arpanet:type. -dtype Equivalent to -m dialup:type. -e[c] Set the erase character to c. If no c is given, ^H (backspace) is used. -h Don't get the terminal type from the environment or the file /etc/ttytype when doing mapping. -k[c] Set the kill (erase line) character to c. If no c is given, ^X is used. -m [identifier][speed-expression]:[[?]type] Map terminal types and baudrates to other terminal types. More than one -m option may be given. See the DESCRIPTION section for more information. -n Use the new tty driver if it is available. This is useful for users of sh(1sh) that wish to use some of the new tty features. -ptype Equivalent to -m plugboard:type. -r Report the terminal name. This is similar to the - option, except that initialization is done. -s Print commands to set the environment variables TERM and TERMCAP. The value of the environment variable SHELL is used to determine the commands to print. Printed 5/12/88 4
TSET(1) COMMAND REFERENCE TSET(1) -t Do not re-use the TERMCAP variable. This forces /etc/termcap to be reread if it is to be used. EXAMPLES The three following examples assume a user that usually uses a Tektronix 4107 when logged in over a dialup port at 1200 baud, and a Tektronix 4105 when logged in over a dialup port at 300 baud. The examples also assume that the terminal type found in the variable TERM or in /etc/ttytype is valid in all other cases. This example shows a command line that might be found in the file $HOME/.profile (run by sh(1sh) at login time). The result is that the variables TERM and TERMCAP are set to contain the name of the terminal and the value of the termcap entry, respectively. The initialization string and the final values of the erase and kill characters are printed. eval `tset -s -mdialup@1200:?4107 -mdialup@300:?4105` This example shows a set of command lines that might be found in the file $HOME/.login (run by csh(1csh) at login time). The result is the same as in the previous example, except that the values of the erase and kill characters are not printed. set noglob eval `tset -s -Q -mdialup@1200:?4107 -mdialup@300:?4105` unset noglob Note that the setting of the ``noglob'' variable is required, due to the way that csh(1csh) interprets command lines. The unsetting of the ``noglob'' variable is not required, but is useful when tset is interrupted. This example is an alternative method of setting TERM and TERMCAP for csh(1csh) users. The result is the same as in the previous example, but the option -S is used instead of -s. set noglob set terminfo=(`tset -S -Q -mdialup@1200:?4107 -mdialup@300:?4105`) setenv TERM "$terminfo[1]" setenv TERMCAP "$terminfo[2]" unset noglob unset terminfo This example resets the terminal modes and prints the ``reset terminal'' string (using the termcap entry ``rs'' or ``rf''). Printed 5/12/88 5
TSET(1) COMMAND REFERENCE TSET(1) reset FILES /etc/ttytype Terminal port information /etc/termcap Default terminal capability database VARIABLES TERM The user's terminal type. TERMCAP The name of the terminal capability database or the capability entry for the terminal itself. SHELL The shell being used. RETURN VALUE [NO_ERRS] Command completed without error. [USAGE] Incorrect command line syntax. Execution terminated. [NP_WARN] An error warranting a warning message occurred. Execution continues. [NP_ERR] An error occurred that was not a system error. Execution terminated. [P_WARN] A system error occurred. Execution continues. See intro(2) for more information on system errors. [NP_WARN] An error warranting a warning message occurred. Execution continues. CAVEATS When the value of the environment variable TERMCAP contains something other than a filename (a filename being any string beginning with the character `/'), and the -t option is not given, the TERMCAP string is checked to see if it is a termcap entry for the value in TERM. If it is, that string is used (this means that tset and reset run very fast after TERMCAP is set). If not, /etc/termcap is used as the terminal capability database. This means that a user using a personal termcap file and a terminal type not found in /etc/termcap may not get the expected output from tset or reset. Printed 5/12/88 6
TSET(1) COMMAND REFERENCE TSET(1) When invoked as reset, no error messages are printed when the terminal type can not be located in the termcap file. The data given with the -m option is not checked for syntax, so an invalid use of this option may give strange results. SEE ALSO csh(1csh), more(1), sh(1sh), stty(1), vi(1), tty(4), and termcap(5t). Printed 5/12/88 7
%%index%% na:240,103; sy:343,902; de:1245,2666;4223,2537;7072,2509; op:9581,303;10196,2656;13164,157; ex:13321,2240;15873,18; fi:15891,227; va:16118,345; rv:16463,773; ca:17236,977;18525,338; se:18863,278; %%index%%000000000229