Commit | Line | Data |
---|---|---|
b5dc1377 | 1 | .\" Copyright (c) 1985, 1990 The Regents of the University of California. |
2088f2bf | 2 | .\" All rights reserved. |
2bcbe3d6 | 3 | .\" |
263cc8fc | 4 | .\" %sccs.include.redist.roff% |
2088f2bf | 5 | .\" |
81ee81b5 | 6 | .\" @(#)tset.1 6.8 (Berkeley) %G% |
2bcbe3d6 | 7 | .\" |
b5dc1377 CL |
8 | .Dd |
9 | .Dt TSET 1 | |
10 | .Os BSD 4 | |
11 | .Sh NAME | |
12 | .Nm tset | |
81ee81b5 | 13 | .Nd terminal initialization |
b5dc1377 CL |
14 | .Sh SYNOPSIS |
15 | .Nm tset | |
81ee81b5 KB |
16 | .Op Fl IQs |
17 | .Op Fl | |
18 | .Op Fl e Ar ch | |
19 | .Op Fl i Ar ch | |
20 | .Op Fl k Ar ch | |
21 | .Op Fl m Ar mapping | |
22 | .Op Ar terminal | |
23 | .br | |
b5dc1377 | 24 | .Nm reset |
81ee81b5 KB |
25 | .Op Fl IQs |
26 | .Op Fl | |
27 | .Op Fl e Ar ch | |
28 | .Op Fl i Ar ch | |
29 | .Op Fl k Ar ch | |
30 | .Op Fl m Ar mapping | |
31 | .Op Ar terminal | |
b5dc1377 CL |
32 | .Sh DESCRIPTION |
33 | .Nm Tset | |
81ee81b5 KB |
34 | initializes terminals. |
35 | .Nm Tset | |
36 | first determines the type of terminal that you are using. | |
37 | This determination is done as follows, using the first terminal type found. | |
38 | .sp | |
39 | .Bl -bullet -compact -offset indent | |
40 | .It | |
41 | The | |
42 | .Ar terminal | |
43 | argument specified on the command line. | |
44 | .It | |
45 | The value of the | |
46 | .Ev TERM | |
47 | environmental variable. | |
48 | .It | |
49 | The terminal type associated with the standard error output device in the | |
50 | .Pa /etc/ttys | |
51 | file. | |
52 | .It | |
53 | The default terminal type, ``unknown''. | |
54 | .El | |
55 | .Pp | |
56 | If the terminal type was not specified on the command-line, the | |
57 | .Fl m | |
58 | option mappings are then applied (see below for more information). | |
59 | Then, if the terminal type begins with a question mark (``?''), the user is | |
60 | prompted for confirmation of the terminal type. | |
61 | An empty response confirms the type, or, another type can be entered to | |
62 | specify a new type. | |
63 | Once the terminal type has been determined, the termcap entry for the terminal | |
64 | is retrieved. | |
65 | If no termcap entry is found for the type, the user is prompted for another | |
66 | terminal type. | |
b5dc1377 | 67 | .Pp |
81ee81b5 KB |
68 | Once the termcap entry is retrieved, the window size, backspace, interrupt |
69 | and line kill characters (among many other things) are set and the terminal | |
70 | and tab initialization strings are sent to the standard error output. | |
71 | Finally, if the erase, interrupt and line kill characters have changed, | |
72 | or are not set to their default values, their values are displayed to the | |
73 | standard error output. | |
74 | .Pp | |
75 | When invoked as | |
76 | .Nm reset , | |
b5dc1377 | 77 | .Nm tset |
81ee81b5 KB |
78 | sets cooked and echo modes, turns off cbreak and raw modes, turns on |
79 | newline translation and resets any unset special characters to their | |
80 | default values before doing the terminal initialization described above. | |
81 | This is useful after a program dies leaving a terminal in a abnormal state. | |
82 | Note, you may have to type | |
83 | .Dq Li <LF>reset<LF> | |
84 | (the line-feed character is normally control-J) to get the terminal | |
85 | to work, as carriage-return may no longer work in the abnormal state. | |
86 | Also, the terminal will often not echo the command. | |
b5dc1377 | 87 | .Pp |
81ee81b5 | 88 | The options are as follows: |
263cc8fc | 89 | .Bl -tag -width flag |
263cc8fc | 90 | .It Fl |
81ee81b5 KB |
91 | The terminal type is displayed to the standard output, and the terminal is |
92 | not initialized in any way. | |
93 | .It Fl e | |
94 | Set the erase character to | |
95 | .Ar ch . | |
96 | .It Fl I | |
97 | Do not send the terminal or tab initialization strings to the terminal. | |
98 | .It Fl i | |
99 | Set the interrupt character to | |
100 | .Ar ch . | |
101 | .It Fl k | |
102 | Set the line kill character to | |
103 | .Ar ch . | |
104 | .It Fl m | |
105 | Specify a mapping from a port type to a terminal. | |
106 | See below for more information. | |
263cc8fc | 107 | .It Fl s |
81ee81b5 | 108 | Print the sequence of shell commands to initialize the environment variables |
b5dc1377 CL |
109 | .Ev TERM |
110 | and | |
111 | .Ev TERMCAP | |
81ee81b5 | 112 | to the standard output. |
263cc8fc | 113 | .It Fl Q |
81ee81b5 | 114 | Don't display any values for the erase, interrupt and line kill characters. |
263cc8fc | 115 | .El |
b5dc1377 | 116 | .Pp |
81ee81b5 KB |
117 | The arguments for the |
118 | .Fl e , | |
119 | .Fl i | |
120 | and | |
121 | .Fl k | |
122 | options may either be entered as actual characters or by using the | |
123 | .Dq hat | |
124 | notation, i.e. control-h may be specified as | |
125 | .Dq Li ^H | |
126 | or | |
127 | .Dq Li ^h . | |
128 | .Sh SETTING THE ENVIRONMENT | |
129 | It is often desirable to set the terminal type and information about the | |
130 | terminal's capabilities in the shell's environment. | |
131 | This is done with the | |
132 | .Fl s | |
133 | option; when this option is specified, the commands to enter the information | |
134 | into the shell's environment are output to the standard output. | |
135 | If the | |
136 | .Ev SHELL | |
137 | environmental variable ends in ``csh'', the output commands are for the | |
138 | .Xr csh 1 , | |
139 | otherwise, they are for | |
140 | .Xr sh 1 . | |
141 | Note, the output commands for the | |
142 | .Nm csh | |
143 | set and unset the shell variable | |
144 | .Dq noglob . | |
145 | The following line in the | |
146 | .Pa .login | |
147 | or | |
148 | .Pa .profile | |
149 | files will initialize the environment correctly: | |
150 | .Bd -literal -offset indent | |
151 | eval \`tset -s options ... \` | |
152 | .Ed | |
153 | .Sh TERMINAL TYPE MAPPING | |
154 | When the terminal is not hardwired into the system (or the current system | |
155 | information is incorrect) the terminal type derived from the | |
156 | .Pa /etc/ttys | |
157 | file or the | |
158 | .Ev TERM | |
159 | environmental variable is often something generic like | |
160 | .Dq network , | |
161 | .Dq dialup , | |
162 | or | |
163 | .Dq unknown . | |
164 | When | |
165 | .Nm tset | |
166 | is used in a startup script | |
263cc8fc | 167 | .Pf ( Pa .profile |
b5dc1377 | 168 | for |
81ee81b5 | 169 | .Xr sh 1 |
52309911 | 170 | users or |
263cc8fc | 171 | .Pa .login |
52309911 | 172 | for |
263cc8fc | 173 | .Xr csh 1 |
81ee81b5 KB |
174 | users) it is often desirable to provide information about the type of |
175 | terminal used on such ports. | |
176 | The purpose of the | |
b5dc1377 | 177 | .Fl m |
81ee81b5 KB |
178 | option is to |
179 | .Dq map | |
180 | from some set of conditions to a terminal type, that is, to | |
181 | tell | |
b5dc1377 | 182 | .Nm tset |
81ee81b5 KB |
183 | ``If I'm on this port at a particular speed, guess that I'm on that |
184 | kind of terminal''. | |
b5dc1377 | 185 | .Pp |
81ee81b5 | 186 | The argument to the |
b5dc1377 | 187 | .Fl m |
81ee81b5 KB |
188 | option consists of an optional port type, an optional operator, an optional |
189 | baud rate specification, an optional colon (``:'') character and a terminal | |
190 | type. | |
191 | The port type is a string (delimited by either the operator or the colon | |
192 | character). | |
193 | The operator may be any combination of: | |
194 | .Dq Li \&> , | |
195 | .Dq Li \&< , | |
196 | .Dq Li \&@ , | |
b5dc1377 | 197 | and |
81ee81b5 KB |
198 | .Dq Li \&! ; |
199 | .Dq Li \&> | |
200 | means greater than, | |
201 | .Dq Li \&< | |
202 | means less than, | |
203 | .Dq Li \&@ | |
204 | means equal to | |
52309911 | 205 | and |
81ee81b5 KB |
206 | .Dq Li \&! |
207 | inverts the sense of the test. | |
208 | The baud rate is specified as a number and is compared with the speed | |
209 | of the standard error output (which should be the control terminal). | |
210 | The terminal type is a string. | |
b5dc1377 | 211 | .Pp |
81ee81b5 KB |
212 | If the terminal type is not specified on the command line, the |
213 | .Fl m | |
214 | mappings are applied to the terminal type. | |
215 | If the port type and baud rate match the mapping, the terminal type specified | |
216 | in the mapping replaces the current type. | |
217 | If more than one mapping is specified, the first applicable mapping is used. | |
b5dc1377 | 218 | .Pp |
81ee81b5 KB |
219 | For example, consider the following: |
220 | .Dq Li dialup>9600:vt100 . | |
221 | The port type is | |
222 | .Dq Li dialup , | |
223 | the operator is | |
224 | .Dq Li > , | |
225 | the baud rate specification is | |
226 | .Dq Li 9600 , | |
227 | and the terminal type is | |
228 | .Dq Li vt100 . | |
229 | The result of this mapping is to specify that if the terminal type is | |
230 | .Dq Li dialup , | |
231 | and the baud rate is greater than 9600 baud, a terminal type of | |
232 | .Dq Li vt100 | |
233 | will be used. | |
b5dc1377 | 234 | .Pp |
81ee81b5 KB |
235 | If no port type is specified, the terminal type will match any port type, |
236 | for example, | |
237 | .Dq Li -m dialup:vt100 -m :?xterm | |
238 | will cause any dialup port, regardless of baud rate, to match the terminal | |
239 | type | |
240 | .Dq Li vt100 , | |
241 | and any non-dialup port type to match the terminal type | |
242 | .Dq Li ?xterm . | |
243 | Note, because of the leading question mark, the user will be | |
244 | queried on a default port as to whether they are actually using an | |
245 | .Ar xterm | |
246 | terminal. | |
b5dc1377 | 247 | .Pp |
81ee81b5 KB |
248 | No whitespace characters are permitted in the |
249 | .Fl m | |
250 | option argument. | |
251 | A missing port type matches all port types. | |
252 | To avoid problems with metacharacters, it is best to place the entire | |
253 | .Fl m | |
254 | option within single quote characters. | |
255 | .Nm Csh | |
256 | users normally must also place a backslash character (``\e'') before any | |
257 | exclamation marks (``!''). | |
b5dc1377 CL |
258 | .Sh ENVIRONMENT |
259 | The | |
260 | .Nm tset | |
261 | command utilizes the | |
81ee81b5 | 262 | .Ev SHELL , |
b5dc1377 CL |
263 | .Ev TERM |
264 | and | |
265 | .Ev TERMCAP | |
266 | environment variables. | |
267 | .Sh FILES | |
263cc8fc CL |
268 | .Bl -tag -width /usr/share/misc/termcap -compact |
269 | .It Pa /etc/ttys | |
81ee81b5 | 270 | system port name to terminal type mapping database |
263cc8fc | 271 | .It Pa /usr/share/misc/termcap |
b5dc1377 | 272 | terminal capability database |
263cc8fc | 273 | .El |
b5dc1377 CL |
274 | .Sh SEE ALSO |
275 | .Xr csh 1 , | |
276 | .Xr sh 1 , | |
277 | .Xr stty 1 , | |
81ee81b5 | 278 | .Xr tty 4 , |
b5dc1377 | 279 | .Xr termcap 5 , |
81ee81b5 | 280 | .Xr ttys 5 , |
b5dc1377 CL |
281 | .Xr environ 7 |
282 | .Sh HISTORY | |
263cc8fc CL |
283 | The |
284 | .Nm tset | |
285 | command appeared in | |
286 | .Bx 3.0 . | |
81ee81b5 KB |
287 | .Sh COMPATIBILITY |
288 | The historic | |
289 | .Fl A , | |
290 | .Fl a , | |
291 | .Fl d , | |
292 | .Fl E , | |
293 | .Fl h , | |
294 | .Fl p , | |
295 | .Fl r , | |
296 | .Fl S , | |
297 | .Fl u | |
298 | and | |
299 | .Fl v | |
300 | options have been deleted from the | |
301 | .Nm tset | |
302 | utility. | |
303 | None of these flags were documented in 4.3BSD and all are of limited | |
304 | utility at best. | |
305 | Executing | |
306 | .Nm tset | |
307 | as | |
308 | .Nm reset | |
309 | no longer implies the | |
310 | .Fl Q | |
311 | option. | |
52309911 | 312 | The |
81ee81b5 KB |
313 | .Fl n |
314 | option remains, but has no effect. | |
315 | .Pp | |
316 | It is still permissible to specify the | |
317 | .Fl e , | |
318 | .Fl i | |
319 | and | |
320 | .Fl k | |
321 | options without arguments, although it is strongly recommended that such | |
322 | usage be fixed to conform to | |
323 | .Xr getopt 3 . | |
324 | Also, some historic implementations of | |
b5dc1377 | 325 | .Nm tset |
81ee81b5 KB |
326 | had an interaction between the |
327 | .Fl | |
328 | option and the | |
329 | .Ar terminal | |
330 | argument. | |
331 | This is no longer true. | |
b5dc1377 | 332 | .Pp |
81ee81b5 KB |
333 | Finally, the |
334 | .Nm tset | |
335 | implementation has been completely redone as part of the addition to the | |
336 | system of a | |
337 | .St -p1003.1-88 | |
338 | compliant terminal interface, and will no longer compile on systems with | |
339 | older terminal interfaces. |