Commit | Line | Data |
---|---|---|
362b077f C |
1 | |
2 | ||
3 | ||
4 | TSET(1) UNIX Programmer's Manual TSET(1) | |
5 | ||
6 | ||
7 | ||
8 | N\bNA\bAM\bME\bE | |
9 | tset - terminal dependent initialization | |
10 | ||
11 | S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS | |
12 | t\bts\bse\bet\bt [ options ] [ -\b-m\bm [ident][test baudrate]:type ] ... [ | |
13 | type ] | |
14 | ||
15 | r\bre\bes\bse\bet\bt [ options ] [ -\b-m\bm [ident][test baudrate]:type ] ... [ | |
16 | type ] | |
17 | ||
18 | D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN | |
19 | _\bT_\bs_\be_\bt sets up your terminal when you first log in to a UNIX | |
20 | system. It does terminal dependent processing such as set- | |
21 | ting erase and kill characters, setting or resetting delays, | |
22 | sending any sequences needed to properly initialized the | |
23 | terminal, and the like. It first determines the _\bt_\by_\bp_\be of | |
24 | terminal involved, and then does necessary initializations | |
25 | and mode settings. The type of terminal attached to each | |
26 | UNIX port is specified in the /_\be_\bt_\bc/_\bt_\bt_\by_\bs(5) database. Type | |
27 | names for terminals may be found in the _\bt_\be_\br_\bm_\bc_\ba_\bp(5) database. | |
28 | If a port is not wired permanently to a specific terminal | |
29 | (not hardwired) it will be given an appropriate generic | |
30 | identifier such as _\bd_\bi_\ba_\bl_\bu_\bp. | |
31 | ||
32 | In the case where no arguments are specified, _\bt_\bs_\be_\bt simply | |
33 | reads the terminal type out of the environment variable TERM | |
34 | and re-initializes the terminal. The rest of this manual | |
35 | concerns itself with mode and environment initialization, | |
36 | typically done once at login, and options used at initiali- | |
37 | zation time to determine the terminal type and set up termi- | |
38 | nal modes. | |
39 | ||
40 | When used in a startup script (._\bp_\br_\bo_\bf_\bi_\bl_\be for _\bs_\bh(1) users or | |
41 | ._\bl_\bo_\bg_\bi_\bn for _\bc_\bs_\bh(1) users) it is desirable to give information | |
42 | about the type of terminal you will usually use on ports | |
43 | which are not hardwired. These ports are identified in | |
44 | /_\be_\bt_\bc/_\bt_\bt_\by_\bs as _\bd_\bi_\ba_\bl_\bu_\bp or _\bp_\bl_\bu_\bg_\bb_\bo_\ba_\br_\bd or _\ba_\br_\bp_\ba_\bn_\be_\bt, etc. To | |
45 | specify what terminal type you usually use on these ports, | |
46 | the -\b-m\bm (map) option flag is followed by the appropriate port | |
47 | type identifier, an optional baud rate specification, and | |
48 | the terminal type. (The effect is to ``map'' from some con- | |
49 | ditions to a terminal type, that is, to tell _\bt_\bs_\be_\bt ``If I'm | |
50 | on this kind of port, guess that I'm on that kind of termi- | |
51 | nal''.) If more than one mapping is specified, the first | |
52 | applicable mapping prevails. A missing port type identifier | |
53 | matches all identifiers. Any of the alternate generic names | |
54 | given in _\bt_\be_\br_\bm_\bc_\ba_\bp may be used for the identifier. | |
55 | ||
56 | A _\bb_\ba_\bu_\bd_\br_\ba_\bt_\be is specified as with _\bs_\bt_\bt_\by(1), and is compared | |
57 | with the speed of the diagnostic output (which should be the | |
58 | control terminal). The baud rate _\bt_\be_\bs_\bt may be any combina- | |
59 | tion of: >\b>, @\b@, <\b<, and !\b!; @\b@ means ``at'' and !\b! inverts the | |
60 | ||
61 | ||
62 | ||
63 | Printed 7/9/88 May 5, 1986 1 | |
64 | ||
65 | ||
66 | ||
67 | ||
68 | ||
69 | ||
70 | TSET(1) UNIX Programmer's Manual TSET(1) | |
71 | ||
72 | ||
73 | ||
74 | sense of the test. To avoid problems with metacharacters, | |
75 | it is best to place the entire argument to -\b-m\bm within ``''' | |
76 | characters; users of _\bc_\bs_\bh(1) must also put a ``\'' before any | |
77 | ``!'' used here. | |
78 | ||
79 | Thus | |
80 | ||
81 | tset -m 'dialup>300:adm3a' -m dialup:dw2 -m | |
82 | 'plugboard:?adm3a' | |
83 | ||
84 | causes the terminal type to be set to an _\ba_\bd_\bm_\b3_\ba if the port | |
85 | in use is a dialup at a speed greater than 300 baud; to a | |
86 | _\bd_\bw_\b2 if the port is (otherwise) a dialup (i.e. at 300 baud or | |
87 | less). (N\bNO\bOT\bTE\bE:\b: the examples given here appear to take up | |
88 | more than one line, for text processing reasons. When you | |
89 | type in real _\bt_\bs_\be_\bt commands, you must enter them entirely on | |
90 | one line.) If the _\bt_\by_\bp_\be finally determined by _\bt_\bs_\be_\bt begins | |
91 | with a question mark, the user is asked if s/he really wants | |
92 | that type. A null response means to use that type; other- | |
93 | wise, another type can be entered which will be used | |
94 | instead. Thus, in the above case, the user will be queried | |
95 | on a plugboard port as to whether they are actually using an | |
96 | _\ba_\bd_\bm_\b3_\ba. | |
97 | ||
98 | If no mapping applies and a final _\bt_\by_\bp_\be option, not preceded | |
99 | by a -\b-m\bm, is given on the command line then that type is | |
100 | used; otherwise the type found in the /_\be_\bt_\bc/_\bt_\bt_\by_\bs database | |
101 | will be taken to be the terminal type. This should always | |
102 | be the case for hardwired ports. | |
103 | ||
104 | It is usually desirable to return the terminal type, as | |
105 | finally determined by _\bt_\bs_\be_\bt, and information about the | |
106 | terminal's capabilities to a shell's environment. This can | |
107 | be done using the -\b- option; using the Bourne shell, _\bs_\bh(1): | |
108 | ||
109 | export TERM; TERM=`tset - _\bo_\bp_\bt_\bi_\bo_\bn_\bs...` | |
110 | ||
111 | or using the C shell, _\bc_\bs_\bh(1): | |
112 | ||
113 | setenv TERM `tset - _\bo_\bp_\bt_\bi_\bo_\bn_\bs...` | |
114 | ||
115 | With _\bc_\bs_\bh it is preferable to use the following command in | |
116 | your .login file to initialize the TERM and TERMCAP environ- | |
117 | ment variables at the same time. | |
118 | ||
119 | eval `tset -s _\bo_\bp_\bt_\bi_\bo_\bn_\bs...` | |
120 | ||
121 | It is also convenient to make an alias in your .cshrc: | |
122 | ||
123 | alias tset 'eval `tset -s \!*`' | |
124 | ||
125 | ||
126 | ||
127 | ||
128 | ||
129 | Printed 7/9/88 May 5, 1986 2 | |
130 | ||
131 | ||
132 | ||
133 | ||
134 | ||
135 | ||
136 | TSET(1) UNIX Programmer's Manual TSET(1) | |
137 | ||
138 | ||
139 | ||
140 | This allows the command: | |
141 | ||
142 | tset 2621 | |
143 | ||
144 | to be invoked at any time to set the terminal and environ- | |
145 | ment. N\bNo\bot\bte\be t\bto\bo B\bBo\bou\bur\brn\bne\be S\bSh\bhe\bel\bll\bl u\bus\bse\ber\brs\bs:\b: It is n\bno\bot\bt possible to get | |
146 | this aliasing effect with a shell script, because shell | |
147 | scripts cannot set the environment of their parent. (If a | |
148 | process could set its parent's environment, none of this | |
149 | nonsense would be necessary in the first place.) | |
150 | ||
151 | These commands cause _\bt_\bs_\be_\bt to place the name of your terminal | |
152 | in the variable TERM in the environment; see _\be_\bn_\bv_\bi_\br_\bo_\bn(7). | |
153 | ||
154 | Once the terminal type is known, _\bt_\bs_\be_\bt engages in terminal | |
155 | driver mode setting. This normally involves sending an ini- | |
156 | tialization sequence to the terminal, setting the single | |
157 | character erase (and optionally the line-kill (full line | |
158 | erase)) characters, and setting special character delays. | |
159 | Tab and newline expansion are turned off during transmission | |
160 | of the terminal initialization sequence. | |
161 | ||
162 | On terminals that can backspace but not overstrike (such as | |
163 | a CRT), and when the erase character is the default erase | |
164 | character (`#' on standard systems), the erase character is | |
165 | changed to BACKSPACE (Control-H). | |
166 | ||
167 | The options are: | |
168 | ||
169 | -\b-e\be_\bc set the erase character to be the named character _\bc on | |
170 | all terminals, the default being the backspace charac- | |
171 | ter on the terminal, usually ^H. The character _\bc can | |
172 | either be typed directly, or entered using the hat | |
173 | notation used here. | |
174 | ||
175 | -\b-k\bk_\bc is similar to -\b-e\be but for the line kill character rather | |
176 | than the erase character; _\bc defaults to ^X (for purely | |
177 | historical reasons). The kill characters is left alone | |
178 | if -\b-k\bk is not specified. The hat notation can also be | |
179 | used for this option. | |
180 | ||
181 | -\b-i\bi_\bc is similar to -\b-e\be but for the interrupt character rather | |
182 | than the erase character; _\bc defaults to ^C. The hat | |
183 | notation can also be used for this option. | |
184 | ||
185 | -\b- The name of the terminal finally decided upon is output | |
186 | on the standard output. This is intended to be cap- | |
187 | tured by the shell and placed in the environment vari- | |
188 | able TERM. | |
189 | ||
190 | -\b-s\bs Print the sequence of _\bc_\bs_\bh commands to initialize the | |
191 | environment variables TERM and TERMCAP based on the | |
192 | ||
193 | ||
194 | ||
195 | Printed 7/9/88 May 5, 1986 3 | |
196 | ||
197 | ||
198 | ||
199 | ||
200 | ||
201 | ||
202 | TSET(1) UNIX Programmer's Manual TSET(1) | |
203 | ||
204 | ||
205 | ||
206 | name of the terminal finally decided upon. | |
207 | ||
208 | -\b-n\bn On systems with the Berkeley 4BSD tty driver, specifies | |
209 | that the new tty driver modes should be initialized for | |
210 | this terminal. For a CRT, the CRTERASE and CRTKILL | |
211 | modes are set only if the baud rate is 1200 or greater. | |
212 | See tty(4) for more detail. | |
213 | ||
214 | -\b-I\bI suppresses transmitting terminal initialization | |
215 | strings. | |
216 | ||
217 | -\b-Q\bQ suppresses printing the ``Erase set to'' and ``Kill set | |
218 | to'' messages. | |
219 | ||
220 | If t\bts\bse\bet\bt is invoked as r\bre\bes\bse\bet\bt, it will set cooked and echo | |
221 | modes, turn off cbreak and raw modes, turn on newline trans- | |
222 | lation, and restore special characters to a sensible state | |
223 | before any terminal dependent processing is done. Any spe- | |
224 | cial character that is found to be NULL or ``-1'' is reset | |
225 | to its default value. All arguments to _\bt_\bs_\be_\bt may be used | |
226 | with reset. | |
227 | ||
228 | This is most useful after a program dies leaving a terminal | |
229 | in a funny state. You may have to type ``<LF>reset<LF>'' to | |
230 | get it to work since <CR> may not work in this state. Often | |
231 | none of this will echo. | |
232 | ||
233 | E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS | |
234 | These examples all assume the Bourne shell and use the - | |
235 | option. If you use _\bc_\bs_\bh, use one of the variations described | |
236 | above. Note that a typical use of _\bt_\bs_\be_\bt in a .profile or | |
237 | .login will also use the -\b-e\be and -\b-k\bk options, and often the -\b-n\bn | |
238 | or -\b-Q\bQ options as well. These options have not been included | |
239 | here to keep the examples small. (N\bNO\bOT\bTE\bE:\b: some of the exam- | |
240 | ples given here appear to take up more than one line, for | |
241 | text processing reasons. When you type in real _\bt_\bs_\be_\bt com- | |
242 | mands, you must enter them entirely on one line.) | |
243 | ||
244 | At the moment, you are on a 2621. This is suitable for typ- | |
245 | ing by hand but not for a .profile, unless you are _\ba_\bl_\bw_\ba_\by_\bs on | |
246 | a 2621. | |
247 | ||
248 | export TERM; TERM=`tset - 2621` | |
249 | ||
250 | You have an h19 at home which you dial up on, but your | |
251 | office terminal is hardwired and known in /etc/ttys. | |
252 | ||
253 | export TERM; TERM=`tset - -m dialup:h19` | |
254 | ||
255 | You have a switch which connects everything to everything, | |
256 | making it nearly impossible to key on what port you are com- | |
257 | ing in on. You use a vt100 in your office at 9600 baud, and | |
258 | ||
259 | ||
260 | ||
261 | Printed 7/9/88 May 5, 1986 4 | |
262 | ||
263 | ||
264 | ||
265 | ||
266 | ||
267 | ||
268 | TSET(1) UNIX Programmer's Manual TSET(1) | |
269 | ||
270 | ||
271 | ||
272 | dial up to switch ports at 1200 baud from home on a 2621. | |
273 | Sometimes you use someone elses terminal at work, so you | |
274 | want it to ask you to make sure what terminal type you have | |
275 | at high speeds, but at 1200 baud you are always on a 2621. | |
276 | Note the placement of the question mark, and the quotes to | |
277 | protect the greater than and question mark from interpreta- | |
278 | tion by the shell. | |
279 | ||
280 | export TERM; TERM=`tset - -m 'switch>1200:?vt100' -m | |
281 | 'switch<=1200:2621' | |
282 | ||
283 | All of the above entries will fall back on the terminal type | |
284 | specified in /_\be_\bt_\bc/_\bt_\bt_\by_\bs if none of the conditions hold. The | |
285 | following entry is appropriate if you always dial up, always | |
286 | at the same baud rate, on many different kinds of terminals. | |
287 | Your most common terminal is an adm3a. It always asks you | |
288 | what kind of terminal you are on, defaulting to adm3a. | |
289 | ||
290 | export TERM; TERM=`tset - ?adm3a` | |
291 | ||
292 | If the file /_\be_\bt_\bc/_\bt_\bt_\by_\bs is not properly installed and you want | |
293 | to key entirely on the baud rate, the following can be used: | |
294 | ||
295 | export TERM; TERM=`tset - -m '>1200:vt100' 2621` | |
296 | ||
297 | Here is a fancy example to illustrate the power of _\bt_\bs_\be_\bt and | |
298 | to hopelessly confuse anyone who has made it this far. You | |
299 | dial up at 1200 baud or less on a concept100, sometimes over | |
300 | switch ports and sometimes over regular dialups. You use | |
301 | various terminals at speeds higher than 1200 over switch | |
302 | ports, most often the terminal in your office, which is a | |
303 | vt100. However, sometimes you log in from the university | |
304 | you used to go to, over the ARPANET; in this case you are on | |
305 | an ALTO emulating a dm2500. You also often log in on vari- | |
306 | ous hardwired ports, such as the console, all of which are | |
307 | properly entered in /_\be_\bt_\bc/_\bt_\bt_\by_\bs. You want your erase charac- | |
308 | ter set to control H, your kill character set to control U, | |
309 | and don't want _\bt_\bs_\be_\bt to print the ``Erase set to Backspace, | |
310 | Kill set to Control U'' message. | |
311 | ||
312 | export TERM; TERM=`tset -e -k^U -Q - -m | |
313 | 'switch<=1200:concept100' -m 'switch:?vt100' -m | |
314 | dialup:concept100 -m arpanet:dm2500` | |
315 | ||
316 | F\bFI\bIL\bLE\bES\bS | |
317 | /etc/ttys port name to terminal type mapping database | |
318 | /etc/termcap terminal capability database | |
319 | ||
320 | S\bSE\bEE\bE A\bAL\bLS\bSO\bO | |
321 | csh(1), sh(1), stty(1), ttys(5), termcap(5), environ(7) | |
322 | ||
323 | ||
324 | ||
325 | ||
326 | ||
327 | Printed 7/9/88 May 5, 1986 5 | |
328 | ||
329 | ||
330 | ||
331 | ||
332 | ||
333 | ||
334 | TSET(1) UNIX Programmer's Manual TSET(1) | |
335 | ||
336 | ||
337 | ||
338 | B\bBU\bUG\bGS\bS | |
339 | The _\bt_\bs_\be_\bt command is one of the first commands a user must | |
340 | master when getting started on a UNIX system. Unfor- | |
341 | tunately, it is one of the most complex, largely because of | |
342 | the extra effort the user must go through to get the | |
343 | environment of the login shell set. Something needs to be | |
344 | done to make all this simpler, either the _\bl_\bo_\bg_\bi_\bn(1) program | |
345 | should do this stuff, or a default shell alias should be | |
346 | made, or a way to set the environment of the parent should | |
347 | exist. | |
348 | ||
349 | This program can't intuit personal choices for erase, inter- | |
350 | rupt and line kill characters, so it leaves these set to the | |
351 | local system standards. | |
352 | ||
353 | ||
354 | ||
355 | ||
356 | ||
357 | ||
358 | ||
359 | ||
360 | ||
361 | ||
362 | ||
363 | ||
364 | ||
365 | ||
366 | ||
367 | ||
368 | ||
369 | ||
370 | ||
371 | ||
372 | ||
373 | ||
374 | ||
375 | ||
376 | ||
377 | ||
378 | ||
379 | ||
380 | ||
381 | ||
382 | ||
383 | ||
384 | ||
385 | ||
386 | ||
387 | ||
388 | ||
389 | ||
390 | ||
391 | ||
392 | ||
393 | Printed 7/9/88 May 5, 1986 6 | |
394 | ||
395 | ||
396 |