4.3BSD-Reno/share/man/cat1/reset.0

Compare this file to the similar file:
Show the results in this format:

TSET(1)                     UNIX Reference Manual		       TSET(1)

NNAAMMEE
     ttsseett - terminal dependent initialization

SSYYNNOOPPSSIISS
     ttsseett [_o_p_t_i_o_n_s] [ --mm [_i_d_e_n_t][_t_e_s_t _b_a_u_d_r_a_t_e]::_t_y_p_e] ...  [type]

     rreesseett [_o_p_t_i_o_n_s] [ --mm [_i_d_e_n_t][_t_e_s_t _b_a_u_d_r_a_t_e]::_t_y_p_e] ...  [type]

DDEESSCCRRIIPPTTIIOONN
     TTsseett sets up your terminal when you first log in to a UNIX system.  It
     does terminal dependent processing such as setting erase and kill charac-
     ters, setting or resetting delays, sending any sequences needed to prop-
     erly initialized the terminal, and the like.  It first determines the
     _t_y_p_e of terminal involved, and then does necessary initializations and
     mode settings.  The type of terminal attached to each UNIX port is speci-
     fied in the ttys(5) database.  Type names for terminals may be found in
     the termcap(5) database.  If a port is not wired permanently to a specif-
     ic terminal (not hardwired) it will be given an appropriate generic iden-
     tifier such as _d_i_a_l_u_p.

     In the case where no arguments are specified, ttsseett simply reads the ter-
     minal type out of the environment variable TERM and re-initializes the
     terminal.	The rest of this manual concerns itself with mode and environ-
     ment initialization, typically done once at login, and options used at
     initialization time to determine the terminal type and set up terminal
     modes.

     --ee_c   set the erase character to be the named character _c on all termi-
	   nals, the default being the backspace character on the terminal,
	   usually ^H.	The character _c can either be typed directly, or en-
	   tered using the hat notation used here.

     --kk_c   is similar to --ee but for the line kill character rather than the
	   erase character; _c defaults to ^X (for purely historical reasons).
	   The kill characters is left alone if --kk is not specified.  The hat
	   notation can also be used for this option.

     --ii_c   is similar to --ee but for the interrupt character rather than the
	   erase character; _c defaults to ^C.  The hat notation can also be
	   used for this option.

     --	   The name of the terminal finally decided upon is output on the
	   standard output.  This is intended to be captured by the shell and
	   placed in the environment variable TERM.

     --ss    Print the sequence of csh(1) commands to initialize the environment
	   variables TERM and TERMCAP based on the name of the terminal final-
	   ly decided upon.

     --mm    The Specify what terminal type to use on specific ports (i.e. map
	   the terminal type to a port as found in ttys(5).) See below.

     --nn    On systems with the Berkeley 4BSD 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(4) for more detail.

     --II    suppresses transmitting terminal initialization strings.

     --QQ    suppresses printing the ``Erase set to'' and ``Kill set to'' mes-
	   sages.

     When used in a startup script (._p_r_o_f_i_l_e for sh(1) users or ._l_o_g_i_n for
     csh(1) users) it is desirable to give information about the type of ter-
     minal you will usually use on ports which are not hardwired.  These ports
     are identified in ttys(5) as dialup or plugboard or arpanet, etc.	To
     specify what terminal type you usually use on these ports, the --mm (map)
     option flag is followed by the appropriate port type identifier, an op-
     tional baud rate specification, and the terminal type.  (The effect is to
     ``map'' from some conditions to a terminal type, that is, to tell ttsseett
     ``If I'm on this kind of port, guess that I'm on that kind of termi-
     nal''.) If more than one mapping is specified, the first applicable map-
     ping prevails.  A missing port type identifier matches all identifiers.
     Any of the alternate generic names given in termcap(5) may be used for
     the identifier.

     A _b_a_u_d_r_a_t_e is specified as with stty(1), and is compared with the speed
     of the diagnostic output (which should be the control terminal).  The
     baud rate _t_e_s_t may be any combination of: >>, @@, <<, and !!; @@ means ``at''
     and !!  inverts the sense of the test.  To avoid problems with metacharac-
     ters, it is best to place the entire argument to --mm within ``''' charac-
     ters; users of csh(1) must also put a ``\'' before any ``!'' used here.

	   tset -m 'dialup>300:adm3a' -m dialup:dw2 -m 'plugboard:?adm3a'

     causes the terminal type to be set to an _a_d_m_3_a if the port in use is a
     dialup at a speed greater than 300 baud; to a _d_w_2 if the port is (other-
     wise) a dialup (i.e. at 300 baud or less).  _N_O_T_E: the examples given here
     appear to take up more than one line, for text processing reasons.  When
     you type in real ttsseett commands, you must enter them entirely on one line.
     If the _t_y_p_e finally determined by ttsseett 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 will be used
     instead.  Thus, in the above case, the user will be queried on a plug-
     board port as to whether they are actually using an _a_d_m_3_a.

     If no mapping applies and a final _t_y_p_e option, not preceded by a --mm, is
     given on the command line then that type is used; otherwise the type
     found in the ttys(5) database will be 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 deter-
     mined by ttsseett, and information about the terminal's capabilities to a
     shell's environment.  This can be done using the -- option; using the
     Bourne shell, sh(1):

	   export TERM; TERM=`tset - _o_p_t_i_o_n_s ...  `

     or using the C shell, csh(1):

	   setenv TERM `tset - _o_p_t_i_o_n_s...  `

     With csh(1) it is preferable to use the following command in your .login
     file to initialize the TERM and TERMCAP environment variables at the same
     time.

	   eval `tset -s _o_p_t_i_o_n_s ...  `

     It is also convenient to make an alias in your .cshrc:

	   alias tset 'eval `tset -s \!*`'

     This allows the command:

	   tset 2621

     to be invoked at any time to set the terminal and environment.  NNoottee ttoo
     BBoouurrnnee SShheellll uusseerrss:: It is _n_o_t possible to get this aliasing effect with a
     shell script, because shell scripts cannot set the environment of their
     parent.  (If a process could set its parent's environment, none of this
     nonsense would be necessary in the first place.)
     These commands cause ttsseett to place the name of your terminal in the vari-
     able TERM in the environment; see environ(7).

     Once the terminal type is known, ttsseett 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 _C_R_T), and
     when the erase character is the default erase character (`#' on standard
     systems), the erase character is changed to BACKSPACE (Control-H).

     If ttsseett is invoked as rreesseett, it will set cooked and echo modes, turn off
     cbreak and raw modes, turn on newline translation, and restore 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 ttsseett may be used with
     reset.

     This is most useful after a program dies leaving a terminal in a funny
     state. You may have to type ``<LF>reset<LF>'' to get it to work since
     <CR> may not work in this state. Often none of this will echo.

EEXXAAMMPPLLEESS
     These examples all assume the Bourne shell and use the -- option.  If you
     use csh, use one of the variations described above.  Note that a typical
     use of ttsseett in a ._p_r_o_f_i_l_e _o_r ._l_o_g_i_n will also use the --ee and --kk options,
     and often the --nn or --QQ options as well.  These options have not been in-
     cluded here to keep the examples small.  NNOOTTEE: some of the examples given
     here appear to take up more than one line, for text processing reasons.
     When you type in real ttsseett commands, you must enter them entirely on one
     line.

     At the moment, you are on a 2621.	This is suitable for typing by hand
     but not for a ._p_r_o_f_i_l_e, _u_n_l_e_s_s _y_o_u _a_r_e _a_l_w_a_y_s on a 2621.

	   export TERM; TERM=`tset - 2621`

     You have an h19 at home which you dial up on, but your office terminal is
     hardwired and known in Xr ttys 5 .

	   export
     TERM; TERM=`tset - -m dialup:h19`

     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 elses terminal at
     work, so 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.

	   export TERM; TERM=`tset - -m 'switch>1200:?vt100' -m
	   'switch<=1200:2621'

     All of the above entries will fall back on the terminal type specified in
     ttys(5) if none of the conditions hold.  The following entry is appropri-
     ate if you always dial up, always at the same baud rate, on many dif-
     ferent kinds of terminals.  Your most common terminal is an adm3a.  It
     always asks you what kind of terminal you are on, defaulting to adm3a.

	   export TERM; TERM=`tset - ?adm3a`

     If the file ttys(5) is not properly installed and you want to key entire-
     ly on the baud rate, the following can be used:

	   export TERM; TERM=`tset - -m '>1200:vt100' 2621`

     Here is a fancy example to illustrate the power of ttsseett and to hopelessly
     confuse anyone who has made it this far.  You dial up at 1200 baud or
     less on a concept100, sometimes over switch ports and sometimes over reg-
     ular dialups.  You use various terminals at speeds higher than 1200 over
     switch ports, most often the terminal in your office, which is a vt100.
     However, sometimes you log in from the university you used to go to, over
     the ARPANET; in this case you are on an ALTO emulating a dm2500.  You
     also often log in on various hardwired ports, such as the console, all of
     which are properly entered in ttys(5).  You want your erase character set
     to control H, your kill character set to control U, and don't want ttsseett
     to print the ``Erase set to Backspace'', ``Kill set to Control U'' mes-
     sage.

	   export TERM; TERM=`tset -e -k^U -Q - -m 'switch<=1200:concept100'
	   -m 'switch:?vt100' -m dialup:concept100 -m arpanet:dm2500`

EENNVVIIRROONNMMEENNTT
     The ttsseett command utilizes the TERM and TERMCAP environment variables.

FFIILLEESS
     /_e_t_c/_t_t_y_s		       port name to terminal type mapping database
     /_u_s_r/_s_h_a_r_e/_m_i_s_c/_t_e_r_m_c_a_p   terminal capability database


SSEEEE AALLSSOO
     csh(1), sh(1), stty(1), ttys(5), termcap(5), environ(7)

HHIISSTTOORRYY
     TTsseett appeared in 3 BSD.

BBUUGGSS
     The ttsseett command is one of the first commands a user must master when
     getting started on a UNIX system.	Unfortunately, it is one of the most
     complex, largely because of the extra effort the user must go through to
     get the environment of the login shell set.  Something needs to be done
     to make all this simpler, either the login(1) program should do this
     stuff, or a default shell alias should be made, or a way to set the en-
     vironment of the parent should exist.

     This program can't intuit personal choices for erase, interrupt and line
     kill characters, so it leaves these set to the local system standards.