TSET, RESET(1,C) AIX Commands Reference TSET, RESET(1,C) ------------------------------------------------------------------------------- tset, reset PURPOSE Initializes terminal for new user. SYNTAX +-------------+ +--------+ +------------+ tset ----| +---------+ |---| one of |---| |---> reset +-| -ec -I |-+ | +----+ | +- -m ident -+ ^| -Rc -Q || +-| -b |-+ || -ic -S || | -s | || - || +----+ || r || || N || |+---------+| +-----------+ +------------------------------+ >---| +---------+ |---| +- tset baudrate --| |-+ ^+- :type -+| +-----------+ DESCRIPTION The tset command sets up your terminal when you first log in to an AIX system. It does terminal dependent processing such as setting erase and kill characters, setting or resetting delays, sending any sequences needed to properly initialized the terminal, and the like. It first determines the type of terminal involved, and then does necessary initializations and mode settings. The type of terminal attached to each AIX port is specified in the /etc/ports data base. Type names for terminals may be found in the terminfo data base. If a port is not wired permanently to a specific terminal (not hardwired), it is given an appropriate generic identifier such as dialup. In the case where no arguments are specified, the tset command simply reads the terminal type out of the environment variable TERM and re-initializes the terminal. The rest of this manual concerns itself with mode and environment initialization, typically done once at login, and options used at initialization time to determine the terminal type and set up terminal modes. When used in a startup script (.profile for sh users or .login for csh users) it is desirable to give information about the type of terminal you usually use on ports which are not hardwired. These ports are identified in /etc/ports as dialup or plugboard or arpanet, etc. To specify what terminal type you usually Processed November 8, 1990 TSET, RESET(1,C) 1 TSET, RESET(1,C) AIX Commands Reference TSET, RESET(1,C) use on these ports, the -m (map) option flag is followed by the appropriate port type identifier, an optional baud rate specification, and the terminal type. (The effect is to "map" from some conditions to a terminal type, that is, to tell tset "If I'm on this kind of port, guess that I'm on that kind of terminal".) 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 terminfo may be used for the identifier. A baudrate is specified as with stty, and is compared with the speed of the diagnostic output (which should be the control terminal). The baud rate test may be any combination of: >, @, <, and !; @ means "at" and ! inverts the sense of the test. To avoid problems with metacharacters, it is best to place the entire argument to -m within " ' " characters; users of csh must also put a "\" before any "!" used here. Thus: tset -m 'dialup>300:adm3a' -m dialup:dw2 -m 'plugboard:?adm3a' causes the terminal type to be set to an adm3a if the port in use is a dialup at a speed greater than 300 baud; to a dw2 if the port is (otherwise) a dialup (for example at 300 baud or less). If the type finally determined by the tset command begins with a question mark, the user is asked if s/he really wants that type. A null response means to use that type; otherwise, another type can be entered which is used instead. Thus, in the above case, the user is queried on a plugboard port as to whether they are actually using an adm3a. If no mapping applies and a final type option, not preceded by a -m, is given on the command line then that type is used; otherwise, the type found in the /etc/ports data base is taken to be the terminal type. This should always be the case for hardwired ports. It is usually desirable to return the terminal type, as finally determined by tset, and information about the terminal's capabilities to a shell's environment. This can be done using the - option; using the Bourne shell, sh: TERM= `tset - options...`; export TERM or using the C shell, csh: setenv TERM `tset - options...` With csh it is preferable to use the following command in your .login file to initialize the TERM environment variable. eval `tset -s options... ` It is also convenient to make an alias in your .cshrc: Processed November 8, 1990 TSET, RESET(1,C) 2 TSET, RESET(1,C) AIX Commands Reference TSET, RESET(1,C) alias tset 'eval `/usr/ucb/tset -s\!*`' This allows the command tset 2621 to be invoked at any time to set the terminal and environment. Note to C Shell users: It is not possible to get this aliasing effect with a shell script, because shell scripts cannot set the environment of their parent. These commands cause tset to place the name of your terminal in the variable TERM in the environment; see environ. Once the terminal type is known, tset engages in terminal driver mode setting. This normally involves sending an initialization sequence to the terminal, setting the single character erase (and optionally the line-kill (full line erase)) characters, and setting special character delays. Tab and newline 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). The options are: -b Prints the sequence of sh commands which initialize the environment variable TERM based on the type of terminal decided upon. -ec Set the erase character to be the named character c on all terminals, the default being the backspace character on the terminal, usually Ctrl-H. The character c can either be typed directly, or entered using the caret notation used here. -kc Similar to -e but sets the line kill character rather than the erase character; c defaults to Ctrl-X. The caret notation can also be used for this option. -ic Similar to -e but sets the interrupt character rather than the erase character; c defaults to Ctrl-C. The caret notation can also be used for this option. - Outputs name of the terminal type to the standard output. This is intended to be captured by the shell and placed in the environment variable TERM. -r Reports to standard error the type of the terminal decided upon. -s Prints the sequence of csh commands which initialize the environment variable TERM based on the type of the terminal decided upon. For example, if tset -s is entered on an hft, the output is: set noglob; setenv TERM hft; unset noglob; Processed November 8, 1990 TSET, RESET(1,C) 3 TSET, RESET(1,C) AIX Commands Reference TSET, RESET(1,C) -m ident Maps the specified terminal type to the port type given. The map option must be followed by a port type identifier, optional baud rate and terminal type. -n On systems with the Berkeley 4.3 BSD tty driver, specifies that the new tty driver modes should be initialized for this terminal. For a CRT, the CRTERASE and CRTKILL modes are set only if the baud rate is 1200 or greater. See "tty" for more detail. -I Suppresses transmitting terminal initialization strings (for example, strings used to set special character delays), which configure the hardware terminal. -Q Suppresses printing the "Erase set to" "Kill set to" and "Interrupt set to" messages. These messages are usually written to standard error when -s, -S or -r is used. -S Writes to standard output the type of the terminal decided upon. If tset is invoked as reset, it sets cooked and echo modes, turns off cbreak and raw modes, turns on newline translation, and restores special characters to a sensible state before any terminal dependent processing is done. Any special character that is found to be NULL or "-1" is reset to its default value. All arguments to tset may be used with reset. Reset is most useful after a program dies leaving a terminal in a funny state. You may have to type reset to get it to work since may not work in this state. Often none of this echoes. EXAMPLES These examples all assume the Bourne shell and use the - option. If you use csh, use one of the variations described above. A typical use of tset in a .profile or .login also uses the -e and -k options, and often the -n or -Q options as well. These options have not been included here to keep the examples small. 1. At the moment, you are on a 2621. This is suitable for typing by hand but not for a .profile, unless you are always on a 2621. TERM=`tset - 2621`; export TERM 2. You have an h19 at home which you dial up on, but your office terminal is hardwired and known in /etc/ports. TERM=`tset - -m dialup:h19`; export TERM 3. You have a switch which connects everything to everything, making it nearly impossible to key on what port you are coming in on. You use a vt100 in your office at 9600 baud, and dial up to switch ports at 1200 baud from home on a 2621. Sometimes you use someone else's terminal at work, so Processed November 8, 1990 TSET, RESET(1,C) 4 TSET, RESET(1,C) AIX Commands Reference TSET, RESET(1,C) you want it to ask you to make sure what terminal type you have at high speeds, but at 1200 baud you are always on a 2621. Note the placement of the question mark, and the quotes to protect the greater than and question mark from interpretation by the shell. TERM=`tset - -m 'switch>1200:?vt100' -m 'switch<=1200:2621'; export TERM 4. All of the above entries fall back on the terminal type specified in /etc/ports if none of the conditions hold. The following entry is appropriate if you always dial up, always at the same baud rate, on many different kinds of terminals. Your most common terminal is an adm3a. It always asks you what kind of terminal you are on, defaulting to adm3a. TERM=`tset - ?adm3a`; export TERM 5. If the file /etc/ports is not properly installed and you want to key entirely on the baud rate, the following can be used: TERM=`tset - -m '>1200:vt100' 2621`; export TERM FILES /etc/ports Port name to terminal type mapping data base. /usr/lib/terminfo/?/* Terminal capability data base. RELATED INFORMATION See the following commands: "csh," "sh, Rsh," and "stty, STTY." See terminfo and environ in the AIX Operating System Technical Reference. COMPATIBILITY NOTE 4.3 ports and terminal information are now in /etc/ports and terminfo data base (instead of /etc/ttys and termcap). Processed November 8, 1990 TSET, RESET(1,C) 5