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