]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/tset.1
ncurses 6.0 - patch 20160416
[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.33 2016/04/16 18:48:44 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, \fB@RESET@\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 \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]
41 .SH DESCRIPTION
42 .SS tset - initialization
43 \&\fBTset\fR initializes terminals.
44 \fBTset\fR first determines the type of terminal that you are using.
45 This determination is done as follows, using the first terminal type found.
46 .PP
47 1. The \fBterminal\fR argument specified on the command line.
48 .PP
49 2. The value of the \fBTERM\fR environmental variable.
50 .PP
51 3. (BSD systems only.) The terminal type associated with the standard
52 error output device in the \fI/etc/ttys\fR file.
53 (On System\-V-like UNIXes and systems using that convention,
54 \fIgetty\fR does this job by setting
55 \fBTERM\fR according to the type passed to it by \fI/etc/inittab\fR.)
56 .PP
57 4. The default terminal type, \*(``unknown\*(''.
58 .PP
59 If the terminal type was not specified on the command-line, the \fB\-m\fR
60 option mappings are then applied (see the section
61 .B TERMINAL TYPE MAPPING
62 for more information).
63 Then, if the terminal type begins with a question mark (\*(``?\*(''), the
64 user is prompted for confirmation of the terminal type.  An empty
65 response confirms the type, or, another type can be entered to specify
66 a new type.  Once the terminal type has been determined, the terminfo
67 entry for the terminal is retrieved.  If no terminfo entry is found
68 for the type, the user is prompted for another terminal type.
69 .PP
70 Once the terminfo entry is retrieved, the window size, backspace, interrupt
71 and line kill characters (among many other things) are set and the terminal
72 and tab initialization strings are sent to the standard error output.
73 Finally, if the erase, interrupt and line kill characters have changed,
74 or are not set to their default values, their values are displayed to the
75 standard error output.
76 Use the \fB\-c\fP or \fB\-w\fP option to select only the window sizing
77 versus the other initialization.
78 If neither option is given, both are assumed.
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.  The option `\-' by itself is equivalent but
126 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 or by using the `hat'
148 notation, i.e., control-h may be specified as \*(``^H\*('' or \*(``^h\*(''.
149 .
150 .SH SETTING THE ENVIRONMENT
151 It is often desirable to enter the terminal type and information about
152 the terminal's capabilities into the shell's environment.
153 This is done using the \fB\-s\fR option.
154 .PP
155 When the \fB\-s\fR option is specified, the commands to enter the information
156 into the shell's environment are written to the standard output.  If
157 the \fBSHELL\fR environmental variable ends in \*(``csh\*('', the commands
158 are for \fBcsh\fR, otherwise, they are for \fBsh\fR.
159 Note, the \fBcsh\fR commands set and unset the shell variable
160 \fBnoglob\fR, leaving it unset.  The following line in the \fB.login\fR
161 or \fB.profile\fR files will initialize the environment correctly:
162 .sp
163     eval \`@TSET@ \-s options ... \`
164 .
165 .SH TERMINAL TYPE MAPPING
166 When the terminal is not hardwired into the system (or the current
167 system information is incorrect) the terminal type derived from the
168 \fI/etc/ttys\fR file or the \fBTERM\fR environmental variable is often
169 something generic like \fBnetwork\fR, \fBdialup\fR, or \fBunknown\fR.
170 When \fB@TSET@\fR is used in a startup script it is often desirable to
171 provide information about the type of terminal used on such ports.
172 .PP
173 The purpose of the \fB\-m\fR option is to map
174 from some set of conditions to a terminal type, that is, to
175 tell \fB@TSET@\fR
176 \*(``If I'm on this port at a particular speed,
177 guess that I'm on that kind of terminal\*(''.
178 .PP
179 The argument to the \fB\-m\fR option consists of an optional port type, an
180 optional operator, an optional baud rate specification, an optional
181 colon (\*(``:\*('') character and a terminal type.  The port type is a
182 string (delimited by either the operator or the colon character).
183 The operator may be any combination of
184 \*(``>\*('',
185 \*(``<\*('',
186 \*(``@\*('',
187 and \*(``!\*('';
188 \*(``>\*('' means greater than,
189 \*(``<\*('' means less than,
190 \*(``@\*('' means equal to and
191 \*(``!\*('' inverts the sense of the test.
192 The baud rate is specified as a number and is compared with the speed
193 of the standard error output (which should be the control terminal).
194 The terminal type is a string.
195 .PP
196 If the terminal type is not specified on the command line, the \fB\-m\fR
197 mappings are applied to the terminal type.  If the port type and baud
198 rate match the mapping, the terminal type specified in the mapping
199 replaces the current type.  If more than one mapping is specified, the
200 first applicable mapping is used.
201 .PP
202 For example, consider the following mapping: \fBdialup>9600:vt100\fR.
203 The port type is dialup , the operator is >, the baud rate
204 specification is 9600, and the terminal type is vt100.  The result of
205 this mapping is to specify that if the terminal type is \fBdialup\fR,
206 and the baud rate is greater than 9600 baud, a terminal type of
207 \fBvt100\fR will be used.
208 .PP
209 If no baud rate is specified, the terminal type will match any baud rate.
210 If no port type is specified, the terminal type will match any port type.
211 For example, \fB\-m dialup:vt100 \-m :?xterm\fR
212 will cause any dialup port, regardless of baud rate, to match the terminal
213 type vt100, and any non-dialup port type to match the terminal type ?xterm.
214 Note, because of the leading question mark, the user will be
215 queried on a default port as to whether they are actually using an xterm
216 terminal.
217 .PP
218 No whitespace characters are permitted in the \fB\-m\fR option argument.
219 Also, to avoid problems with meta-characters, it is suggested that the
220 entire \fB\-m\fR option argument be placed within single quote characters,
221 and that \fBcsh\fR users insert a backslash character (\*(``\e\*('') before
222 any exclamation marks (\*(``!\*('').
223 .SH HISTORY
224 The \fB@TSET@\fR command appeared in BSD 3.0.  The \fBncurses\fR implementation
225 was lightly adapted from the 4.4BSD sources for a terminfo environment by Eric
226 S. Raymond <esr@snark.thyrsus.com>.
227 .SH COMPATIBILITY
228 .PP
229 Neither IEEE Std 1003.1/The Open Group Base Specifications Issue 7
230 (POSIX.1-2008) nor
231 X/Open Curses Issue 7 documents \fB@TSET@\fP or \fB@RESET@\fP.
232 .PP
233 The \fB@TSET@\fR utility has been provided for backward-compatibility with BSD
234 environments (under most modern UNIXes, \fB/etc/inittab\fR and \fIgetty\fR(1)
235 can set \fBTERM\fR appropriately for each dial-up line; this obviates what was
236 \fB@TSET@\fR's most important use).  This implementation behaves like 4.4BSD
237 tset, with a few exceptions specified here.
238 .PP
239 The \fB\-S\fR option of BSD tset no longer works;
240 it prints an error message to stderr and dies.
241 The \fB\-s\fR option only sets \fBTERM\fR, not \fBTERMCAP\fP.
242 Both of these changes are because the \fBTERMCAP\fR variable
243 is no longer supported under terminfo-based \fBncurses\fR,
244 which makes \fB@TSET@ \-S\fR useless
245 (we made it die noisily rather than silently induce lossage).
246 .PP
247 There was an undocumented 4.4BSD feature that invoking tset via a link named
248 `TSET` (or via any other name beginning with an upper-case letter) set the
249 terminal to use upper-case only.  This feature has been omitted.
250 .PP
251 The \fB\-A\fR, \fB\-E\fR, \fB\-h\fR, \fB\-u\fR and \fB\-v\fR
252 options were deleted from the \fB@TSET@\fR
253 utility in 4.4BSD.
254 None of them were documented in 4.3BSD and all are
255 of limited utility at best.
256 The \fB\-a\fR, \fB\-d\fR, and \fB\-p\fR options are similarly
257 not documented or useful, but were retained as they appear to be in
258 widespread use.  It is strongly recommended that any usage of these
259 three options be changed to use the \fB\-m\fR option instead.
260 The \fB\-a\fP, \fB\-d\fP, and \fB\-p\fR options are therefore omitted from the usage summary above.
261 .PP
262 Very old systems, e.g., 3BSD, used a different terminal driver which
263 was replaced in 4BSD in the early 1980s.
264 To accommodate these older systems, the 4BSD \fB@TSET@\fP provided a
265 \fB\-n\fP option to specify that the new terminal driver should be used.
266 This implementation does not provide that choice.
267 .PP
268 It is still permissible to specify the \fB\-e\fR, \fB\-i\fR,
269 and \fB\-k\fR options without arguments,
270 although it is strongly recommended that such usage be fixed to
271 explicitly specify the character.
272 .PP
273 As of 4.4BSD,
274 executing \fB@TSET@\fR as \fB@RESET@\fR no longer implies the \fB\-Q\fR option.
275 Also, the interaction between the \- option and the \fIterminal\fR
276 argument in some historic implementations of \fB@TSET@\fR has been removed.
277 .SH ENVIRONMENT
278 The \fB@TSET@\fR command uses these environment variables:
279 .TP 5
280 SHELL
281 tells \fB@TSET@\fP whether to initialize \fBTERM\fP using \fBsh\fP or
282 \fBcsh\fP syntax.
283 .TP 5
284 TERM
285 Denotes your terminal type.
286 Each terminal type is distinct, though many are similar.
287 .TP 5
288 TERMCAP
289 may denote the location of a termcap database.
290 If it is not an absolute pathname, e.g., begins with a `/',
291 \fB@TSET@\fP removes the variable from the environment before looking
292 for the terminal description.
293 .SH FILES
294 .TP 5
295 /etc/ttys
296 system port name to terminal type mapping database (BSD versions only).
297 .TP
298 @TERMINFO@
299 terminal capability database
300 .SH SEE ALSO
301 .hy 0
302 csh(1),
303 sh(1),
304 stty(1),
305 curs_terminfo(3X),
306 tty(4),
307 terminfo(5),
308 ttys(5),
309 environ(7)
310 .hy
311 .PP
312 This describes \fBncurses\fR
313 version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).