]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/tset.1
ncurses 6.0 - patch 20160130
[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.31 2016/01/30 15:41:41 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 .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 \fBreset\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 The \fB@TSET@\fR utility has been provided for backward-compatibility with BSD
229 environments (under most modern UNIXes, \fB/etc/inittab\fR and \fIgetty\fR(1)
230 can set \fBTERM\fR appropriately for each dial-up line; this obviates what was
231 \fB@TSET@\fR's most important use).  This implementation behaves like 4.4BSD
232 tset, with a few exceptions specified here.
233 .PP
234 The \fB\-S\fR option of BSD tset no longer works;
235 it prints an error message to stderr and dies.
236 The \fB\-s\fR option only sets \fBTERM\fR, not \fBTERMCAP\fP.
237 Both of these changes are because the \fBTERMCAP\fR variable
238 is no longer supported under terminfo-based \fBncurses\fR,
239 which makes \fB@TSET@ \-S\fR useless
240 (we made it die noisily rather than silently induce lossage).
241 .PP
242 There was an undocumented 4.4BSD feature that invoking tset via a link named
243 `TSET` (or via any other name beginning with an upper-case letter) set the
244 terminal to use upper-case only.  This feature has been omitted.
245 .PP
246 The \fB\-A\fR, \fB\-E\fR, \fB\-h\fR, \fB\-u\fR and \fB\-v\fR
247 options were deleted from the \fB@TSET@\fR
248 utility in 4.4BSD.
249 None of them were documented in 4.3BSD and all are
250 of limited utility at best.
251 The \fB\-a\fR, \fB\-d\fR, and \fB\-p\fR options are similarly
252 not documented or useful, but were retained as they appear to be in
253 widespread use.  It is strongly recommended that any usage of these
254 three options be changed to use the \fB\-m\fR option instead.
255 The \fB\-n\fP option remains, but has no effect.
256 The \fB\-adnp\fR options are therefore omitted from the usage summary above.
257 .PP
258 It is still permissible to specify the \fB\-e\fR, \fB\-i\fR,
259 and \fB\-k\fR options without arguments,
260 although it is strongly recommended that such usage be fixed to
261 explicitly specify the character.
262 .PP
263 As of 4.4BSD,
264 executing \fB@TSET@\fR as \fBreset\fR no longer implies the \fB\-Q\fR option.
265 Also, the interaction between the \- option and the \fIterminal\fR
266 argument in some historic implementations of \fB@TSET@\fR has been removed.
267 .SH ENVIRONMENT
268 The \fB@TSET@\fR command uses these environment variables:
269 .TP 5
270 SHELL
271 tells \fB@TSET@\fP whether to initialize \fBTERM\fP using \fBsh\fP or
272 \fBcsh\fP syntax.
273 .TP 5
274 TERM
275 Denotes your terminal type.
276 Each terminal type is distinct, though many are similar.
277 .TP 5
278 TERMCAP
279 may denote the location of a termcap database.
280 If it is not an absolute pathname, e.g., begins with a `/',
281 \fB@TSET@\fP removes the variable from the environment before looking
282 for the terminal description.
283 .SH FILES
284 .TP 5
285 /etc/ttys
286 system port name to terminal type mapping database (BSD versions only).
287 .TP
288 @TERMINFO@
289 terminal capability database
290 .SH SEE ALSO
291 .hy 0
292 csh(1),
293 sh(1),
294 stty(1),
295 curs_terminfo(3X),
296 tty(4),
297 terminfo(5),
298 ttys(5),
299 environ(7)
300 .hy
301 .PP
302 This describes \fBncurses\fR
303 version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).