blob: e151e7532f419bab2f7f4df44a46ebb5e6b99494 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
Steve Kondikae271bc2015-11-15 02:50:53 +01002.\" Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05303.\" *
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.\"
Steve Kondikae271bc2015-11-15 02:50:53 +010029.\" $Id: tset.1,v 1.29 2013/12/21 22:15:53 tom Exp $
30.TH @TSET@ 1 ""
31.ie \n(.g .ds `` \(lq
32.el .ds `` ``
33.ie \n(.g .ds '' \(rq
34.el .ds '' ''
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053035.SH NAME
Steve Kondikae271bc2015-11-15 02:50:53 +010036\fB@TSET@\fR, \fBreset\fR \- terminal initialization
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053037.SH SYNOPSIS
Steve Kondikae271bc2015-11-15 02:50:53 +010038\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]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053039.br
Steve Kondikae271bc2015-11-15 02:50:53 +010040\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]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053041.SH DESCRIPTION
42\&\fBTset\fR initializes terminals.
43\fBTset\fR first determines the type of terminal that you are using.
44This determination is done as follows, using the first terminal type found.
45.PP
461. The \fBterminal\fR argument specified on the command line.
47.PP
482. The value of the \fBTERM\fR environmental variable.
49.PP
503. (BSD systems only.) The terminal type associated with the standard
Steve Kondikae271bc2015-11-15 02:50:53 +010051error output device in the \fI/etc/ttys\fR file.
52(On System\-V-like UNIXes and systems using that convention,
53\fIgetty\fR does this job by setting
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053054\fBTERM\fR according to the type passed to it by \fI/etc/inittab\fR.)
55.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100564. The default terminal type, \*(``unknown\*(''.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053057.PP
Steve Kondikae271bc2015-11-15 02:50:53 +010058If the terminal type was not specified on the command-line, the \fB\-m\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053059option mappings are then applied (see the section
60.B TERMINAL TYPE MAPPING
61for more information).
Steve Kondikae271bc2015-11-15 02:50:53 +010062Then, if the terminal type begins with a question mark (\*(``?\*(''), the
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053063user is prompted for confirmation of the terminal type. An empty
64response confirms the type, or, another type can be entered to specify
65a new type. Once the terminal type has been determined, the terminfo
66entry for the terminal is retrieved. If no terminfo entry is found
67for the type, the user is prompted for another terminal type.
68.PP
69Once the terminfo entry is retrieved, the window size, backspace, interrupt
70and line kill characters (among many other things) are set and the terminal
71and tab initialization strings are sent to the standard error output.
72Finally, if the erase, interrupt and line kill characters have changed,
73or are not set to their default values, their values are displayed to the
74standard error output.
Steve Kondikae271bc2015-11-15 02:50:53 +010075Use the \fB\-c\fP or \fB\-w\fP option to select only the window sizing
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053076versus the other initialization.
77If neither option is given, both are assumed.
78.PP
Steve Kondikae271bc2015-11-15 02:50:53 +010079When invoked as \fBreset\fR, \fB@TSET@\fR sets cooked and echo modes,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053080turns off cbreak and raw modes, turns on newline translation and
81resets any unset special characters to their default values before
82doing the terminal initialization described above. This is useful
83after a program dies leaving a terminal in an abnormal state. Note,
84you may have to type
85.sp
86 \fB<LF>reset<LF>\fR
87.sp
88(the line-feed character is normally control-J) to get the terminal
89to work, as carriage-return may no longer work in the abnormal state.
90Also, the terminal will often not echo the command.
91.PP
92The options are as follows:
93.TP 5
Steve Kondikae271bc2015-11-15 02:50:53 +010094.B \-c
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053095Set control characters and modes.
Steve Kondikae271bc2015-11-15 02:50:53 +010096.TP 5
97.B \-e
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053098Set the erase character to \fIch\fR.
99.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100100.B \-I
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530101Do not send the terminal or tab initialization strings to the terminal.
102.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100103.B \-i
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530104Set the interrupt character to \fIch\fR.
105.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100106.B \-k
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530107Set the line kill character to \fIch\fR.
108.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100109.B \-m
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530110Specify a mapping from a port type to a terminal.
111See the section
112.B TERMINAL TYPE MAPPING
113for more information.
114.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100115.B \-Q
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530116Do not display any values for the erase, interrupt and line kill characters.
Steve Kondikae271bc2015-11-15 02:50:53 +0100117Normally \fB@TSET@\fR displays the values for control characters which
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530118differ from the system's default values.
119.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100120.B \-q
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530121The terminal type is displayed to the standard output, and the terminal is
Steve Kondikae271bc2015-11-15 02:50:53 +0100122not initialized in any way. The option `\-' by itself is equivalent but
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530123archaic.
124.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100125.B \-r
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530126Print the terminal type to the standard error output.
127.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100128.B \-s
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530129Print the sequence of shell commands to initialize the environment variable
130\fBTERM\fR to the standard output.
131See the section
132.B SETTING THE ENVIRONMENT
133for details.
134.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100135.B \-V
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530136reports the version of ncurses which was used in this program, and exits.
137.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100138.B \-w
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530139Resize the window to match the size deduced via \fBsetupterm\fP.
140Normally this has no effect,
141unless \fBsetupterm\fP is not able to detect the window size.
142.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100143The arguments for the \fB\-e\fR, \fB\-i\fR, and \fB\-k\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530144options may either be entered as actual characters or by using the `hat'
Steve Kondikae271bc2015-11-15 02:50:53 +0100145notation, i.e., control-h may be specified as \*(``^H\*('' or \*(``^h\*(''.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530146.
147.SH SETTING THE ENVIRONMENT
148It is often desirable to enter the terminal type and information about
149the terminal's capabilities into the shell's environment.
Steve Kondikae271bc2015-11-15 02:50:53 +0100150This is done using the \fB\-s\fR option.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530151.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100152When the \fB\-s\fR option is specified, the commands to enter the information
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530153into the shell's environment are written to the standard output. If
Steve Kondikae271bc2015-11-15 02:50:53 +0100154the \fBSHELL\fR environmental variable ends in \*(``csh\*('', the commands
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530155are for \fBcsh\fR, otherwise, they are for \fBsh\fR.
156Note, the \fBcsh\fR commands set and unset the shell variable
157\fBnoglob\fR, leaving it unset. The following line in the \fB.login\fR
158or \fB.profile\fR files will initialize the environment correctly:
159.sp
Steve Kondikae271bc2015-11-15 02:50:53 +0100160 eval \`@TSET@ \-s options ... \`
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530161.
162.SH TERMINAL TYPE MAPPING
163When the terminal is not hardwired into the system (or the current
164system information is incorrect) the terminal type derived from the
165\fI/etc/ttys\fR file or the \fBTERM\fR environmental variable is often
166something generic like \fBnetwork\fR, \fBdialup\fR, or \fBunknown\fR.
Steve Kondikae271bc2015-11-15 02:50:53 +0100167When \fB@TSET@\fR is used in a startup script it is often desirable to
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530168provide information about the type of terminal used on such ports.
169.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100170The purpose of the \fB\-m\fR option is to map
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530171from some set of conditions to a terminal type, that is, to
Steve Kondikae271bc2015-11-15 02:50:53 +0100172tell \fB@TSET@\fR
173\*(``If I'm on this port at a particular speed,
174guess that I'm on that kind of terminal\*(''.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530175.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100176The argument to the \fB\-m\fR option consists of an optional port type, an
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530177optional operator, an optional baud rate specification, an optional
Steve Kondikae271bc2015-11-15 02:50:53 +0100178colon (\*(``:\*('') character and a terminal type. The port type is a
179string (delimited by either the operator or the colon character).
180The operator may be any combination of
181\*(``>\*('',
182\*(``<\*('',
183\*(``@\*('',
184and \*(``!\*('';
185\*(``>\*('' means greater than,
186\*(``<\*('' means less than,
187\*(``@\*('' means equal to and
188\*(``!\*('' inverts the sense of the test.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530189The baud rate is specified as a number and is compared with the speed
190of the standard error output (which should be the control terminal).
191The terminal type is a string.
192.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100193If the terminal type is not specified on the command line, the \fB\-m\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530194mappings are applied to the terminal type. If the port type and baud
195rate match the mapping, the terminal type specified in the mapping
196replaces the current type. If more than one mapping is specified, the
197first applicable mapping is used.
198.PP
199For example, consider the following mapping: \fBdialup>9600:vt100\fR.
200The port type is dialup , the operator is >, the baud rate
201specification is 9600, and the terminal type is vt100. The result of
202this mapping is to specify that if the terminal type is \fBdialup\fR,
203and the baud rate is greater than 9600 baud, a terminal type of
204\fBvt100\fR will be used.
205.PP
206If no baud rate is specified, the terminal type will match any baud rate.
207If no port type is specified, the terminal type will match any port type.
Steve Kondikae271bc2015-11-15 02:50:53 +0100208For example, \fB\-m dialup:vt100 \-m :?xterm\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530209will cause any dialup port, regardless of baud rate, to match the terminal
210type vt100, and any non-dialup port type to match the terminal type ?xterm.
211Note, because of the leading question mark, the user will be
212queried on a default port as to whether they are actually using an xterm
213terminal.
214.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100215No whitespace characters are permitted in the \fB\-m\fR option argument.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530216Also, to avoid problems with meta-characters, it is suggested that the
Steve Kondikae271bc2015-11-15 02:50:53 +0100217entire \fB\-m\fR option argument be placed within single quote characters,
218and that \fBcsh\fR users insert a backslash character (\*(``\e\*('') before
219any exclamation marks (\*(``!\*('').
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530220.SH HISTORY
Steve Kondikae271bc2015-11-15 02:50:53 +0100221The \fB@TSET@\fR command appeared in BSD 3.0. The \fBncurses\fR implementation
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530222was lightly adapted from the 4.4BSD sources for a terminfo environment by Eric
223S. Raymond <esr@snark.thyrsus.com>.
224.SH COMPATIBILITY
Steve Kondikae271bc2015-11-15 02:50:53 +0100225The \fB@TSET@\fR utility has been provided for backward-compatibility with BSD
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530226environments (under most modern UNIXes, \fB/etc/inittab\fR and \fIgetty\fR(1)
227can set \fBTERM\fR appropriately for each dial-up line; this obviates what was
Steve Kondikae271bc2015-11-15 02:50:53 +0100228\fB@TSET@\fR's most important use). This implementation behaves like 4.4BSD
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530229tset, with a few exceptions specified here.
230.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100231The \fB\-S\fR option of BSD tset no longer works;
232it prints an error message to stderr and dies.
233The \fB\-s\fR option only sets \fBTERM\fR, not \fBTERMCAP\fP.
234Both of these changes are because the \fBTERMCAP\fR variable
235is no longer supported under terminfo-based \fBncurses\fR,
236which makes \fB@TSET@ \-S\fR useless
237(we made it die noisily rather than silently induce lossage).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530238.PP
239There was an undocumented 4.4BSD feature that invoking tset via a link named
240`TSET` (or via any other name beginning with an upper-case letter) set the
241terminal to use upper-case only. This feature has been omitted.
242.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100243The \fB\-A\fR, \fB\-E\fR, \fB\-h\fR, \fB\-u\fR and \fB\-v\fR
244options were deleted from the \fB@TSET@\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530245utility in 4.4BSD.
246None of them were documented in 4.3BSD and all are
247of limited utility at best.
Steve Kondikae271bc2015-11-15 02:50:53 +0100248The \fB\-a\fR, \fB\-d\fR, and \fB\-p\fR options are similarly
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530249not documented or useful, but were retained as they appear to be in
250widespread use. It is strongly recommended that any usage of these
Steve Kondikae271bc2015-11-15 02:50:53 +0100251three options be changed to use the \fB\-m\fR option instead.
252The \fB\-n\fP option remains, but has no effect.
253The \fB\-adnp\fR options are therefore omitted from the usage summary above.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530254.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100255It is still permissible to specify the \fB\-e\fR, \fB\-i\fR,
256and \fB\-k\fR options without arguments,
257although it is strongly recommended that such usage be fixed to
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530258explicitly specify the character.
259.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100260As of 4.4BSD,
261executing \fB@TSET@\fR as \fBreset\fR no longer implies the \fB\-Q\fR option.
262Also, the interaction between the \- option and the \fIterminal\fR
263argument in some historic implementations of \fB@TSET@\fR has been removed.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530264.SH ENVIRONMENT
Steve Kondikae271bc2015-11-15 02:50:53 +0100265The \fB@TSET@\fR command uses these environment variables:
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530266.TP 5
267SHELL
Steve Kondikae271bc2015-11-15 02:50:53 +0100268tells \fB@TSET@\fP whether to initialize \fBTERM\fP using \fBsh\fP or
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530269\fBcsh\fP syntax.
270.TP 5
271TERM
272Denotes your terminal type.
273Each terminal type is distinct, though many are similar.
274.TP 5
275TERMCAP
276may denote the location of a termcap database.
277If it is not an absolute pathname, e.g., begins with a `/',
Steve Kondikae271bc2015-11-15 02:50:53 +0100278\fB@TSET@\fP removes the variable from the environment before looking
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530279for the terminal description.
280.SH FILES
281.TP 5
282/etc/ttys
283system port name to terminal type mapping database (BSD versions only).
284.TP
285@TERMINFO@
286terminal capability database
287.SH SEE ALSO
Steve Kondikae271bc2015-11-15 02:50:53 +0100288.hy 0
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530289csh(1),
290sh(1),
291stty(1),
292curs_terminfo(3X),
293tty(4),
294terminfo(5),
295ttys(5),
296environ(7)
Steve Kondikae271bc2015-11-15 02:50:53 +0100297.hy
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530298.PP
299This describes \fBncurses\fR
300version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).