]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/tset.1
ncurses 6.0 - patch 20160702
[ncurses.git] / man / tset.1
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2013,2016 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.37 2016/05/21 23:36:51 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 .de bP
36 .IP \(bu 4
37 ..
38 .SH NAME
39 \fB@TSET@\fR, \fB@RESET@\fR \- terminal initialization
40 .SH SYNOPSIS
41 \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]
42 .br
43 \fB@RESET@\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]
44 .SH DESCRIPTION
45 .SS tset - initialization
46 \&\fBTset\fR initializes terminals.
47 \fBTset\fR first determines the type of terminal that you are using.
48 This determination is done as follows, using the first terminal type found.
49 .PP
50 1. The \fBterminal\fR argument specified on the command line.
51 .PP
52 2. The value of the \fBTERM\fR environmental variable.
53 .PP
54 3. (BSD systems only.) The terminal type associated with the standard
55 error output device in the \fI/etc/ttys\fR file.
56 (On System\-V-like UNIXes and systems using that convention,
57 \fIgetty\fR does this job by setting
58 \fBTERM\fR according to the type passed to it by \fI/etc/inittab\fR.)
59 .PP
60 4. The default terminal type, \*(``unknown\*(''.
61 .PP
62 If the terminal type was not specified on the command-line, the \fB\-m\fR
63 option mappings are then applied (see the section
64 .B TERMINAL TYPE MAPPING
65 for more information).
66 Then, if the terminal type begins with a question mark (\*(``?\*(''), the
67 user is prompted for confirmation of the terminal type.  An empty
68 response confirms the type, or, another type can be entered to specify
69 a new type.  Once the terminal type has been determined, the terminfo
70 entry for the terminal is retrieved.  If no terminfo entry is found
71 for the type, the user is prompted for another terminal type.
72 .PP
73 Once the terminfo entry is retrieved, the window size, backspace, interrupt
74 and line kill characters (among many other things) are set and the terminal
75 and tab initialization strings are sent to the standard error output.
76 Finally, if the erase, interrupt and line kill characters have changed,
77 or are not set to their default values, their values are displayed to the
78 standard error output.
79 .SS reset - reinitialization
80 .PP
81 When invoked as \fB@RESET@\fR, \fB@TSET@\fR sets cooked and echo modes,
82 turns off cbreak and raw modes, turns on newline translation and
83 resets any unset special characters to their default values before
84 doing the terminal initialization described above.  This is useful
85 after a program dies leaving a terminal in an abnormal state.  Note,
86 you may have to type
87 .sp
88     \fB<LF>@RESET@<LF>\fR
89 .sp
90 (the line-feed character is normally control-J) to get the terminal
91 to work, as carriage-return may no longer work in the abnormal state.
92 Also, the terminal will often not echo the command.
93 .SH OPTIONS 
94 .PP
95 The options are as follows:
96 .TP 5
97 .B \-c
98 Set control characters and modes.
99 .TP 5
100 .B \-e
101 Set the erase character to \fIch\fR.
102 .TP
103 .B \-I
104 Do not send the terminal or tab initialization strings to the terminal.
105 .TP
106 .B \-i
107 Set the interrupt character to \fIch\fR.
108 .TP
109 .B \-k
110 Set the line kill character to \fIch\fR.
111 .TP
112 .B \-m
113 Specify a mapping from a port type to a terminal.
114 See the section
115 .B TERMINAL TYPE MAPPING
116 for more information.
117 .TP
118 .B \-Q
119 Do not display any values for the erase, interrupt and line kill characters.
120 Normally \fB@TSET@\fR displays the values for control characters which
121 differ from the system's default values.
122 .TP
123 .B \-q
124 The terminal type is displayed to the standard output, and the terminal is
125 not initialized in any way.
126 The option \*(``\-\*('' by itself is equivalent but archaic.
127 .TP
128 .B \-r
129 Print the terminal type to the standard error output.
130 .TP
131 .B \-s
132 Print the sequence of shell commands to initialize the environment variable
133 \fBTERM\fR to the standard output.
134 See the section
135 .B SETTING THE ENVIRONMENT
136 for details.
137 .TP
138 .B \-V
139 reports the version of ncurses which was used in this program, and exits.
140 .TP
141 .B \-w
142 Resize the window to match the size deduced via \fBsetupterm\fP.
143 Normally this has no effect,
144 unless \fBsetupterm\fP is not able to detect the window size.
145 .PP
146 The arguments for the \fB\-e\fR, \fB\-i\fR, and \fB\-k\fR
147 options may either be entered as actual characters
148 or by using the \*(``hat\*(''
149 notation, i.e., control-h may be specified as \*(``^H\*('' or \*(``^h\*(''.
150 .PP
151 If neither \fB\-c\fP or \fB\-w\fP is given, both options are assumed.
152 .
153 .SH SETTING THE ENVIRONMENT
154 It is often desirable to enter the terminal type and information about
155 the terminal's capabilities into the shell's environment.
156 This is done using the \fB\-s\fR option.
157 .PP
158 When the \fB\-s\fR option is specified, the commands to enter the information
159 into the shell's environment are written to the standard output.  If
160 the \fBSHELL\fR environmental variable ends in \*(``csh\*('', the commands
161 are for \fBcsh\fR, otherwise, they are for \fBsh\fR.
162 Note, the \fBcsh\fR commands set and unset the shell variable
163 \fBnoglob\fR, leaving it unset.  The following line in the \fB.login\fR
164 or \fB.profile\fR files will initialize the environment correctly:
165 .sp
166     eval \`@TSET@ \-s options ... \`
167 .
168 .SH TERMINAL TYPE MAPPING
169 When the terminal is not hardwired into the system (or the current
170 system information is incorrect) the terminal type derived from the
171 \fI/etc/ttys\fR file or the \fBTERM\fR environmental variable is often
172 something generic like \fBnetwork\fR, \fBdialup\fR, or \fBunknown\fR.
173 When \fB@TSET@\fR is used in a startup script it is often desirable to
174 provide information about the type of terminal used on such ports.
175 .PP
176 The purpose of the \fB\-m\fR option is to map
177 from some set of conditions to a terminal type, that is, to
178 tell \fB@TSET@\fR
179 \*(``If I'm on this port at a particular speed,
180 guess that I'm on that kind of terminal\*(''.
181 .PP
182 The argument to the \fB\-m\fR option consists of an optional port type, an
183 optional operator, an optional baud rate specification, an optional
184 colon (\*(``:\*('') character and a terminal type.  The port type is a
185 string (delimited by either the operator or the colon character).
186 The operator may be any combination of
187 \*(``>\*('',
188 \*(``<\*('',
189 \*(``@\*('',
190 and \*(``!\*('';
191 \*(``>\*('' means greater than,
192 \*(``<\*('' means less than,
193 \*(``@\*('' means equal to and
194 \*(``!\*('' inverts the sense of the test.
195 The baud rate is specified as a number and is compared with the speed
196 of the standard error output (which should be the control terminal).
197 The terminal type is a string.
198 .PP
199 If the terminal type is not specified on the command line, the \fB\-m\fR
200 mappings are applied to the terminal type.  If the port type and baud
201 rate match the mapping, the terminal type specified in the mapping
202 replaces the current type.  If more than one mapping is specified, the
203 first applicable mapping is used.
204 .PP
205 For example, consider the following mapping: \fBdialup>9600:vt100\fR.
206 The port type is dialup , the operator is >, the baud rate
207 specification is 9600, and the terminal type is vt100.  The result of
208 this mapping is to specify that if the terminal type is \fBdialup\fR,
209 and the baud rate is greater than 9600 baud, a terminal type of
210 \fBvt100\fR will be used.
211 .PP
212 If no baud rate is specified, the terminal type will match any baud rate.
213 If no port type is specified, the terminal type will match any port type.
214 For example, \fB\-m dialup:vt100 \-m :?xterm\fR
215 will cause any dialup port, regardless of baud rate, to match the terminal
216 type vt100, and any non-dialup port type to match the terminal type ?xterm.
217 Note, because of the leading question mark, the user will be
218 queried on a default port as to whether they are actually using an xterm
219 terminal.
220 .PP
221 No whitespace characters are permitted in the \fB\-m\fR option argument.
222 Also, to avoid problems with meta-characters, it is suggested that the
223 entire \fB\-m\fR option argument be placed within single quote characters,
224 and that \fBcsh\fR users insert a backslash character (\*(``\e\*('') before
225 any exclamation marks (\*(``!\*('').
226 .SH HISTORY
227 The \fB@TSET@\fR command appeared in BSD 3.0.  The \fBncurses\fR implementation
228 was lightly adapted from the 4.4BSD sources for a terminfo environment by Eric
229 S. Raymond <esr@snark.thyrsus.com>.
230 .SH COMPATIBILITY
231 .PP
232 Neither IEEE Std 1003.1/The Open Group Base Specifications Issue 7
233 (POSIX.1-2008) nor
234 X/Open Curses Issue 7 documents \fB@TSET@\fP or \fB@RESET@\fP.
235 .PP
236 The \fB@TSET@\fR utility has been provided for backward-compatibility with BSD
237 environments (under most modern UNIXes, \fB/etc/inittab\fR and \fIgetty\fR(1)
238 can set \fBTERM\fR appropriately for each dial-up line; this obviates what was
239 \fB@TSET@\fR's most important use).  This implementation behaves like 4.4BSD
240 tset, with a few exceptions specified here.
241 .PP
242 The \fB\-S\fR option of BSD tset no longer works;
243 it prints an error message to stderr and dies.
244 The \fB\-s\fR option only sets \fBTERM\fR, not \fBTERMCAP\fP.
245 Both of these changes are because the \fBTERMCAP\fR variable
246 is no longer supported under terminfo-based \fBncurses\fR,
247 which makes \fB@TSET@ \-S\fR useless
248 (we made it die noisily rather than silently induce lossage).
249 .PP
250 There was an undocumented 4.4BSD feature
251 that invoking \fBtset\fP via a link named
252 \*(``TSET\*('' (or via any other name beginning with an upper-case letter)
253 set the terminal to use upper-case only.
254 This feature has been omitted.
255 .PP
256 The \fB\-A\fR, \fB\-E\fR, \fB\-h\fR, \fB\-u\fR and \fB\-v\fR
257 options were deleted from the \fB@TSET@\fR
258 utility in 4.4BSD.
259 None of them were documented in 4.3BSD and all are
260 of limited utility at best.
261 The \fB\-a\fR, \fB\-d\fR, and \fB\-p\fR options are similarly
262 not documented or useful, but were retained as they appear to be in
263 widespread use.  It is strongly recommended that any usage of these
264 three options be changed to use the \fB\-m\fR option instead.
265 The \fB\-a\fP, \fB\-d\fP, and \fB\-p\fR options are therefore omitted from the usage summary above.
266 .PP
267 Very old systems, e.g., 3BSD, used a different terminal driver which
268 was replaced in 4BSD in the early 1980s.
269 To accommodate these older systems, the 4BSD \fB@TSET@\fP provided a
270 \fB\-n\fP option to specify that the new terminal driver should be used.
271 This implementation does not provide that choice.
272 .PP
273 It is still permissible to specify the \fB\-e\fR, \fB\-i\fR,
274 and \fB\-k\fR options without arguments,
275 although it is strongly recommended that such usage be fixed to
276 explicitly specify the character.
277 .PP
278 As of 4.4BSD,
279 executing \fB@TSET@\fR as \fB@RESET@\fR no longer implies the \fB\-Q\fR option.
280 Also, the interaction between the \- option and the \fIterminal\fR
281 argument in some historic implementations of \fB@TSET@\fR has been removed.
282 .PP
283 The \fB\-c\fP and \fB\-w\fP options are not found in earlier implementations.
284 However, a different window size-change feature was provided in 4.4BSD.
285 .bP
286 In 4.4BSD, \fBtset\fP uses the window size from the termcap description
287 to set the window size if \fBtset\fP is not able to obtain the window
288 size from the operating system.
289 .bP
290 In ncurses, \fB@TSET@\fR obtains the window size using
291 \fBsetupterm\fP, which may be from
292 the operating system,
293 the \fBLINES\fP and \fBCOLUMNS\fP environment variables or
294 the terminal description.
295 .PP
296 Obtaining the window size from the terminal description is common to
297 both implementations, but considered obsolescent.
298 Its only practical use is for hardware terminals.
299 Generally speaking, a window size would be unset only if there were
300 some problem obtaining the value from the operating system
301 (and \fBsetupterm\fP would still fail).
302 For that reason, the \fBLINES\fP and \fBCOLUMNS\fP environment variables
303 may be useful for working around window-size problems.
304 Those have the drawback that if the window is resized,
305 those variables must be recomputed and reassigned.
306 To do this more easily, use the \fBresize\fP(1) program.
307 .SH ENVIRONMENT
308 The \fB@TSET@\fR command uses these environment variables:
309 .TP 5
310 SHELL
311 tells \fB@TSET@\fP whether to initialize \fBTERM\fP using \fBsh\fP or
312 \fBcsh\fP syntax.
313 .TP 5
314 TERM
315 Denotes your terminal type.
316 Each terminal type is distinct, though many are similar.
317 .TP 5
318 TERMCAP
319 may denote the location of a termcap database.
320 If it is not an absolute pathname, e.g., begins with a \*(``/\*('',
321 \fB@TSET@\fP removes the variable from the environment before looking
322 for the terminal description.
323 .SH FILES
324 .TP 5
325 /etc/ttys
326 system port name to terminal type mapping database (BSD versions only).
327 .TP
328 @TERMINFO@
329 terminal capability database
330 .SH SEE ALSO
331 .hy 0
332 csh(1),
333 sh(1),
334 stty(1),
335 curs_terminfo(3X),
336 tty(4),
337 terminfo(5),
338 ttys(5),
339 environ(7)
340 .hy
341 .PP
342 This describes \fBncurses\fR
343 version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).