1tset(1B)           SunOS/BSD Compatibility Package Commands           tset(1B)
2
3
4

NAME

6       tset, reset - establish or restore terminal characteristics
7

SYNOPSIS

9       tset [-InQrs] [-ec] [-kc]
10            [-m [port-ID [baudrate] : type]...] [type]
11
12
13       reset [-] [-ec] [-I] [-kc]
14            [-n] [-Q] [-r] [-s]
15            [-m [indent] [test baudrate] : type]... [type]
16
17

DESCRIPTION

19       The  tset  utility  sets up your terminal, typically when you first log
20       in. It does terminal dependent processing such  as  setting  erase  and
21       kill  characters,  setting  or  resetting delays, sending any sequences
22       needed to properly initialized the terminal, and the like.  tset  first
23       determines  the type of terminal involved, and then does necessary ini‐
24       tializations and mode settings. If a port is not wired permanently to a
25       specific  terminal  (not  hardwired) it is given an appropriate generic
26       identifier such as dialup.
27
28
29       reset clears the terminal settings by  turning  off   CBREAK  and   RAW
30       modes, output delays and parity checking, turns on NEWLINE translation,
31       echo and TAB expansion, and restores undefined  special  characters  to
32       their  default  state.    It then sets the modes as usual, based on the
33       terminal type (which will probably override some  of  the  above).  See
34       stty(1)  for  more  information. All arguments to tset may be used with
35       reset. reset also uses  rs= and rf= to reset the initialization  string
36       and  file.  This is useful after a program dies and leaves the terminal
37       in a funny state. Often in this situation, characters will not echo  as
38       you  type  them.  You  may  have  to type LINEFEED reset LINEFEED since
39       RETURN may not work.
40
41
42       When no arguments are specified, tset reads the terminal type from  the
43       TERM environment variable and re-initializes the terminal, and performs
44       initialization of mode, environment and other options at login time  to
45       determine the terminal type and set up terminal modes.
46
47
48       When  used  in a startup script (.profile for sh(1) users or .login for
49       csh(1) users) it is desirable to give information  about  the  type  of
50       terminal  you  will usually use on ports that are not hardwired. Any of
51       the alternate generic names given in the file /etc/termcap are possible
52       identifiers.  Refer  to the -m option below for more information. If no
53       mapping applies and a final type option, not preceded by a -m, is given
54       on the command line then that type is used.
55
56
57       It  is usually desirable to return the terminal type, as finally deter‐
58       mined by tset, and information about the terminal's capabilities, to  a
59       shell's environment. This can be done using the , -s, or -S options.
60
61
62       For the Bourne shell, put this command in your .profile file:
63
64         eval `tset -s options...`
65
66
67
68       or using the C shell, put these commands in your .login file:
69
70         set noglob
71         eval `tset -s options...`unset noglob
72
73
74
75       With the C shell, it is also convenient to make an alias in your .cshrc
76       file:
77
78         alias ts 'eval `tset -s \!*`'
79
80
81
82       This also allows the command:
83
84         ts 2621
85
86
87
88       to be invoked at any time to set the terminal and  environment.  It  is
89       not  possible  to  get this aliasing effect with a Bourne shell script,
90       because shell scripts cannot set the environment of their parent. If  a
91       process could set its parent's environment, none of this nonsense would
92       be necessary in the first place.
93
94
95       Once the terminal type is known, tset sets the  terminal  driver  mode.
96       This normally involves sending an initialization sequence to the termi‐
97       nal, setting the single character erase (and optionally  the  line-kill
98       (full  line  erase))  characters, and setting special character delays.
99       TAB and NEWLINE expansion are turned off  during  transmission  of  the
100       terminal initialization sequence.
101
102
103       On terminals that can backspace but not overstrike (such as a CRT), and
104       when the erase character is `#', the erase character is changed  as  if
105       -e had been used.
106

OPTIONS

108       The  name of the terminal finally decided upon is output on the
109               standard output. This is intended to be captured by  the  shell
110               and placed in the TERM environment variable.
111
112
113       -ec     Set the erase character to be the named character c on all ter‐
114               minals. Default is the BACKSPACE key on the  keyboard,  usually
115               ^H  (CTRL-H).  The character c can either be typed directly, or
116               entered using the circumflex-character notation used here.
117
118
119       -ic     Set the interrupt character to be the named character c on  all
120               terminals.  Default  is ^C (CTRL-C). The character c can either
121               be typed directly, or entered  using  the  circumflex-character
122               notation used here.
123
124
125       -I      Suppress transmitting terminal-initialization strings.
126
127
128       -kc     Set  the line kill character to be the named character c on all
129               terminals. Default is ^U (CTRL-U). The kill character  is  left
130               alone  if -k is not specified. Control characters can be speci‐
131               fied by prefixing the alphabetical character with a  circumflex
132               (as  in  CTRL-U)  instead  of  entering  the actual control key
133               itself.  This allows you to specify control keys that are  cur‐
134               rently assigned.
135
136
137       -n      Specify that the new tty driver modes should be initialized for
138               this terminal.  Probably useless since stty new is the default.
139
140
141       -Q      Suppress printing the `Erase set to' and  `Kill  set  to'  mes‐
142               sages.
143
144
145       -r      In addition to other actions, reports the terminal type.
146
147
148       -s      Output commands to set and export TERM. This can be used with
149
150                 set noglob
151                 eval `tset -s ...`
152                 unset noglob
153
154
155               to  bring  the terminal information into the environment. Doing
156               so makes programs such as vi(1) start up faster. If  the  SHELL
157               environment  variable  ends with csh, C shell commands are out‐
158               put, otherwise Bourne shell commands are output.
159
160
161       -m [ port-ID [ baudrate ] : type ] ...
162
163           Specify (map) a terminal type when  connected  to  a  generic  port
164           (such  as  dialup or plugboard) identified by port-ID. The baudrate
165           argument can be used to check the baudrate of the port and set  the
166           terminal type accordingly.  The target rate is prefixed by any com‐
167           bination of the following operators to specify the conditions under
168           which the mapping is made:
169
170           >    Greater than
171
172
173           @    Equals or ``at''
174
175
176           <    Less than
177
178
179           !    It is not the case that (negates the above operators)
180
181
182           ?    Prompt  for  the terminal type.  If no response is given, then
183                type is selected by default.
184
185           In the following example, the terminal type is set to adm3a if  the
186           port  is a dialup with a speed of greater than 300 or to dw2 if the
187           port is a dialup at 300 baud or less. In the third case, the  ques‐
188           tion mark preceding the terminal type indicates that the user is to
189           verify the type desired.  A NULL response indicates that the  named
190           type  is correct. Otherwise, the user's response is taken to be the
191           type desired.
192
193             tset -m 'dialup>300:adm3a' -m 'dialup:dw2' -m 'plugboard:?adm3a'
194
195
196           To prevent interpretation as metacharacters, the entire argument to
197           -m  should  be enclosed in single quotes.   When using the C shell,
198           exclamation points should be preceded by a backslash (\).
199
200

EXAMPLES

202       These examples all use the `' option.  A typical  use  of  tset  in  a
203       .profile  or  .login will also use the -e and -k options, and often the
204       -n or -Q options as well. These options have been omitted here to  keep
205       the examples short.
206
207       Example 1 Selecting a terminal
208
209
210       To  select  a 2621, you might put the following sequence of commands in
211       your .login file (or .profile for Bourne shell users).
212
213
214         set noglob
215         eval `tset -s 2621`
216         unset noglob
217
218
219
220
221       If you want to make the selection based only  on  the  baud  rate,  you
222       might use the following:
223
224
225         set noglob
226         eval `tset -s -m '>1200:wy' 2621`
227         unset noglob
228
229
230
231       Example 2 Selecting terminals according to speed or baud rate
232
233
234       If you have a switch which connects to various ports (making it imprac‐
235       tical to identify which port you may be connected to), and use  various
236       terminals  from time to time, you can select from among those terminals
237       according to the speed or baud rate. In the example  below,  tset  will
238       prompt  you  for  a terminal type if the baud rate is greater than 1200
239       (say, 9600 for a terminal connected by an RS-232 line), and use a Wyse®
240       50 by default.  If the baud rate is less than or equal to 1200, it will
241       select a 2621. Note the placement of the question mark, and the  quotes
242       to protect the > and ? from interpretation by the shell.
243
244
245         set noglob
246         eval `tset -s -m 'switch>1200:?wy' -m 'switch<=1200:2621'`
247         unset noglob
248
249
250
251       Example 3 Selecting the terminal used most often
252
253
254       The following entry is appropriate if you always dial up, always at the
255       same baud rate, on many different kinds of terminals, and the  terminal
256       you use most often is an adm3a.
257
258
259         set noglob
260         eval `tset -s ?adm3a`
261         unset noglob
262
263
264
265       Example 4 Selecting a terminal with specific settings
266
267
268       The  following  example  quietly sets the erase character to BACKSPACE,
269       and kill to CTRL-U. If the port is switched, it selects a Concept™  100
270       for  speeds  less than or equal to 1200, and asks for the terminal type
271       otherwise (the default in this case is a Wyse 50). If  the  port  is  a
272       direct  dialup, it selects Concept 100 as the terminal type. If logging
273       in over the ARPANET, the terminal type selected is  a  Datamedia®  2500
274       terminal  or  emulator.  Note the backslash escaping the NEWLINE at the
275       end of the first line in the example.
276
277
278         set noglob
279         eval `tset -e -k^U -Q -s -m 'switch<=1200:concept100' -m\
280            'switch:?wy' -m dialup:concept100 -m arpanet:dm2500`
281         unset noglob
282
283
284

FILES

286       .login
287
288
289       .profile
290
291
292       /etc/termcap
293
294

ATTRIBUTES

296       See attributes(5) for descriptions of the following attributes:
297
298
299
300
301       ┌─────────────────────────────┬─────────────────────────────┐
302       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
303       ├─────────────────────────────┼─────────────────────────────┤
304       │Availability                 │SUNWscpu                     │
305       └─────────────────────────────┴─────────────────────────────┘
306

SEE ALSO

308       csh(1), sh(1), stty(1), vi(1), attributes(5), environ(5)
309

NOTES

311       The tset command is one of the first commands a user must  master  when
312       getting  started on a UNIX system. Unfortunately, it is one of the most
313       complex, largely because of the extra effort the user must  go  through
314       to  get  the  environment of the login shell set. Something needs to be
315       done to make all this simpler, either the login program should do  this
316       stuff,  or  a  default  shell alias should be made, or a way to set the
317       environment of the parent should exist.
318
319
320       This program cannot intuit personal choices for  erase,  interrupt  and
321       line  kill characters, so it leaves these set to the local system stan‐
322       dards.
323
324
325       It could well be argued that the shell should be responsible for ensur‐
326       ing that the terminal remains in a sane state; this would eliminate the
327       need for the reset program.
328
329
330
331SunOS 5.11                        15 Feb 1995                         tset(1B)
Impressum