]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/tset.1
ncurses 4.2
[ncurses.git] / man / tset.1
1 .TH tset 1 ""
2 .SH NAME
3 \fBtset\fR - terminal initialization
4 .SH SYNOPSIS
5 tset [-IQqrs] [-] [-e \fIch\fR] [-i \fIch\fR] [-k \fIch\fR] [-m \fImapping\fR] [\fIterminal\fR]
6 .br
7 reset [-IQqrs] [-] [-e \fIch\fR] [-i \fIch\fR] [-k \fIch\fR] [-m \fImapping\fR] [\fIterminal\fR]
8 .SH DESCRIPTION
9 \&\fBTset\fR initializes terminals.
10 \fBTset\fR first determines the type of terminal that you are using.
11 This determination is done as follows, using the first terminal type found.
12 .PP
13 1. The \fBterminal\fR argument specified on the command line.
14 .PP
15 2. The value of the \fBTERM\fR environmental variable.
16 .PP
17 3. (BSD systems only.) The terminal type associated with the standard
18 error output device in the \fI/etc/ttys\fR file.  (On Linux and
19 System-V-like UNIXes, \fIgetty\fR does this job by setting
20 \fBTERM\fR according to the type passed to it by \fI/etc/inittab\fR.)
21 .PP
22 4. The default terminal type, ``unknown''.
23 .PP
24 If the terminal type was not specified on the command-line, the -m
25 option mappings are then applied (see below for more information).
26 Then, if the terminal type begins with a question mark (``?''), the
27 user is prompted for confirmation of the terminal type.  An empty
28 response confirms the type, or, another type can be entered to specify
29 a new type.  Once the terminal type has been determined, the terminfo
30 entry for the terminal is retrieved.  If no terminfo entry is found
31 for the type, the user is prompted for another terminal type.
32 .PP
33 Once the terminfo entry is retrieved, the window size, backspace, interrupt
34 and line kill characters (among many other things) are set and the terminal
35 and tab initialization strings are sent to the standard error output.
36 Finally, if the erase, interrupt and line kill characters have changed,
37 or are not set to their default values, their values are displayed to the
38 standard error output.
39 .PP
40 When invoked as \fBreset\fR, \fBtset\fR sets cooked and echo modes,
41 turns off cbreak and raw modes, turns on newline translation and
42 resets any unset special characters to their default values before
43 doing the terminal initialization described above.  This is useful
44 after a program dies leaving a terminal in an abnormal state.  Note,
45 you may have to type
46
47     \fB<LF>reset<LF>\fR
48
49 (the line-feed character is normally control-J) to get the terminal
50 to work, as carriage-return may no longer work in the abnormal state.
51 Also, the terminal will often not echo the command.
52 .PP
53 The options are as follows:
54 .TP 5
55 -q
56 The terminal type is displayed to the standard output, and the terminal is
57 not initialized in any way.  The option `-' by itself is equivalent but
58 archaic.
59 .TP 5
60 -e
61 Set the erase character to \fIch\fR.
62 .TP 5
63 -I
64 Do not send the terminal or tab initialization strings to the terminal.
65 .TP 5
66 -i
67 Set the interrupt character to \fIch\fR.
68 .TP 5
69 -k
70 Set the line kill character to \fIch\fR.
71 .TP 5
72 -m
73 Specify a mapping from a port type to a terminal.
74 See below for more information.
75 .TP 5
76 -Q
77 Don't display any values for the erase, interrupt and line kill characters.
78 .TP 5
79 -r
80 Print the terminal type to the standard error output.
81 .TP 5
82 -s
83 Print the sequence of shell commands to initialize the environment variable
84 \fBTERM\fR to the standard output.
85 See the section below on setting the environment for details.
86 .PP
87 The arguments for the -e, -i, and -k
88 options may either be entered as actual characters or by using the `hat'
89 notation, i.e. control-h may be specified as ``^H'' or ``^h''.
90 .SH SETTING THE ENVIRONMENT
91 It is often desirable to enter the terminal type and information about
92 the terminal's capabilities into the shell's environment.
93 This is done using the -s option.
94 .PP
95 When the -s option is specified, the commands to enter the information
96 into the shell's environment are written to the standard output.  If
97 the \fBSHELL\fR environmental variable ends in ``csh'', the commands
98 are for \fBcsh\fR, otherwise, they are for \fBsh\fR.
99 Note, the \fBcsh\fR commands set and unset the shell variable
100 \fBnoglob\fR, leaving it unset.  The following line in the \fB.login\fR
101 or \fB.profile\fR files will initialize the environment correctly:
102
103     eval \`tset -s options ... \`
104
105 .SH TERMINAL TYPE MAPPING
106 When the terminal is not hardwired into the system (or the current
107 system information is incorrect) the terminal type derived from the
108 \fI/etc/ttys\fR file or the \fBTERM\fR environmental variable is often
109 something generic like \fBnetwork\fR, \fBdialup\fR, or \fBunknown\fR.
110 When \fBtset\fR is used in a startup script it is often desirable to
111 provide information about the type of terminal used on such ports.
112 .PP
113 The purpose of the -m option is to map
114 from some set of conditions to a terminal type, that is, to
115 tell \fBtset\fR
116 ``If I'm on this port at a particular speed, guess that I'm on that
117 kind of terminal''.
118 .PP
119 The argument to the -m option consists of an optional port type, an
120 optional operator, an optional baud rate specification, an optional
121 colon (``:'') character and a terminal type.  The port type is a
122 string (delimited by either the operator or the colon character).  The
123 operator may be any combination of ``>'', ``<'', ``@'', and ``!''; ``>''
124 means greater than, ``<'' means less than, ``@'' means equal to
125 and ``!'' inverts the sense of the test.
126 The baud rate is specified as a number and is compared with the speed
127 of the standard error output (which should be the control terminal).
128 The terminal type is a string.
129 .PP
130 If the terminal type is not specified on the command line, the -m
131 mappings are applied to the terminal type.  If the port type and baud
132 rate match the mapping, the terminal type specified in the mapping
133 replaces the current type.  If more than one mapping is specified, the
134 first applicable mapping is used.
135 .PP
136 For example, consider the following mapping: \fBdialup>9600:vt100\fR.
137 The port type is dialup , the operator is >, the baud rate
138 specification is 9600, and the terminal type is vt100.  The result of
139 this mapping is to specify that if the terminal type is \fBdialup\fR,
140 and the baud rate is greater than 9600 baud, a terminal type of
141 \fBvt100\fR will be used.
142 .PP
143 If no baud rate is specified, the terminal type will match any baud rate.
144 If no port type is specified, the terminal type will match any port type.
145 For example, \fB-m dialup:vt100 -m :?xterm\fR
146 will cause any dialup port, regardless of baud rate, to match the terminal
147 type vt100, and any non-dialup port type to match the terminal type ?xterm.
148 Note, because of the leading question mark, the user will be
149 queried on a default port as to whether they are actually using an xterm
150 terminal.
151 .PP
152 No whitespace characters are permitted in the -m option argument.
153 Also, to avoid problems with meta-characters, it is suggested that the
154 entire -m option argument be placed within single quote characters,
155 and that \fBcsh\fR users insert a backslash character (``\e'') before
156 any exclamation marks (``!'').
157 .SH HISTORY
158 The \fBtset\fR command appeared in BSD 3.0.  The \fBncurses\fR implementation
159 was lightly adapted from the 4.4BSD sources for a terminfo environment by Eric
160 S. Raymond <esr@snark.thyrsus.com>.
161 .SH COMPATIBILITY
162 The \fBtset\fR utility has been provided for backward-compatibility with BSD
163 environments (under most modern UNIXes, \fB/etc/inittab\fR and \fIgetty\fR(1)
164 can set \fBTERM\fR appropriately for each dial-up line; this obviates what was
165 \fBtset\fR's most important use).  This implementation behaves like 4.4BSD
166 tset, with a few exceptions specified here.
167 .PP
168 The -S option of BSD tset no longer works; it prints an error message to stderr
169 and dies.  The -s option only sets \fBTERM\fR, not \fBTERMCAP\fB.  Both these
170 changes are because the \fBTERMCAP\fR variable is no longer supported under
171 terminfo-based \fBncurses\fR, which makes \fBtset -S\fR useless (we made it die
172 noisily rather than silently induce lossage).
173 .PP
174 There was an undocumented 4.4BSD feature that invoking tset via a link named
175 `TSET` (or via any other name beginning with an upper-case letter) set the
176 terminal to use upper-case only.  This feature has been omitted.
177 .PP
178 The -A, -E, -h, -u and -v options were deleted from the \fBtset\fR
179 utility in 4.4BSD. None of them were documented in 4.3BSD and all are
180 of limited utility at best. The -a, -d, and -p options are similarly
181 not documented or useful, but were retained as they appear to be in
182 widespread use.  It is strongly recommended that any usage of these
183 three options be changed to use the -m option instead.  The
184 -n option remains, but has no effect.  The -adnp options are therefore
185 omitted from the usage summary above.
186 .PP
187 It is still permissible to specify the -e, -i, and -k options without
188 arguments, although it is strongly recommended that such usage be fixed to
189 explicitly specify the character.
190 .PP
191 As of 4.4BSD, executing \fBtset\fR as \fBreset\fR no longer implies the -Q
192 option.  Also, the interaction between the - option and the \fIterminal\fR
193 argument in some historic implementations of \fBtset\fR has been removed.
194 .SH ENVIRONMENT
195 The \fBtset\fR command uses the \fBSHELL\fR and \fBTERM\fR
196 environment variables.
197 .SH FILES
198 .TP 5
199 /etc/ttys
200 system port name to terminal type mapping database (BSD versions only).
201 .TP 5
202 @DATADIR@/terminfo
203 terminal capability database
204 .SH SEE ALSO
205 csh(1),
206 sh(1),
207 stty(1),
208 tty(4),
209 termcap(5),
210 ttys(5),
211 environ(7)
212 .\"#
213 .\"# The following sets edit modes for GNU EMACS
214 .\"# Local Variables:
215 .\"# mode:nroff
216 .\"# fill-column:79
217 .\"# End:
218