2 ****************************************************************************
3 * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************
29 * @Id: tset.1,v 1.48 2017/01/14 20:55:07 tom Exp @
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
34 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
35 <meta name="generator" content="Manpage converted by man2html - see http://invisible-island.net/scripts/readme.html#others_scripts">
37 <link rev=made href="mailto:bug-ncurses@gnu.org">
38 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
41 <H1 class="no-header">tset 1</H1>
43 <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG> <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>
48 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
49 <STRONG>tset</STRONG>, <STRONG>reset</STRONG> - terminal initialization
52 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
53 <STRONG>tset</STRONG> [<STRONG>-IQVcqrsw</STRONG>] [<STRONG>-</STRONG>] [<STRONG>-e</STRONG> <EM>ch</EM>] [<STRONG>-i</STRONG> <EM>ch</EM>] [<STRONG>-k</STRONG> <EM>ch</EM>] [<STRONG>-m</STRONG> <EM>mapping</EM>]
55 <STRONG>reset</STRONG> [<STRONG>-IQVcqrsw</STRONG>] [<STRONG>-</STRONG>] [<STRONG>-e</STRONG> <EM>ch</EM>] [<STRONG>-i</STRONG> <EM>ch</EM>] [<STRONG>-k</STRONG> <EM>ch</EM>] [<STRONG>-m</STRONG> <EM>mapping</EM>]
59 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
61 </PRE><H3><a name="h3-tset---initialization">tset - initialization</a></H3><PRE>
62 This program initializes terminals.
64 First, <STRONG>tset</STRONG> retrieves the current terminal mode settings
65 for your terminal. It does this by successively testing
67 <STRONG>o</STRONG> the standard error,
69 <STRONG>o</STRONG> standard output,
71 <STRONG>o</STRONG> standard input and
73 <STRONG>o</STRONG> ultimately "/dev/tty"
75 to obtain terminal settings. Having retrieved these set-
76 tings, <STRONG>tset</STRONG> remembers which file descriptor to use when
79 Next, <STRONG>tset</STRONG> determines the type of terminal that you are
80 using. This determination is done as follows, using the
81 first terminal type found.
83 1. The <STRONG>terminal</STRONG> argument specified on the command line.
85 2. The value of the <STRONG>TERM</STRONG> environmental variable.
87 3. (BSD systems only.) The terminal type associated with
88 the standard error output device in the <EM>/etc/ttys</EM> file.
89 (On System-V-like UNIXes and systems using that conven-
90 tion, <EM>getty</EM> does this job by setting <STRONG>TERM</STRONG> according to the
91 type passed to it by <EM>/etc/inittab</EM>.)
93 4. The default terminal type, "unknown".
95 If the terminal type was not specified on the command-
96 line, the <STRONG>-m</STRONG> option mappings are then applied (see the
97 section <STRONG>TERMINAL</STRONG> <STRONG>TYPE</STRONG> <STRONG>MAPPING</STRONG> for more information).
98 Then, if the terminal type begins with a question mark
99 ("?"), the user is prompted for confirmation of the termi-
100 nal type. An empty response confirms the type, or,
101 another type can be entered to specify a new type. Once
102 the terminal type has been determined, the terminal
103 description for the terminal is retrieved. If no terminal
104 description is found for the type, the user is prompted
105 for another terminal type.
107 Once the terminal description is retrieved,
109 <STRONG>o</STRONG> if the "<STRONG>-w</STRONG>" option is enabled, <STRONG>tset</STRONG> may update the
110 terminal's window size.
112 If the window size cannot be obtained from the operat-
113 ing system, but the terminal description (or environ-
114 ment, e.g., <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> variables specify this),
115 use this to set the operating system's notion of the
118 <STRONG>o</STRONG> if the "<STRONG>-c</STRONG>" option is enabled, the backspace, inter-
119 rupt and line kill characters (among many other
122 <STRONG>o</STRONG> unless the "<STRONG>-I</STRONG>" option is enabled, the terminal and
123 tab <EM>initialization</EM> strings are sent to the standard
124 error output, and <STRONG>tset</STRONG> waits one second (in case a
125 hardware reset was issued).
127 <STRONG>o</STRONG> Finally, if the erase, interrupt and line kill charac-
128 ters have changed, or are not set to their default
129 values, their values are displayed to the standard
133 </PRE><H3><a name="h3-reset---reinitialization">reset - reinitialization</a></H3><PRE>
134 When invoked as <STRONG>reset</STRONG>, <STRONG>tset</STRONG> sets the terminal modes to
137 <STRONG>o</STRONG> sets cooked and echo modes,
139 <STRONG>o</STRONG> turns off cbreak and raw modes,
141 <STRONG>o</STRONG> turns on newline translation and
143 <STRONG>o</STRONG> resets any unset special characters to their default
146 before doing the terminal initialization described above.
147 Also, rather than using the terminal <EM>initialization</EM>
148 strings, it uses the terminal <EM>reset</EM> strings.
150 The <STRONG>reset</STRONG> command is useful after a program dies leaving a
151 terminal in an abnormal state:
153 <STRONG>o</STRONG> you may have to type
155 <EM><LF></EM><STRONG>reset</STRONG><EM><LF></EM>
157 (the line-feed character is normally control-J) to get
158 the terminal to work, as carriage-return may no longer
159 work in the abnormal state.
161 <STRONG>o</STRONG> Also, the terminal will often not echo the command.
164 </PRE><H2><a name="h2-OPTIONS">OPTIONS</a></H2><PRE>
165 The options are as follows:
167 <STRONG>-c</STRONG> Set control characters and modes.
169 <STRONG>-e</STRONG> Set the erase character to <EM>ch</EM>.
171 <STRONG>-I</STRONG> Do not send the terminal or tab initialization
172 strings to the terminal.
174 <STRONG>-i</STRONG> Set the interrupt character to <EM>ch</EM>.
176 <STRONG>-k</STRONG> Set the line kill character to <EM>ch</EM>.
178 <STRONG>-m</STRONG> Specify a mapping from a port type to a terminal.
179 See the section <STRONG>TERMINAL</STRONG> <STRONG>TYPE</STRONG> <STRONG>MAPPING</STRONG> for more infor-
182 <STRONG>-Q</STRONG> Do not display any values for the erase, interrupt
183 and line kill characters. Normally <STRONG>tset</STRONG> displays the
184 values for control characters which differ from the
185 system's default values.
187 <STRONG>-q</STRONG> The terminal type is displayed to the standard out-
188 put, and the terminal is not initialized in any way.
189 The option "-" by itself is equivalent but archaic.
191 <STRONG>-r</STRONG> Print the terminal type to the standard error output.
193 <STRONG>-s</STRONG> Print the sequence of shell commands to initialize
194 the environment variable <STRONG>TERM</STRONG> to the standard output.
195 See the section <STRONG>SETTING</STRONG> <STRONG>THE</STRONG> <STRONG>ENVIRONMENT</STRONG> for details.
197 <STRONG>-V</STRONG> reports the version of ncurses which was used in this
200 <STRONG>-w</STRONG> Resize the window to match the size deduced via
201 <STRONG><A HREF="curs_terminfo.3x.html">setupterm(3x)</A></STRONG>. Normally this has no effect, unless
202 <STRONG>setupterm</STRONG> is not able to detect the window size.
204 The arguments for the <STRONG>-e</STRONG>, <STRONG>-i</STRONG>, and <STRONG>-k</STRONG> options may either be
205 entered as actual characters or by using the "hat" nota-
206 tion, i.e., control-h may be specified as "^H" or "^h".
208 If neither <STRONG>-c</STRONG> or <STRONG>-w</STRONG> is given, both options are assumed.
211 </PRE><H2><a name="h2-SETTING-THE-ENVIRONMENT">SETTING THE ENVIRONMENT</a></H2><PRE>
212 It is often desirable to enter the terminal type and
213 information about the terminal's capabilities into the
214 shell's environment. This is done using the <STRONG>-s</STRONG> option.
216 When the <STRONG>-s</STRONG> option is specified, the commands to enter the
217 information into the shell's environment are written to
218 the standard output. If the <STRONG>SHELL</STRONG> environmental variable
219 ends in "csh", the commands are for <STRONG>csh</STRONG>, otherwise, they
220 are for <STRONG>sh</STRONG>. Note, the <STRONG>csh</STRONG> commands set and unset the
221 shell variable <STRONG>noglob</STRONG>, leaving it unset. The following
222 line in the <STRONG>.login</STRONG> or <STRONG>.profile</STRONG> files will initialize the
223 environment correctly:
225 eval `tset -s options ... `
228 </PRE><H2><a name="h2-TERMINAL-TYPE-MAPPING">TERMINAL TYPE MAPPING</a></H2><PRE>
229 When the terminal is not hardwired into the system (or the
230 current system information is incorrect) the terminal type
231 derived from the <EM>/etc/ttys</EM> file or the <STRONG>TERM</STRONG> environmental
232 variable is often something generic like <STRONG>network</STRONG>, <STRONG>dialup</STRONG>,
233 or <STRONG>unknown</STRONG>. When <STRONG>tset</STRONG> is used in a startup script it is
234 often desirable to provide information about the type of
235 terminal used on such ports.
237 The <STRONG>-m</STRONG> options maps from some set of conditions to a ter-
238 minal type, that is, to tell <STRONG>tset</STRONG> "If I'm on this port at
239 a particular speed, guess that I'm on that kind of termi-
242 The argument to the <STRONG>-m</STRONG> option consists of an optional port
243 type, an optional operator, an optional baud rate specifi-
244 cation, an optional colon (":") character and a terminal
245 type. The port type is a string (delimited by either the
246 operator or the colon character). The operator may be any
247 combination of ">", "<", "@", and "!"; ">" means greater
248 than, "<" means less than, "@" means equal to and "!"
249 inverts the sense of the test. The baud rate is specified
250 as a number and is compared with the speed of the standard
251 error output (which should be the control terminal). The
252 terminal type is a string.
254 If the terminal type is not specified on the command line,
255 the <STRONG>-m</STRONG> mappings are applied to the terminal type. If the
256 port type and baud rate match the mapping, the terminal
257 type specified in the mapping replaces the current type.
258 If more than one mapping is specified, the first applica-
261 For example, consider the following mapping:
262 <STRONG>dialup>9600:vt100</STRONG>. The port type is dialup , the operator
263 is >, the baud rate specification is 9600, and the termi-
264 nal type is vt100. The result of this mapping is to spec-
265 ify that if the terminal type is <STRONG>dialup</STRONG>, and the baud rate
266 is greater than 9600 baud, a terminal type of <STRONG>vt100</STRONG> will
269 If no baud rate is specified, the terminal type will match
270 any baud rate. If no port type is specified, the terminal
271 type will match any port type. For example, <STRONG>-m</STRONG>
272 <STRONG>dialup:vt100</STRONG> <STRONG>-m</STRONG> <STRONG>:?xterm</STRONG> will cause any dialup port,
273 regardless of baud rate, to match the terminal type vt100,
274 and any non-dialup port type to match the terminal type
275 ?xterm. Note, because of the leading question mark, the
276 user will be queried on a default port as to whether they
277 are actually using an xterm terminal.
279 No whitespace characters are permitted in the <STRONG>-m</STRONG> option
280 argument. Also, to avoid problems with meta-characters,
281 it is suggested that the entire <STRONG>-m</STRONG> option argument be
282 placed within single quote characters, and that <STRONG>csh</STRONG> users
283 insert a backslash character ("\") before any exclamation
287 </PRE><H2><a name="h2-HISTORY">HISTORY</a></H2><PRE>
288 A <STRONG>reset</STRONG> command appeared in 2BSD (April 1979), written by
289 Kurt Shoens. This program set the <EM>erase</EM> and <EM>kill</EM> charac-
290 ters to <STRONG>^H</STRONG> (backspace) and <STRONG>@</STRONG> respectively. Mark Horton
291 improved that in 3BSD (October 1979), adding <EM>intr</EM>, <EM>quit</EM>,
292 <EM>start</EM>/<EM>stop</EM> and <EM>eof</EM> characters as well as changing the pro-
293 gram to avoid modifying any user settings.
295 Later in 4.1BSD (December 1980), Mark Horton added a call
296 to the <STRONG>tset</STRONG> program using the <STRONG>-I</STRONG> and <STRONG>-Q</STRONG> options, i.e.,
297 using that to improve the terminal modes. With those
298 options, that version of <STRONG>reset</STRONG> did not use the termcap
301 A separate <STRONG>tset</STRONG> command was provided in 2BSD by Eric All-
302 man. While the oldest published source (from 1979) pro-
303 vides both <STRONG>tset</STRONG> and <STRONG>reset</STRONG>, Allman's comments in the 2BSD
304 source code indicate that he began work in October 1977,
305 continuing development over the next few years.
307 In September 1980, Eric Allman modified <STRONG>tset</STRONG>, adding the
308 code from the existing "reset" feature when <STRONG>tset</STRONG> was
309 invoked as <STRONG>reset</STRONG>. Rather than simply copying the existing
310 program, in this merged version, <STRONG>tset</STRONG> used the termcap
311 database to do additional (re)initialization of the termi-
312 nal. This version appeared in 4.1cBSD, late in 1982.
314 Other developers (e.g., Keith Bostic and Jim Bloom) con-
315 tinued to modify <STRONG>tset</STRONG> until 4.4BSD was released in 1993.
317 The <STRONG>ncurses</STRONG> implementation was lightly adapted from the
318 4.4BSD sources for a terminfo environment by Eric S. Ray-
319 mond <esr@snark.thyrsus.com>.
322 </PRE><H2><a name="h2-COMPATIBILITY">COMPATIBILITY</a></H2><PRE>
323 Neither IEEE Std 1003.1/The Open Group Base Specifications
324 Issue 7 (POSIX.1-2008) nor X/Open Curses Issue 7 documents
325 <STRONG>tset</STRONG> or <STRONG>reset</STRONG>.
327 The AT&T <STRONG>tput</STRONG> utility (AIX, HPUX, Solaris) incorporated
328 the terminal-mode manipulation as well as termcap-based
329 features such as resetting tabstops from <STRONG>tset</STRONG> in BSD
330 (4.1c), presumably with the intention of making <STRONG>tset</STRONG> obso-
331 lete. However, each of those systems still provides <STRONG>tset</STRONG>.
332 In fact, the commonly-used <STRONG>reset</STRONG> utility is always an
333 alias for <STRONG>tset</STRONG>.
335 The <STRONG>tset</STRONG> utility provides for backward-compatibility with
336 BSD environments (under most modern UNIXes, <STRONG>/etc/inittab</STRONG>
337 and <STRONG>getty(1)</STRONG> can set <STRONG>TERM</STRONG> appropriately for each dial-up
338 line; this obviates what was <STRONG>tset</STRONG>'s most important use).
339 This implementation behaves like 4.4BSD <STRONG>tset</STRONG>, with a few
340 exceptions specified here.
342 A few options are different because the <STRONG>TERMCAP</STRONG> variable
343 is no longer supported under terminfo-based <STRONG>ncurses</STRONG>:
345 <STRONG>o</STRONG> The <STRONG>-S</STRONG> option of BSD <STRONG>tset</STRONG> no longer works; it prints
346 an error message to the standard error and dies.
348 <STRONG>o</STRONG> The <STRONG>-s</STRONG> option only sets <STRONG>TERM</STRONG>, not <STRONG>TERMCAP</STRONG>.
350 There was an undocumented 4.4BSD feature that invoking
351 <STRONG>tset</STRONG> via a link named "TSET" (or via any other name begin-
352 ning with an upper-case letter) set the terminal to use
353 upper-case only. This feature has been omitted.
355 The <STRONG>-A</STRONG>, <STRONG>-E</STRONG>, <STRONG>-h</STRONG>, <STRONG>-u</STRONG> and <STRONG>-v</STRONG> options were deleted from the
356 <STRONG>tset</STRONG> utility in 4.4BSD. None of them were documented in
357 4.3BSD and all are of limited utility at best. The <STRONG>-a</STRONG>,
358 <STRONG>-d</STRONG>, and <STRONG>-p</STRONG> options are similarly not documented or useful,
359 but were retained as they appear to be in widespread use.
360 It is strongly recommended that any usage of these three
361 options be changed to use the <STRONG>-m</STRONG> option instead. The <STRONG>-a</STRONG>,
362 <STRONG>-d</STRONG>, and <STRONG>-p</STRONG> options are therefore omitted from the usage
365 Very old systems, e.g., 3BSD, used a different terminal
366 driver which was replaced in 4BSD in the early 1980s. To
367 accommodate these older systems, the 4BSD <STRONG>tset</STRONG> provided a
368 <STRONG>-n</STRONG> option to specify that the new terminal driver should
369 be used. This implementation does not provide that
372 It is still permissible to specify the <STRONG>-e</STRONG>, <STRONG>-i</STRONG>, and <STRONG>-k</STRONG>
373 options without arguments, although it is strongly recom-
374 mended that such usage be fixed to explicitly specify the
377 As of 4.4BSD, executing <STRONG>tset</STRONG> as <STRONG>reset</STRONG> no longer implies
378 the <STRONG>-Q</STRONG> option. Also, the interaction between the - option
379 and the <EM>terminal</EM> argument in some historic implementations
380 of <STRONG>tset</STRONG> has been removed.
382 The <STRONG>-c</STRONG> and <STRONG>-w</STRONG> options are not found in earlier implementa-
383 tions. However, a different window size-change feature
384 was provided in 4.4BSD.
386 <STRONG>o</STRONG> In 4.4BSD, <STRONG>tset</STRONG> uses the window size from the termcap
387 description to set the window size if <STRONG>tset</STRONG> is not able
388 to obtain the window size from the operating system.
390 <STRONG>o</STRONG> In ncurses, <STRONG>tset</STRONG> obtains the window size using
391 <STRONG>setupterm</STRONG>, which may be from the operating system, the
392 <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> environment variables or the termi-
395 Obtaining the window size from the terminal description is
396 common to both implementations, but considered obsoles-
397 cent. Its only practical use is for hardware terminals.
398 Generally speaking, a window size would be unset only if
399 there were some problem obtaining the value from the oper-
400 ating system (and <STRONG>setupterm</STRONG> would still fail). For that
401 reason, the <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> environment variables may be
402 useful for working around window-size problems. Those
403 have the drawback that if the window is resized, those
404 variables must be recomputed and reassigned. To do this
405 more easily, use the <STRONG><A HREF="resize.1.html">resize(1)</A></STRONG> program.
408 </PRE><H2><a name="h2-ENVIRONMENT">ENVIRONMENT</a></H2><PRE>
409 The <STRONG>tset</STRONG> command uses these environment variables:
412 tells <STRONG>tset</STRONG> whether to initialize <STRONG>TERM</STRONG> using <STRONG>sh</STRONG> or <STRONG>csh</STRONG>
415 TERM Denotes your terminal type. Each terminal type is
416 distinct, though many are similar.
419 may denote the location of a termcap database. If it
420 is not an absolute pathname, e.g., begins with a "/",
421 <STRONG>tset</STRONG> removes the variable from the environment before
422 looking for the terminal description.
425 </PRE><H2><a name="h2-FILES">FILES</a></H2><PRE>
427 system port name to terminal type mapping database
431 terminal capability database
434 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
435 <STRONG>csh(1)</STRONG>, <STRONG>sh(1)</STRONG>, <STRONG>stty(1)</STRONG>, <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>, <STRONG>tty(4)</STRONG>,
436 <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>, <STRONG>ttys(5)</STRONG>, <STRONG>environ(7)</STRONG>
438 This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20170304).
442 <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>
446 <li><a href="#h2-NAME">NAME</a></li>
447 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
448 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
450 <li><a href="#h3-tset---initialization">tset - initialization</a></li>
451 <li><a href="#h3-reset---reinitialization">reset - reinitialization</a></li>
454 <li><a href="#h2-OPTIONS">OPTIONS</a></li>
455 <li><a href="#h2-SETTING-THE-ENVIRONMENT">SETTING THE ENVIRONMENT</a></li>
456 <li><a href="#h2-TERMINAL-TYPE-MAPPING">TERMINAL TYPE MAPPING</a></li>
457 <li><a href="#h2-HISTORY">HISTORY</a></li>
458 <li><a href="#h2-COMPATIBILITY">COMPATIBILITY</a></li>
459 <li><a href="#h2-ENVIRONMENT">ENVIRONMENT</a></li>
460 <li><a href="#h2-FILES">FILES</a></li>
461 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>