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