1 .\" Copyright (c) 1985, 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 4. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)tset.1 8.1 (Berkeley) 6/9/93
37 .Nd terminal initialization
58 utility initializes terminals.
59 It first determines the type of terminal that you are using.
60 This determination is done as follows, using the first terminal type found.
62 .Bl -bullet -compact -offset indent
66 argument specified on the command line.
72 The terminal type associated with the standard error output device in the
76 The default terminal type, ``unknown''.
79 If the terminal type was not specified on the command-line, the
81 option mappings are then applied (see below for more information).
82 Then, if the terminal type begins with a question mark (``?''), the user is
83 prompted for confirmation of the terminal type.
84 An empty response confirms the type, or, another type can be entered to
86 Once the terminal type has been determined, the termcap entry for the terminal
88 If no termcap entry is found for the type, the user is prompted for another
91 Once the termcap entry is retrieved, the window size, backspace, interrupt
92 and line kill characters (among many other things) are set and the terminal
93 and tab initialization strings are sent to the standard error output.
94 Finally, if the erase, interrupt and line kill characters have changed,
95 or are not set to their default values, their values are displayed to the
96 standard error output.
101 sets cooked and echo modes, turns off cbreak and raw modes, turns on
102 newline translation and resets any unset special characters to their
103 default values before doing the terminal initialization described above.
104 This is useful after a program dies leaving a terminal in an abnormal state.
105 Note, you may have to type
107 (the line-feed character is normally control-J) to get the terminal
108 to work, as carriage-return may no longer work in the abnormal state.
109 Also, the terminal will often not echo the command.
111 The options are as follows:
114 The terminal type is displayed to the standard output, and the terminal is
115 not initialized in any way.
117 Set the erase character to
120 Do not send the terminal or tab initialization strings to the terminal.
122 Set the interrupt character to
125 Set the line kill character to
128 Specify a mapping from a port type to a terminal.
129 See below for more information.
131 Do not display any values for the erase, interrupt and line kill characters.
133 Print the terminal type to the standard error output.
135 Print the terminal type and the termcap entry to the standard output.
136 See the section below on setting the environment for details.
138 Print the sequence of shell commands to initialize the environment variables
142 to the standard output.
143 See the section below on setting the environment for details.
146 The arguments for the
151 options may either be entered as actual characters or by using the
153 notation, i.e., control-h may be specified as
157 .Sh SETTING THE ENVIRONMENT
158 It is often desirable to enter the terminal type and information about
159 the terminal's capabilities into the shell's environment.
160 This is done using the
168 option is specified, the terminal type and the termcap entry are written
169 to the standard output, separated by a space and without a terminating
171 This can be assigned to an array by
175 users and then used like any other shell array.
179 option is specified, the commands to enter the information into the
180 shell's environment are written to the standard output.
183 environment variable ends in ``csh'', the commands are for the
185 otherwise, they are for
189 commands set and unset the shell variable
192 The following line in the
196 files will initialize the environment correctly:
197 .Bd -literal -offset indent
198 eval \`tset -s options ... \`
201 To demonstrate a simple use of the
203 option, the following lines in the
205 file have an equivalent effect:
206 .Bd -literal -offset indent
208 set term=(`tset -S options ...`)
210 setenv TERMCAP "$term[2]"
214 .Sh TERMINAL TYPE MAPPING
215 When the terminal is not hardwired into the system (or the current system
216 information is incorrect) the terminal type derived from the
220 environment variable is often something generic like
227 is used in a startup script
235 users) it is often desirable to provide information about the type of
236 terminal used on such ports.
241 from some set of conditions to a terminal type, that is, to
244 ``If I'm on this port at a particular speed, guess that I'm on that
249 option consists of an optional port type, an optional operator, an optional
250 baud rate specification, an optional colon (``:'') character and a terminal
252 The port type is a string (delimited by either the operator or the colon
254 The operator may be any combination of:
268 inverts the sense of the test.
269 The baud rate is specified as a number and is compared with the speed
270 of the standard error output (which should be the control terminal).
271 The terminal type is a string.
273 If the terminal type is not specified on the command line, the
275 mappings are applied to the terminal type.
276 If the port type and baud rate match the mapping, the terminal type specified
277 in the mapping replaces the current type.
278 If more than one mapping is specified, the first applicable mapping is used.
280 For example, consider the following mapping:
281 .Dq Li dialup>9600:vt100 .
286 the baud rate specification is
288 and the terminal type is
290 The result of this mapping is to specify that if the terminal type is
292 and the baud rate is greater than 9600 baud, a terminal type of
296 If no port type is specified, the terminal type will match any port type,
298 .Dq Li -m dialup:vt100 -m :?xterm
299 will cause any dialup port, regardless of baud rate, to match the terminal
302 and any non-dialup port type to match the terminal type
304 Note, because of the leading question mark, the user will be
305 queried on a default port as to whether they are actually using an
309 No whitespace characters are permitted in the
312 Also, to avoid problems with metacharacters, it is suggested that the entire
314 option argument be placed within single quote characters, and that
316 users insert a backslash character (``\e'') before any exclamation
325 environment variables.
327 .Bl -tag -width /usr/share/misc/termcap -compact
329 system port name to terminal type mapping database
330 .It Pa /usr/share/misc/termcap
331 terminal capability database
341 options have been deleted from the
344 None of them were documented in
346 and all are of limited utility at
353 options are similarly not documented or useful, but were retained as they
354 appear to be in widespread use.
355 It is strongly recommended that any usage of these three options be
361 option remains, but has no effect.
362 It is still permissible to specify the
367 options without arguments, although it is strongly recommended that such
368 usage be fixed to explicitly specify the character.
374 no longer implies the
377 Also, the interaction between the
381 argument in some historic implementations of
387 implementation has been completely redone (as part of the addition to the
390 compliant terminal interface) and will no longer compile on systems with
391 older terminal interfaces.
405 utilities first appeared in
409 The original version of
415 was originally written by
417 The current version also contains code by
418 .An Zeyd M. Ben-Halim ,
419 .An Eric S. Raymond ,
421 .An Thomas E. Dickey .