]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/tset.1
ncurses 5.9 - patch 20140222
[ncurses.git] / man / tset.1
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2011,2013 Free Software Foundation, Inc.              *
3 .\"                                                                          *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
5 .\" copy of this software and associated documentation files (the            *
6 .\" "Software"), to deal in the Software without restriction, including      *
7 .\" without limitation the rights to use, copy, modify, merge, publish,      *
8 .\" distribute, distribute with modifications, sublicense, and/or sell       *
9 .\" copies of the Software, and to permit persons to whom the Software is    *
10 .\" furnished to do so, subject to the following conditions:                 *
11 .\"                                                                          *
12 .\" The above copyright notice and this permission notice shall be included  *
13 .\" in all copies or substantial portions of the Software.                   *
14 .\"                                                                          *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 .\"                                                                          *
23 .\" Except as contained in this notice, the name(s) of the above copyright   *
24 .\" holders shall not be used in advertising or otherwise to promote the     *
25 .\" sale, use or other dealings in this Software without prior written       *
26 .\" authorization.                                                           *
27 .\"***************************************************************************
28 .\"
29 .\" $Id: tset.1,v 1.29 2013/12/21 22:15:53 tom Exp $
30 .TH @TSET@ 1 ""
31 .ie \n(.g .ds `` \(lq
32 .el       .ds `` ``
33 .ie \n(.g .ds '' \(rq
34 .el       .ds '' ''
35 .SH NAME
36 \fB@TSET@\fR, \fBreset\fR \- terminal initialization
37 .SH SYNOPSIS
38 \fB@TSET@\fR [\fB\-IQVcqrsw\fR] [\fB\-\fR] [\fB\-e\fR \fIch\fR] [\fB\-i\fR \fIch\fR] [\fB\-k\fR \fIch\fR] [\fB\-m\fR \fImapping\fR] [\fIterminal\fR]
39 .br
40 \fBreset\fR [\fB\-IQVcqrsw\fR] [\fB\-\fR] [\fB\-e\fR \fIch\fR] [\fB\-i\fR \fIch\fR] [\fB\-k\fR \fIch\fR] [\fB\-m\fR \fImapping\fR] [\fIterminal\fR]
41 .SH DESCRIPTION
42 \&\fBTset\fR initializes terminals.
43 \fBTset\fR first determines the type of terminal that you are using.
44 This determination is done as follows, using the first terminal type found.
45 .PP
46 1. The \fBterminal\fR argument specified on the command line.
47 .PP
48 2. The value of the \fBTERM\fR environmental variable.
49 .PP
50 3. (BSD systems only.) The terminal type associated with the standard
51 error output device in the \fI/etc/ttys\fR file.
52 (On System\-V-like UNIXes and systems using that convention,
53 \fIgetty\fR does this job by setting
54 \fBTERM\fR according to the type passed to it by \fI/etc/inittab\fR.)
55 .PP
56 4. The default terminal type, \*(``unknown\*(''.
57 .PP
58 If the terminal type was not specified on the command-line, the \fB\-m\fR
59 option mappings are then applied (see the section
60 .B TERMINAL TYPE MAPPING
61 for more information).
62 Then, if the terminal type begins with a question mark (\*(``?\*(''), the
63 user is prompted for confirmation of the terminal type.  An empty
64 response confirms the type, or, another type can be entered to specify
65 a new type.  Once the terminal type has been determined, the terminfo
66 entry for the terminal is retrieved.  If no terminfo entry is found
67 for the type, the user is prompted for another terminal type.
68 .PP
69 Once the terminfo entry is retrieved, the window size, backspace, interrupt
70 and line kill characters (among many other things) are set and the terminal
71 and tab initialization strings are sent to the standard error output.
72 Finally, if the erase, interrupt and line kill characters have changed,
73 or are not set to their default values, their values are displayed to the
74 standard error output.
75 Use the \fB\-c\fP or \fB\-w\fP option to select only the window sizing
76 versus the other initialization.
77 If neither option is given, both are assumed.
78 .PP
79 When invoked as \fBreset\fR, \fB@TSET@\fR sets cooked and echo modes,
80 turns off cbreak and raw modes, turns on newline translation and
81 resets any unset special characters to their default values before
82 doing the terminal initialization described above.  This is useful
83 after a program dies leaving a terminal in an abnormal state.  Note,
84 you may have to type
85 .sp
86     \fB<LF>reset<LF>\fR
87 .sp
88 (the line-feed character is normally control-J) to get the terminal
89 to work, as carriage-return may no longer work in the abnormal state.
90 Also, the terminal will often not echo the command.
91 .PP
92 The options are as follows:
93 .TP 5
94 .B \-c
95 Set control characters and modes.
96 .TP 5
97 .B \-e
98 Set the erase character to \fIch\fR.
99 .TP
100 .B \-I
101 Do not send the terminal or tab initialization strings to the terminal.
102 .TP
103 .B \-i
104 Set the interrupt character to \fIch\fR.
105 .TP
106 .B \-k
107 Set the line kill character to \fIch\fR.
108 .TP
109 .B \-m
110 Specify a mapping from a port type to a terminal.
111 See the section
112 .B TERMINAL TYPE MAPPING
113 for more information.
114 .TP
115 .B \-Q
116 Do not display any values for the erase, interrupt and line kill characters.
117 Normally \fB@TSET@\fR displays the values for control characters which
118 differ from the system's default values.
119 .TP
120 .B \-q
121 The terminal type is displayed to the standard output, and the terminal is
122 not initialized in any way.  The option `\-' by itself is equivalent but
123 archaic.
124 .TP
125 .B \-r
126 Print the terminal type to the standard error output.
127 .TP
128 .B \-s
129 Print the sequence of shell commands to initialize the environment variable
130 \fBTERM\fR to the standard output.
131 See the section
132 .B SETTING THE ENVIRONMENT
133 for details.
134 .TP
135 .B \-V
136 reports the version of ncurses which was used in this program, and exits.
137 .TP
138 .B \-w
139 Resize the window to match the size deduced via \fBsetupterm\fP.
140 Normally this has no effect,
141 unless \fBsetupterm\fP is not able to detect the window size.
142 .PP
143 The arguments for the \fB\-e\fR, \fB\-i\fR, and \fB\-k\fR
144 options may either be entered as actual characters or by using the `hat'
145 notation, i.e., control-h may be specified as \*(``^H\*('' or \*(``^h\*(''.
146 .
147 .SH SETTING THE ENVIRONMENT
148 It is often desirable to enter the terminal type and information about
149 the terminal's capabilities into the shell's environment.
150 This is done using the \fB\-s\fR option.
151 .PP
152 When the \fB\-s\fR option is specified, the commands to enter the information
153 into the shell's environment are written to the standard output.  If
154 the \fBSHELL\fR environmental variable ends in \*(``csh\*('', the commands
155 are for \fBcsh\fR, otherwise, they are for \fBsh\fR.
156 Note, the \fBcsh\fR commands set and unset the shell variable
157 \fBnoglob\fR, leaving it unset.  The following line in the \fB.login\fR
158 or \fB.profile\fR files will initialize the environment correctly:
159 .sp
160     eval \`@TSET@ \-s options ... \`
161 .
162 .SH TERMINAL TYPE MAPPING
163 When the terminal is not hardwired into the system (or the current
164 system information is incorrect) the terminal type derived from the
165 \fI/etc/ttys\fR file or the \fBTERM\fR environmental variable is often
166 something generic like \fBnetwork\fR, \fBdialup\fR, or \fBunknown\fR.
167 When \fB@TSET@\fR is used in a startup script it is often desirable to
168 provide information about the type of terminal used on such ports.
169 .PP
170 The purpose of the \fB\-m\fR option is to map
171 from some set of conditions to a terminal type, that is, to
172 tell \fB@TSET@\fR
173 \*(``If I'm on this port at a particular speed,
174 guess that I'm on that kind of terminal\*(''.
175 .PP
176 The argument to the \fB\-m\fR option consists of an optional port type, an
177 optional operator, an optional baud rate specification, an optional
178 colon (\*(``:\*('') character and a terminal type.  The port type is a
179 string (delimited by either the operator or the colon character).
180 The operator may be any combination of
181 \*(``>\*('',
182 \*(``<\*('',
183 \*(``@\*('',
184 and \*(``!\*('';
185 \*(``>\*('' means greater than,
186 \*(``<\*('' means less than,
187 \*(``@\*('' means equal to and
188 \*(``!\*('' inverts the sense of the test.
189 The baud rate is specified as a number and is compared with the speed
190 of the standard error output (which should be the control terminal).
191 The terminal type is a string.
192 .PP
193 If the terminal type is not specified on the command line, the \fB\-m\fR
194 mappings are applied to the terminal type.  If the port type and baud
195 rate match the mapping, the terminal type specified in the mapping
196 replaces the current type.  If more than one mapping is specified, the
197 first applicable mapping is used.
198 .PP
199 For example, consider the following mapping: \fBdialup>9600:vt100\fR.
200 The port type is dialup , the operator is >, the baud rate
201 specification is 9600, and the terminal type is vt100.  The result of
202 this mapping is to specify that if the terminal type is \fBdialup\fR,
203 and the baud rate is greater than 9600 baud, a terminal type of
204 \fBvt100\fR will be used.
205 .PP
206 If no baud rate is specified, the terminal type will match any baud rate.
207 If no port type is specified, the terminal type will match any port type.
208 For example, \fB\-m dialup:vt100 \-m :?xterm\fR
209 will cause any dialup port, regardless of baud rate, to match the terminal
210 type vt100, and any non-dialup port type to match the terminal type ?xterm.
211 Note, because of the leading question mark, the user will be
212 queried on a default port as to whether they are actually using an xterm
213 terminal.
214 .PP
215 No whitespace characters are permitted in the \fB\-m\fR option argument.
216 Also, to avoid problems with meta-characters, it is suggested that the
217 entire \fB\-m\fR option argument be placed within single quote characters,
218 and that \fBcsh\fR users insert a backslash character (\*(``\e\*('') before
219 any exclamation marks (\*(``!\*('').
220 .SH HISTORY
221 The \fB@TSET@\fR command appeared in BSD 3.0.  The \fBncurses\fR implementation
222 was lightly adapted from the 4.4BSD sources for a terminfo environment by Eric
223 S. Raymond <esr@snark.thyrsus.com>.
224 .SH COMPATIBILITY
225 The \fB@TSET@\fR utility has been provided for backward-compatibility with BSD
226 environments (under most modern UNIXes, \fB/etc/inittab\fR and \fIgetty\fR(1)
227 can set \fBTERM\fR appropriately for each dial-up line; this obviates what was
228 \fB@TSET@\fR's most important use).  This implementation behaves like 4.4BSD
229 tset, with a few exceptions specified here.
230 .PP
231 The \fB\-S\fR option of BSD tset no longer works;
232 it prints an error message to stderr and dies.
233 The \fB\-s\fR option only sets \fBTERM\fR, not \fBTERMCAP\fP.
234 Both of these changes are because the \fBTERMCAP\fR variable
235 is no longer supported under terminfo-based \fBncurses\fR,
236 which makes \fB@TSET@ \-S\fR useless
237 (we made it die noisily rather than silently induce lossage).
238 .PP
239 There was an undocumented 4.4BSD feature that invoking tset via a link named
240 `TSET` (or via any other name beginning with an upper-case letter) set the
241 terminal to use upper-case only.  This feature has been omitted.
242 .PP
243 The \fB\-A\fR, \fB\-E\fR, \fB\-h\fR, \fB\-u\fR and \fB\-v\fR
244 options were deleted from the \fB@TSET@\fR
245 utility in 4.4BSD.
246 None of them were documented in 4.3BSD and all are
247 of limited utility at best.
248 The \fB\-a\fR, \fB\-d\fR, and \fB\-p\fR options are similarly
249 not documented or useful, but were retained as they appear to be in
250 widespread use.  It is strongly recommended that any usage of these
251 three options be changed to use the \fB\-m\fR option instead.
252 The \fB\-n\fP option remains, but has no effect.
253 The \fB\-adnp\fR options are therefore omitted from the usage summary above.
254 .PP
255 It is still permissible to specify the \fB\-e\fR, \fB\-i\fR,
256 and \fB\-k\fR options without arguments,
257 although it is strongly recommended that such usage be fixed to
258 explicitly specify the character.
259 .PP
260 As of 4.4BSD,
261 executing \fB@TSET@\fR as \fBreset\fR no longer implies the \fB\-Q\fR option.
262 Also, the interaction between the \- option and the \fIterminal\fR
263 argument in some historic implementations of \fB@TSET@\fR has been removed.
264 .SH ENVIRONMENT
265 The \fB@TSET@\fR command uses these environment variables:
266 .TP 5
267 SHELL
268 tells \fB@TSET@\fP whether to initialize \fBTERM\fP using \fBsh\fP or
269 \fBcsh\fP syntax.
270 .TP 5
271 TERM
272 Denotes your terminal type.
273 Each terminal type is distinct, though many are similar.
274 .TP 5
275 TERMCAP
276 may denote the location of a termcap database.
277 If it is not an absolute pathname, e.g., begins with a `/',
278 \fB@TSET@\fP removes the variable from the environment before looking
279 for the terminal description.
280 .SH FILES
281 .TP 5
282 /etc/ttys
283 system port name to terminal type mapping database (BSD versions only).
284 .TP
285 @TERMINFO@
286 terminal capability database
287 .SH SEE ALSO
288 .hy 0
289 csh(1),
290 sh(1),
291 stty(1),
292 curs_terminfo(3X),
293 tty(4),
294 terminfo(5),
295 ttys(5),
296 environ(7)
297 .hy
298 .PP
299 This describes \fBncurses\fR
300 version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).