


TSET(1)                  USER COMMANDS                    TSET(1)



NAME
     tset, reset  - establish or restore terminal characteristics

SYNOPSIS
     tset [ -InQrsS ] [ -e_c ] [ -k_c ] [ -m [_p_o_r_t-ID
          [ _b_a_u_d_r_a_t_e] : _t_y_p_e ] ... ] [_t_y_p_e]

     reset [ - ] [ -e_c ] [ -I ] [ -k_c ] [ -n ]
          [ -Q ] [ -r ] [ -s ] [ -S ] -m [ _i_n_d_e_n_t ]
          [ _t_e_s_t _b_a_u_d_r_a_t_e ]: _t_y_p_e ] ... [ _t_y_p_e ]

DESCRIPTION
     tset sets up your terminal, typically  when  you  first  log
     in.   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.  tset 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
     port  is  specified in the /etc/ttytab database.  Type names
     for terminals may be found in the termcap(5) database.  If a
     port  is  not  wired permanently to a specific terminal (not
     hardwired) it is given  an  appropriate  generic  identifier
     such as dialup.

     reset clears the terminal settings by turning off CBREAK and
     RAW  modes, output delays and parity checking, turns on NEW-
     LINE translation, echo and TAB expansion, and restores unde-
     fined  special  characters to their default state.   It then
     sets the modes as usual, based on the terminal  type  (which
     will  probably  override  some of the above).  (See stty(1V)
     for more information.) All arguments to  tset  may  be  used
     with  reset.   reset also uses the rs= and rf= (reset string
     and file) instead of the initialization string and file from
     /etc/termcap.   This  is  useful  after  a  program dies and
     leaves the terminal in a funny state.  Often in this  situa-
     tion,  characters  will  not echo as you type them.  You may
     have to type `LINEFEEDresetLINEFEED' since `RETURN' may  not
     work.

     When no arguments are specified,  tset  reads  the  terminal
     type  from  the TERM environment variable and re-initializes
     the terminal, and performs initialization of mode,  environ-
     ment and other options at login time to determine the termi-
     nal type and set up terminal modes.

     When used in a startup script (.profile for sh(1)  users  or
     .login for csh(1) users) it is desirable to give information
     about the type of terminal you will  usually  use  on  ports
     that  are  not  hardwired.   These  ports  are identified in
     /etc/ttyab as dialup or plugboard, etc.  Any of  the  alter-
     nate generic names given in /etc/termcap may be used for the



Sun Release 4.1   Last change: 18 December 1989                 1






TSET(1)                  USER COMMANDS                    TSET(1)



     identifier.  Refer to the -m option under OPTIONS  for  more
     information.  If no mapping applies and a final _t_y_p_e option,
     not preceded by a -m, is given on the command line then that
     type  is  used;  otherwise the type found in the /etc/ttytab
     database is used as 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 -, -s, or -S options.  (Refer to OPTIONS
     for more information.)

     For the Bourne shell, put  this  command  in  your  .profile
     file:

          eval `tset -s _o_p_t_i_o_n_s...`

     or using the C shell, put this command in your .login file:

          eval `tset -s _o_p_t_i_o_n_s...`

     With the C shell, it is also convenient to make an alias  in
     your .cshrc file:

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

     This also allows the command:

          tset 2621

     to be invoked at any time to set the terminal  and  environ-
     ment.  _N_o_t_e _t_o _B_o_u_r_n_e _S_h_e_l_l _u_s_e_r_s: 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.

     Once the terminal type is  known,  tset  sets  the  terminal
     driver  mode.  This normally involves sending an initializa-
     tion sequence to the terminal, setting the single  character
     erase (and optionally the line-kill (full line erase)) char-
     acters, and setting special character delays.  TAB and  NEW-
     LINE  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 erase char-
     acter is changed as if -e had been used.

OPTIONS
     -    The name of the terminal finally decided upon is output



Sun Release 4.1   Last change: 18 December 1989                 2






TSET(1)                  USER COMMANDS                    TSET(1)



          on  the  standard  output.  This is intended to be cap-
          tured by the shell and placed in the  TERM  environment
          variable.

     -e_c  Set the erase character to be the named character _c  on
          all  terminals.   Default  is  the backspace key on the
          keyboard, usually ^H (CTRL-H).   The  character  _c  can
          either   be   typed  directly,  or  entered  using  the
          circumflex-character notation used here.

     -i_c  Set the interrupt character to be the named character _c
          on all terminals.  Default is ^C (CTRL-C).  The charac-
          ter _c can either be typed directly,  or  entered  using
          the circumflex-character notation used here.

     -I   Suppress transmitting terminal-initialization strings.

     -k_c  Set the line kill character to be the named character _c
          on  all  terminals.   Default is ^U (CTRL-U).  The kill
          character is left alone if -k is not  specified.   Con-
          trol  characters  can  be  specified  by  prefixing the
          alphabetical character with a circumflex (as in CTRL-U)
          instead  of  entering  the  actual  control key itself.
          This allows  you  to  specify  control  keys  that  are
          currently assigned.

     -n   Specify that the new tty driver modes  should  be  ini-
          tialized  for  this  terminal.   Probably useless since
          stty new is the default.

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

     -r   In addition to  other  actions,  reports  the  terminal
          type.

     -s   Output commands to set and  export  TERM  and  TERMCAP.
          This can be used with
               set noglob
               eval `tset -s ...`
               unset noglob

          to bring the terminal information into the environment.
          Doing  so makes programs such as vi(1) start up faster.
          If the SHELL environment  variable  ends  with  csh,  C
          shell  commands are output, otherwise Bourne shell com-
          mands are output.








Sun Release 4.1   Last change: 18 December 1989                 3






TSET(1)                  USER COMMANDS                    TSET(1)



     -S   Similar to the -s option, but produces two strings con-
          taining suitable values for the (environment) variables
          TERM and TERMCAP, respectively, and can be used as fol-
          lows:
               set noglob
               set t=(`tset -S ...`)
               setenv TERM $t[1]
               setenv TERMCAP "$t[2]"
               unset t
               unset noglob

          Since -s loads these values, its use is preferred.   If
          the  SHELL  environment variable does not end with csh,
          -S produces the same  Bourne  shell  commands  that  -s
          does.

     -m [_p_o_r_t-ID[_b_a_u_d_r_a_t_e]:_t_y_p_e] ...
          Specify (map) a terminal type when connected to a  gen-
          eric  port  (such as _d_i_a_l_u_p or _p_l_u_g_b_o_a_r_d) identified by
          _p_o_r_t-_I_D.  The _b_a_u_d_r_a_t_e argument can be  used  to  check
          the  baudrate  of  the  port  and set the terminal type
          accordingly.  The target rate is prefixed by any combi-
          nation of the following operators to specify the condi-
          tions under which the mapping is made:

               >    Greater than

               @    Equals or ``at''

               <    Less than

               !    It is not the case that  (negates  the  above
                    operators)

               ?    Prompt for the terminal type.  If no response
                    is given, then _t_y_p_e is selected by default.

          In the following example, the terminal type is  set  to
          adm3a  if  the port is a dialup with a speed of greater
          than 300 or to _d_w_2 if the port is a dialup at 300  baud
          or  less.  In the third case, the question mark preced-
          ing the terminal type indicates that  the  user  is  to
          verify  the  type  desired.   A null response indicates
          that the named type is correct.  Otherwise, the  user's
          response is taken to be the type desired.

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

          To prevent interpretation as metacharacters, the entire
          argument  to  -m  should  be enclosed in single quotes.
          When using the C shell, exclamation  points  should  be



Sun Release 4.1   Last change: 18 December 1989                 4






TSET(1)                  USER COMMANDS                    TSET(1)



          preceded by a backslash (\).

EXAMPLES
     These examples all use the `-' option.   A  typical  use  of
     tset  in  a  .profile  or .login will also use the -e and -k
     options, and often the -n or  -Q  options  as  well.   These
     options have been omitted here to keep the examples short.

     To select a 2621, you might put the  following  sequence  of
     commands  in  your .login file (or .profile for Bourne shell
     users).
               set noglob
               eval `tset -s 2621`
               unset noglob

     If you have an h19 at home which you dial up  on,  but  your
     office  terminal  is hardwired and known in /etc/ttytab, you
     might use:
               set noglob
               eval `tset -s -m dialup:h19`
               unset noglob

     If you have a switch which connects to various ports (making
     it  impractical  to identify which port you may be connected
     to), and use various terminals from time to  time,  you  can
     select  from among those terminals according to the _s_p_e_e_d or
     baud rate.  In the example below, tset will prompt you for a
     terminal  type  if  the baud rate is greater than 1200 (say,
     9600 for a terminal connected by an RS-232 line), and use  a
     Wyse  50 by default.  If the baud rate is less than or equal
     to 1200, it will select a 2621.  Note the placement  of  the
     question  mark,  and  the quotes to protect the > and ? from
     interpretation by the shell.
               set noglob
               eval `tset -s -m 'switch>1200:?wy' -m 'switch<=1200:2621'`
               unset noglob

     All of the above entries will fall back on the terminal type
     specified  in  /etc/ttytab  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, and the terminal you use most often is an adm3a.
               set noglob
               eval `tset -s ?adm3a`
               unset noglob

     If the file /etc/ttytab is not properly set up and you  want
     to make the selection based only on the baud rate, you might
     use the following:
               set noglob
               eval `tset -s -m '>1200:wy' 2621`
               unset noglob



Sun Release 4.1   Last change: 18 December 1989                 5






TSET(1)                  USER COMMANDS                    TSET(1)



     The following example quietly sets the  erase  character  to
     BACKSPACE,  and  kill to CTRL-U. If the port is switched, it
     selects a Concept 100 for speeds less than or equal to 1200,
     and  asks  for  the  terminal type otherwise (the default in
     this case is a Wyse 50).  If the port is a direct dialup, it
     selects  Concept  100  as  the terminal type.  If logging in
     over the TCP/IP, the terminal type selected is  a  Datamedia
     2500 terminal or emulator.  (Note the backslash escaping the
     NEWLINE at the end of the first line in the example.)

          set noglob
          eval `tset -e -k^U -Q -s  -m  'switch<=1200:concept100'
          -m   \        'switch:?wy'   -m   dialup:concept100  -m
          arpanet:dm2500`
          unset noglob

FILES
     /etc/ttytab         port name to terminal type mapping data-
                         base
     /etc/termcap        terminal capability database
     /usr/share/lib/tabset/*
                         TAB setting sequences for various termi-
                         nals.  Pointed to by termcap entries.
     .login
     .profile

SEE ALSO
     csh(1), sh(1),  stty(1V),  vi(1),  environ(5V),  termcap(5),
     ttytab(5)

NOTES
     Once the terminal's size has been initialized, further invo-
     cations of tset will not affect it.  To correct this, do the
     following:

          example% stty rows 0 colums 0

     and then run tset normally.

BUGS
     The tset command is one of the first commands  a  user  must
     master  when  getting  started  on  a  UNIX  system.  Unfor-
     tunately, 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 program
     should do this stuff, or a default  shell  alias  should  be
     made,  or  a way to set the environment of the parent should
     exist.

     This program  cannot  intuit  personal  choices  for  erase,
     interrupt  and  line kill characters, so it leaves these set



Sun Release 4.1   Last change: 18 December 1989                 6






TSET(1)                  USER COMMANDS                    TSET(1)



     to the local system standards.

     It could well be argued that the shell should be responsible
     for ensuring that the terminal remains in a sane state; this
     would eliminate the need for the reset program.


















































Sun Release 4.1   Last change: 18 December 1989                 7



