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