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