Commit | Line | Data |
---|---|---|
2bcbe3d6 KM |
1 | .\" Copyright (c) 1980 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
ad2558a8 | 5 | .\" @(#)tset.1 6.1 (Berkeley) %G% |
2bcbe3d6 | 6 | .\" |
ad2558a8 | 7 | .TH TSET 1 "" |
2bcbe3d6 KM |
8 | .UC 4 |
9 | .SH NAME | |
52309911 | 10 | tset \- terminal dependent initialization |
2bcbe3d6 KM |
11 | .SH SYNOPSIS |
12 | .B tset | |
52309911 | 13 | [ options ] [ |
2bcbe3d6 | 14 | .B \-m |
52309911 KM |
15 | [ident][test baudrate]:type ] \&... [ type ] |
16 | .sp 1 | |
17 | .B reset | |
2bcbe3d6 | 18 | \&... |
2bcbe3d6 KM |
19 | .SH DESCRIPTION |
20 | .I Tset | |
52309911 KM |
21 | sets up your terminal when you first log in to a UNIX system. |
22 | It does terminal dependent processing such as setting | |
2bcbe3d6 | 23 | erase and kill characters, setting or resetting delays, |
52309911 | 24 | sending any sequences needed to properly initialized the terminal, |
2bcbe3d6 KM |
25 | and the like. |
26 | It first determines the | |
27 | .I type | |
52309911 KM |
28 | of terminal involved, |
29 | and then does necessary initializations and mode settings. | |
30 | The type of terminal attached to each \s-2UNIX\s0 port is specified in the | |
ad2558a8 | 31 | .IR /etc/ttys (5) |
52309911 KM |
32 | database. |
33 | Type names for terminals may be found in the | |
34 | .IR termcap (5) | |
35 | database. | |
36 | If a port is not wired permanently to a specific terminal (not hardwired) | |
37 | it will be given an appropriate generic identifier such as | |
38 | .IR dialup . | |
39 | .PP | |
40 | In the case where no arguments are specified, | |
2bcbe3d6 KM |
41 | .I tset |
42 | simply reads the terminal type out of the environment variable TERM | |
43 | and re-initializes the terminal. The rest of this manual concerns | |
52309911 KM |
44 | itself with mode and environment initialization, |
45 | typically done once at login, and options | |
2bcbe3d6 KM |
46 | used at initialization time to determine the terminal type and set up |
47 | terminal modes. | |
48 | .PP | |
52309911 | 49 | When used in a startup script (\fI\&.profile\fR for |
2bcbe3d6 | 50 | .IR sh (1) |
52309911 | 51 | users or |
2bcbe3d6 | 52 | .I \&.login |
52309911 | 53 | for |
2bcbe3d6 | 54 | .IR csh (1) |
52309911 KM |
55 | users) it is desirable to give information about the type of terminal |
56 | you will usually use on ports which are not hardwired. | |
57 | These ports are identified in | |
ad2558a8 | 58 | .I /etc/ttys |
52309911 | 59 | as |
2bcbe3d6 KM |
60 | .I dialup |
61 | or | |
62 | .I plugboard | |
63 | or | |
52309911 | 64 | .I arpanet, |
2bcbe3d6 KM |
65 | etc. |
66 | To specify | |
52309911 | 67 | what terminal type you usually use on these ports, the |
2bcbe3d6 | 68 | .B \-m |
52309911 KM |
69 | (map) option flag is followed by the appropriate port type identifier, |
70 | an optional baud rate specification, | |
71 | and the terminal type. | |
72 | (The effect is to ``map'' from some conditions to a terminal type, | |
73 | that is, to tell | |
74 | .I tset | |
75 | ``If I'm on this kind of port, guess that I'm on that kind of terminal''.) | |
2bcbe3d6 | 76 | If more than one mapping is specified, the first applicable mapping prevails. |
52309911 KM |
77 | A missing port type identifier matches all identifiers. |
78 | Any of the alternate generic names given in | |
79 | .I termcap | |
80 | may be used for the identifier. | |
2bcbe3d6 | 81 | .PP |
52309911 KM |
82 | A |
83 | .I baudrate | |
84 | is specified as with | |
2bcbe3d6 | 85 | .IR stty (1), |
52309911 KM |
86 | and is compared with the |
87 | speed of the diagnostic output (which should be the control terminal). | |
88 | The baud rate | |
89 | .I test | |
90 | may be any combination of: | |
91 | .BR > , | |
92 | .BR @ , | |
93 | .BR < , | |
2bcbe3d6 | 94 | and |
52309911 | 95 | .BR ! ; |
2bcbe3d6 | 96 | .B @ |
52309911 | 97 | means ``at'' |
2bcbe3d6 KM |
98 | and |
99 | .B ! | |
100 | inverts the sense of the test. To avoid problems with metacharacters, it | |
101 | is best to place the entire argument to | |
102 | .B \-m | |
103 | within ``\''' characters; users of | |
104 | .IR csh (1) | |
105 | must also put a ``\e'' before any ``!'' used here. | |
106 | .PP | |
52309911 | 107 | .KS |
2bcbe3d6 KM |
108 | Thus |
109 | .IP | |
52309911 KM |
110 | tset \-m \'dialup>300:adm3a\' -m dialup:dw2 -m \'plugboard:?adm3a\' |
111 | .KE | |
2bcbe3d6 KM |
112 | .LP |
113 | causes the terminal type to be set to an | |
114 | .I adm3a | |
115 | if the port in use is a dialup at a speed greater than 300 baud; | |
116 | to a | |
117 | .I dw2 | |
118 | if the port is (otherwise) a dialup (i.e. at 300 baud or less). | |
52309911 KM |
119 | (\fBNOTE:\fP the examples given here appear to take up more than |
120 | one line, for text processing reasons. When you type in real | |
121 | .I tset | |
122 | commands, you must enter them entirely on one line.) | |
2bcbe3d6 KM |
123 | If the |
124 | .I type | |
52309911 KM |
125 | finally determined by |
126 | .I tset | |
127 | begins with a question mark, | |
2bcbe3d6 KM |
128 | the user is asked if s/he really wants that type. |
129 | A null response means to use that type; | |
130 | otherwise, another type can be entered which will be used instead. | |
52309911 KM |
131 | Thus, in the above case, the user will be queried on a plugboard port |
132 | as to whether they are actually using an | |
133 | .IR adm3a . | |
134 | .PP | |
135 | If no mapping applies and a final | |
2bcbe3d6 | 136 | .I type |
52309911 KM |
137 | option, not preceded by a |
138 | .BR \-m , | |
139 | is given on the command line | |
140 | then that type is used; | |
ad2558a8 KM |
141 | otherwise the type found in the |
142 | .I /etc/ttys | |
52309911 KM |
143 | database will be taken to be the terminal type. |
144 | This should always be the case for hardwired ports. | |
2bcbe3d6 | 145 | .PP |
52309911 KM |
146 | It is usually desirable to return the terminal type, as finally determined by |
147 | .IR tset , | |
148 | and information about the terminal's capabilities | |
2bcbe3d6 | 149 | to a shell's environment. This can be done using the |
52309911 | 150 | .B \- |
2bcbe3d6 KM |
151 | option; using the Bourne shell, |
152 | .IR sh (1): | |
153 | .IP | |
52309911 | 154 | export TERM; TERM=\`tset \- \fIoptions...\fR\` |
2bcbe3d6 KM |
155 | .LP |
156 | or using the C shell, | |
157 | .IR csh (1): | |
158 | .IP | |
52309911 KM |
159 | setenv TERM \`tset - \fIoptions...\fR\` |
160 | .PP | |
161 | With | |
162 | .I csh | |
ad2558a8 KM |
163 | it is preferable to use the following command in your .login file to |
164 | initialize the TERM and TERMCAP environment variables at the same time. | |
165 | .IP | |
166 | eval \`tset -s \fIoptions...\fR\` | |
167 | .PP | |
168 | It is also convenient to make an alias in your .cshrc: | |
169 | .IP | |
170 | alias tset \'eval \`tset \-s \e!*\`\' | |
52309911 | 171 | .PP |
ad2558a8 KM |
172 | This allows the command: |
173 | .IP | |
52309911 | 174 | tset 2621 |
ad2558a8 KM |
175 | .PP |
176 | to be invoked at any time to set the terminal and environment. | |
52309911 KM |
177 | .B "Note to Bourne Shell users:" |
178 | It is | |
179 | .B not | |
180 | possible to get this aliasing effect with a shell script, | |
181 | because shell scripts cannot set the environment of their parent. | |
182 | (If a process could set its parent's environment, | |
183 | none of this nonsense would be necessary in the first place.) | |
2bcbe3d6 KM |
184 | .PP |
185 | These commands cause | |
186 | .I tset | |
52309911 KM |
187 | to place the name of your terminal in the variable |
188 | TERM in the environment; see | |
189 | .IR environ (7). | |
2bcbe3d6 KM |
190 | .PP |
191 | Once the terminal type is known, | |
192 | .I tset | |
52309911 | 193 | engages in terminal driver mode setting. |
2bcbe3d6 | 194 | This normally involves sending an initialization sequence to the |
52309911 KM |
195 | terminal, setting the single character erase (and optionally |
196 | the line-kill (full line erase)) characters, | |
197 | and setting special character delays. | |
198 | Tab and newline expansion are turned off during transmission of | |
199 | the terminal initialization sequence. | |
2bcbe3d6 KM |
200 | .PP |
201 | On terminals that can backspace but not overstrike | |
202 | (such as a \s-2CRT\s0), | |
203 | and when the erase character is the default erase character | |
204 | (`#' on standard systems), | |
52309911 | 205 | the erase character is changed to \s-2BACKSPACE\s0 (Control-H). |
2bcbe3d6 KM |
206 | .PP |
207 | The options are: | |
208 | .TP | |
52309911 | 209 | .B \-e\fIc |
2bcbe3d6 KM |
210 | set the erase character to be the named character |
211 | .I c | |
212 | on all terminals, | |
213 | the default being the backspace character on the terminal, usually ^H. | |
52309911 KM |
214 | The character |
215 | .I c | |
216 | can either be typed directly, or entered using the hat | |
217 | notation used here. | |
2bcbe3d6 | 218 | .TP |
52309911 | 219 | .B \-k\fIc |
2bcbe3d6 KM |
220 | is similar to |
221 | .B \-e | |
222 | but for the line kill character rather than the erase character; | |
223 | .I c | |
52309911 KM |
224 | defaults to ^X (for purely historical reasons). |
225 | The kill characters is left alone if | |
2bcbe3d6 KM |
226 | .B \-k |
227 | is not specified. | |
52309911 KM |
228 | The hat notation can also be used for this option. |
229 | .TP | |
230 | .B \- | |
231 | The name of the terminal finally decided upon is output on the | |
232 | standard output. | |
233 | This is intended to be captured by the shell and placed in the | |
234 | environment variable TERM. | |
235 | .TP | |
ad2558a8 KM |
236 | .B \-s |
237 | Print the sequence of | |
238 | .I csh | |
239 | commands to initialize the environment variables TERM and TERMCAP based on | |
240 | the name of the terminal finally decided upon. | |
241 | .TP | |
52309911 KM |
242 | .B \-n |
243 | On systems with the Berkeley 4BSD tty driver, | |
244 | specifies that the new tty driver modes should be initialized for this terminal. | |
245 | For a \s-2CRT\s0, | |
246 | the CRTERASE and CRTKILL | |
247 | modes are set only if the baud rate is 1200 or greater. | |
248 | See tty(4) for more detail. | |
2bcbe3d6 KM |
249 | .TP |
250 | .B \-I | |
52309911 | 251 | suppresses transmitting terminal initialization strings. |
2bcbe3d6 KM |
252 | .TP |
253 | .B \-Q | |
52309911 | 254 | suppresses printing the |
2bcbe3d6 | 255 | ``Erase set to'' and ``Kill set to'' messages. |
52309911 KM |
256 | .PP |
257 | If | |
258 | .B tset | |
259 | is invoked as | |
260 | .BR reset , | |
261 | it will set cooked and echo modes, turn off cbreak and raw modes, | |
262 | turn on newline translation, and restore special characters | |
263 | to a sensible state before any terminal dependent processing is done. | |
264 | Any special character that is found to be \s-2NULL\s0 | |
265 | or ``\-1'' is reset to its default value. | |
266 | .PP | |
267 | This is most useful after a program dies leaving a terminal in a funny | |
268 | state. You may have to type ``\s-2<LF>\s0reset\s-2<LF>\s0'' to get it to work | |
269 | since \s-2<CR>\s0 may not work in this state. Often none of this will echo. | |
270 | .SH EXAMPLES | |
271 | .PP | |
272 | These examples all assume the Bourne shell and use the - option. | |
273 | If you use | |
274 | .IR csh , | |
275 | use one of the variations described above. | |
276 | Note that a typical use of | |
277 | .I tset | |
278 | in a .profile or .login will also use the | |
279 | .B \-e | |
280 | and | |
281 | .B \-k | |
282 | options, and often the | |
283 | .B \-n | |
284 | or | |
285 | .B \-Q | |
286 | options as well. | |
287 | These options have not been included here to keep the examples small. | |
288 | (\fBNOTE:\fP some of the examples given here appear to take up more than | |
289 | one line, for text processing reasons. When you type in real | |
290 | .I tset | |
291 | commands, you must enter them entirely on one line.) | |
292 | .PP | |
293 | At the moment, you are on a 2621. | |
294 | This is suitable for typing by hand but | |
295 | not for a .profile, unless you are | |
296 | .I always | |
297 | on a 2621. | |
298 | .IP | |
299 | export TERM; TERM=\`tset \- 2621\` | |
300 | .PP | |
301 | You have an h19 at home which you dial up on, but your office terminal | |
ad2558a8 | 302 | is hardwired and known in /etc/ttys. |
52309911 KM |
303 | .IP |
304 | export TERM; TERM=\`tset \- \-m dialup:h19\` | |
305 | .PP | |
306 | You have a switch which connects everything to everything, making | |
307 | it nearly impossible to key on what port you are coming in on. | |
308 | You use a vt100 in your office at 9600 baud, and dial up to switch | |
309 | ports at 1200 baud from home on a 2621. | |
310 | Sometimes you use someone elses terminal at work, | |
311 | so you want it to ask you to make sure what terminal | |
312 | type you have at high speeds, but at 1200 baud you are | |
313 | always on a 2621. | |
314 | Note the placement of the question mark, and the quotes | |
315 | to protect the greater than and question mark from | |
316 | interpretation by the shell. | |
317 | .IP | |
318 | export TERM; TERM=\`tset \- \-m 'switch>1200:?vt100' \-m 'switch<=1200:2621' | |
319 | .PP | |
320 | All of the above entries will fall back on the terminal type | |
321 | specified in | |
ad2558a8 | 322 | .I /etc/ttys |
52309911 KM |
323 | if none of the conditions hold. |
324 | The following entry is appropriate if | |
325 | you always dial up, always at the same baud rate, | |
326 | on many different kinds of terminals. | |
327 | Your most common terminal is an adm3a. | |
328 | It always asks you what kind of terminal you are on, | |
329 | defaulting to adm3a. | |
330 | .IP | |
331 | export TERM; TERM=\`tset \- \?adm3a\` | |
332 | .PP | |
333 | If the file | |
ad2558a8 | 334 | .I /etc/ttys |
52309911 KM |
335 | is not properly installed and you want to |
336 | key entirely on the baud rate, the following can be used: | |
337 | .IP | |
338 | export TERM; TERM=\`tset \- \-m '>1200:vt100' 2621\` | |
339 | .PP | |
340 | Here is a fancy example to illustrate the power of | |
341 | .I tset | |
342 | and to hopelessly confuse anyone who has made it this far. | |
343 | You dial up at 1200 baud or less on a concept100, | |
344 | sometimes over switch ports and sometimes over regular dialups. | |
345 | You use various terminals at speeds higher than 1200 over switch ports, | |
346 | most often the terminal in your office, which is a vt100. | |
347 | However, sometimes you log in from the university you used to go to, | |
348 | over the ARPANET; in this case you are on an ALTO emulating a dm2500. | |
349 | You also often log in on various hardwired ports, such as the console, | |
350 | all of which are properly entered in | |
ad2558a8 | 351 | .IR /etc/ttys . |
52309911 KM |
352 | You want your erase character set to control H, |
353 | your kill character set to control U, | |
354 | and don't want | |
355 | .I tset | |
356 | to print the ``Erase set to Backspace, Kill set to Control U'' message. | |
357 | .IP | |
358 | export TERM; TERM=\`tset \-e \-k^U \-Q \- \-m 'switch<=1200:concept100' \-m 'switch:?vt100' \-m dialup:concept100 \-m arpanet:dm2500\` | |
2bcbe3d6 KM |
359 | .SH FILES |
360 | .DT | |
ad2558a8 | 361 | /etc/ttys port name to terminal type mapping database |
2bcbe3d6 KM |
362 | .br |
363 | /etc/termcap terminal capability database | |
364 | .SH SEE\ ALSO | |
ad2558a8 | 365 | csh(1), sh(1), stty(1), ttys(5), termcap(5), environ(7) |
52309911 | 366 | .SH AUTHORS |
2bcbe3d6 | 367 | Eric Allman |
52309911 KM |
368 | .br |
369 | David Wasley | |
370 | .br | |
371 | Mark Horton | |
2bcbe3d6 | 372 | .SH BUGS |
52309911 KM |
373 | .PP |
374 | The | |
375 | .I tset | |
376 | command is one of the first commands a user must master when getting | |
377 | started on a UNIX system. | |
378 | Unfortunately, it is one of the most complex, | |
379 | largely because of the extra effort the user must go through | |
380 | to get the environment of the login shell set. | |
381 | Something needs to be done to make all this simpler, | |
382 | either the | |
383 | .IR login (1) | |
384 | program should do this stuff, | |
385 | or a default shell alias should be made, | |
386 | or a way to set the environment of the parent should exist. | |
387 | .ig | |
2bcbe3d6 KM |
388 | .SH NOTES |
389 | For compatibility with earlier versions of | |
390 | .I tset | |
391 | a number of flags are accepted whose use is discouraged: | |
392 | .TP 10 | |
393 | \fB\-d\fR type | |
394 | equivalent to | |
395 | .B \-m | |
396 | dialup:type | |
397 | .TP 10 | |
398 | \fB\-p\fR type | |
399 | equivalent to | |
400 | .B \-m | |
401 | plugboard:type | |
402 | .TP 10 | |
403 | \fB\-a\fR type | |
404 | equivalent to | |
405 | .B \-m | |
406 | arpanet:type | |
407 | .TP 10 | |
408 | \fB\-E\fR c | |
409 | Sets the erase character to | |
410 | .I c | |
411 | only if the terminal can backspace. | |
412 | .TP 10 | |
413 | \fB\-\fR | |
414 | prints the terminal type on the standard output | |
415 | .TP 10 | |
416 | \fB\-r\fR | |
417 | prints the terminal type on the diagnostic output. | |
52309911 | 418 | .. |