]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/tset.1.html
ncurses 6.0 - patch 20161224
[ncurses.git] / doc / html / man / tset.1.html
1 <!-- 
2   ****************************************************************************
3   * Copyright (c) 1998-2013,2016 Free Software Foundation, Inc.              *
4   *                                                                          *
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:                 *
12   *                                                                          *
13   * The above copyright notice and this permission notice shall be included  *
14   * in all copies or substantial portions of the Software.                   *
15   *                                                                          *
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.                               *
23   *                                                                          *
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       *
27   * authorization.                                                           *
28   ****************************************************************************
29   * @Id: tset.1,v 1.43 2016/08/06 23:16:39 tom Exp @
30 -->
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
32 <HTML>
33 <HEAD>
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">
36 <TITLE>tset 1</TITLE>
37 <link rev=made href="mailto:bug-ncurses@gnu.org">
38 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
39 </HEAD>
40 <BODY>
41 <H1 class="no-header">tset 1</H1>
42 <PRE>
43 <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>                                                         <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>
44
45
46
47
48 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
49        <STRONG>tset</STRONG>, <STRONG>reset</STRONG> - terminal initialization
50
51
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>]
54        [<EM>terminal</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>]
56        [<EM>terminal</EM>]
57
58
59 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
60
61 </PRE><H3><a name="h3-tset---initialization">tset - initialization</a></H3><PRE>
62        This program initializes terminals.
63
64        First,  <STRONG>tset</STRONG>  retrieves the current terminal mode settings
65        for your terminal.  It does this by successively testing
66
67        <STRONG>o</STRONG>   the standard error,
68
69        <STRONG>o</STRONG>   standard output,
70
71        <STRONG>o</STRONG>   standard input and
72
73        <STRONG>o</STRONG>   ultimately "/dev/tty"
74
75        to obtain terminal settings.  Having retrieved these  set-
76        tings,  <STRONG>tset</STRONG>  remembers  which file descriptor to use when
77        updating settings.
78
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.
82
83        1. The <STRONG>terminal</STRONG> argument specified on the command line.
84
85        2. The value of the <STRONG>TERM</STRONG> environmental variable.
86
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>.)
92
93        4. The default terminal type, "unknown".
94
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 terminfo entry
103        for the terminal is retrieved.  If no  terminfo  entry  is
104        found  for the type, the user is prompted for another ter-
105        minal type.
106
107        Once the terminfo entry is  retrieved,  the  window  size,
108        backspace,  interrupt and line kill characters (among many
109        other things) are set and the terminal and tab initializa-
110        tion  strings  are  sent  to  the  standard  error output.
111        Finally, if the erase, interrupt and line kill  characters
112        have  changed,  or  are  not  set to their default values,
113        their values are displayed to the standard error output.
114
115
116 </PRE><H3><a name="h3-reset---reinitialization">reset - reinitialization</a></H3><PRE>
117        When invoked as <STRONG>reset</STRONG>, <STRONG>tset</STRONG> sets cooked  and  echo  modes,
118        turns  off cbreak and raw modes, turns on newline transla-
119        tion and resets any  unset  special  characters  to  their
120        default  values  before  doing the terminal initialization
121        described above.  This is  useful  after  a  program  dies
122        leaving  a  terminal  in an abnormal state.  Note, you may
123        have to type
124
125            <EM>&lt;LF&gt;</EM><STRONG>reset</STRONG><EM>&lt;LF&gt;</EM>
126
127        (the line-feed character is normally control-J) to get the
128        terminal to work, as carriage-return may no longer work in
129        the abnormal state.  Also, the  terminal  will  often  not
130        echo the command.
131
132
133 </PRE><H2><a name="h2-OPTIONS">OPTIONS</a></H2><PRE>
134        The options are as follows:
135
136        <STRONG>-c</STRONG>   Set control characters and modes.
137
138        <STRONG>-e</STRONG>   Set the erase character to <EM>ch</EM>.
139
140        <STRONG>-I</STRONG>   Do  not  send  the  terminal  or  tab  initialization
141             strings to the terminal.
142
143        <STRONG>-i</STRONG>   Set the interrupt character to <EM>ch</EM>.
144
145        <STRONG>-k</STRONG>   Set the line kill character to <EM>ch</EM>.
146
147        <STRONG>-m</STRONG>   Specify a mapping from a port  type  to  a  terminal.
148             See the section <STRONG>TERMINAL</STRONG> <STRONG>TYPE</STRONG> <STRONG>MAPPING</STRONG> for more infor-
149             mation.
150
151        <STRONG>-Q</STRONG>   Do not display any values for  the  erase,  interrupt
152             and line kill characters.  Normally <STRONG>tset</STRONG> displays the
153             values for control characters which differ  from  the
154             system's default values.
155
156        <STRONG>-q</STRONG>   The  terminal  type is displayed to the standard out-
157             put, and the terminal is not initialized in any  way.
158             The option "-" by itself is equivalent but archaic.
159
160        <STRONG>-r</STRONG>   Print the terminal type to the standard error output.
161
162        <STRONG>-s</STRONG>   Print  the  sequence  of shell commands to initialize
163             the environment variable <STRONG>TERM</STRONG> to the standard output.
164             See the section <STRONG>SETTING</STRONG> <STRONG>THE</STRONG> <STRONG>ENVIRONMENT</STRONG> for details.
165
166        <STRONG>-V</STRONG>   reports the version of ncurses which was used in this
167             program, and exits.
168
169        <STRONG>-w</STRONG>   Resize the window  to  match  the  size  deduced  via
170             <STRONG>setupterm</STRONG>.   Normally  this  has  no  effect,  unless
171             <STRONG>setupterm</STRONG> is not able to detect the window size.
172
173        The arguments for the <STRONG>-e</STRONG>, <STRONG>-i</STRONG>, and <STRONG>-k</STRONG> options may either be
174        entered  as  actual characters or by using the "hat" nota-
175        tion, i.e., control-h may be specified as "^H" or "^h".
176
177        If neither <STRONG>-c</STRONG> or <STRONG>-w</STRONG> is given, both options are assumed.
178
179
180 </PRE><H2><a name="h2-SETTING-THE-ENVIRONMENT">SETTING THE ENVIRONMENT</a></H2><PRE>
181        It is often desirable  to  enter  the  terminal  type  and
182        information  about  the  terminal's  capabilities into the
183        shell's environment.  This is done using the <STRONG>-s</STRONG> option.
184
185        When the <STRONG>-s</STRONG> option is specified, the commands to enter the
186        information  into  the  shell's environment are written to
187        the standard output.  If the <STRONG>SHELL</STRONG> environmental  variable
188        ends  in  "csh", the commands are for <STRONG>csh</STRONG>, otherwise, they
189        are for <STRONG>sh</STRONG>.  Note, the <STRONG>csh</STRONG>  commands  set  and  unset  the
190        shell  variable  <STRONG>noglob</STRONG>,  leaving it unset.  The following
191        line in the <STRONG>.login</STRONG> or <STRONG>.profile</STRONG> files will  initialize  the
192        environment correctly:
193
194            eval `tset -s options ... `
195
196
197 </PRE><H2><a name="h2-TERMINAL-TYPE-MAPPING">TERMINAL TYPE MAPPING</a></H2><PRE>
198        When the terminal is not hardwired into the system (or the
199        current system information is incorrect) the terminal type
200        derived  from the <EM>/etc/ttys</EM> file or the <STRONG>TERM</STRONG> environmental
201        variable is often something generic like <STRONG>network</STRONG>,  <STRONG>dialup</STRONG>,
202        or  <STRONG>unknown</STRONG>.   When <STRONG>tset</STRONG> is used in a startup script it is
203        often desirable to provide information about the  type  of
204        terminal used on such ports.
205
206        The  <STRONG>-m</STRONG> options maps from some set of conditions to a ter-
207        minal type, that is, to tell <STRONG>tset</STRONG> "If I'm on this port  at
208        a  particular speed, guess that I'm on that kind of termi-
209        nal".
210
211        The argument to the <STRONG>-m</STRONG> option consists of an optional port
212        type, an optional operator, an optional baud rate specifi-
213        cation, an optional colon (":") character and  a  terminal
214        type.   The port type is a string (delimited by either the
215        operator or the colon character).  The operator may be any
216        combination  of  "&gt;", "&lt;", "@", and "!"; "&gt;" means greater
217        than, "&lt;" means less than, "@"  means  equal  to  and  "!"
218        inverts the sense of the test.  The baud rate is specified
219        as a number and is compared with the speed of the standard
220        error  output (which should be the control terminal).  The
221        terminal type is a string.
222
223        If the terminal type is not specified on the command line,
224        the  <STRONG>-m</STRONG> mappings are applied to the terminal type.  If the
225        port type and baud rate match the  mapping,  the  terminal
226        type  specified  in the mapping replaces the current type.
227        If more than one mapping is specified, the first  applica-
228        ble mapping is used.
229
230        For    example,    consider    the    following   mapping:
231        <STRONG>dialup&gt;9600:vt100</STRONG>.  The port type is dialup , the operator
232        is  &gt;, the baud rate specification is 9600, and the termi-
233        nal type is vt100.  The result of this mapping is to spec-
234        ify that if the terminal type is <STRONG>dialup</STRONG>, and the baud rate
235        is greater than 9600 baud, a terminal type of  <STRONG>vt100</STRONG>  will
236        be used.
237
238        If no baud rate is specified, the terminal type will match
239        any baud rate.  If no port type is specified, the terminal
240        type   will   match   any  port  type.   For  example,  <STRONG>-m</STRONG>
241        <STRONG>dialup:vt100</STRONG>  <STRONG>-m</STRONG>  <STRONG>:?xterm</STRONG>  will  cause  any  dialup  port,
242        regardless of baud rate, to match the terminal type vt100,
243        and any non-dialup port type to match  the  terminal  type
244        ?xterm.   Note,  because of the leading question mark, the
245        user will be queried on a default port as to whether  they
246        are actually using an xterm terminal.
247
248        No  whitespace  characters  are permitted in the <STRONG>-m</STRONG> option
249        argument.  Also, to avoid problems  with  meta-characters,
250        it  is  suggested  that  the  entire <STRONG>-m</STRONG> option argument be
251        placed within single quote characters, and that <STRONG>csh</STRONG>  users
252        insert  a backslash character ("\") before any exclamation
253        marks ("!").
254
255
256 </PRE><H2><a name="h2-HISTORY">HISTORY</a></H2><PRE>
257        A <STRONG>reset</STRONG> command appeared in 2BSD (1979), written  by  Kurt
258        Shoens.
259
260        A  separate <STRONG>tset</STRONG> command was provided in 2BSD by Eric All-
261        man.  While the oldest published source (from  1979)  pro-
262        vides  both programs, Allman's comments in the 2BSD source
263        code indicate that he began work in October 1977, continu-
264        ing development over the next few years.
265
266        In  1980,  Eric  Allman modified <STRONG>tset</STRONG> to provide a "reset"
267        feature when the program was invoked as <STRONG>reset</STRONG>.
268
269        The <STRONG>ncurses</STRONG> implementation was lightly  adapted  from  the
270        4.4BSD  sources for a terminfo environment by Eric S. Ray-
271        mond &lt;esr@snark.thyrsus.com&gt;.
272
273
274 </PRE><H2><a name="h2-COMPATIBILITY">COMPATIBILITY</a></H2><PRE>
275        Neither IEEE Std 1003.1/The Open Group Base Specifications
276        Issue 7 (POSIX.1-2008) nor X/Open Curses Issue 7 documents
277        <STRONG>tset</STRONG> or <STRONG>reset</STRONG>.
278
279        The AT&amp;T <STRONG>tput</STRONG> utility (AIX,  HPUX,  Solaris)  incorporated
280        the  terminal-mode  manipulation  as well as termcap-based
281        features such as  resetting  tabstops  from  <STRONG>tset</STRONG>  in  BSD
282        (4.1c), presumably with the intention of making <STRONG>tset</STRONG> obso-
283        lete.  However, each of those systems still provides <STRONG>tset</STRONG>.
284        In  fact,  the  commonly-used  <STRONG>reset</STRONG>  utility is always an
285        alias for <STRONG>tset</STRONG>.
286
287        The <STRONG>tset</STRONG> utility provides for backward-compatibility  with
288        BSD  environments  (under most modern UNIXes, <STRONG>/etc/inittab</STRONG>
289        and <STRONG>getty(1)</STRONG> can set <STRONG>TERM</STRONG> appropriately for  each  dial-up
290        line;  this  obviates what was <STRONG>tset</STRONG>'s most important use).
291        This implementation behaves like 4.4BSD <STRONG>tset</STRONG>, with  a  few
292        exceptions specified here.
293
294        A  few  options are different because the <STRONG>TERMCAP</STRONG> variable
295        is no longer supported under terminfo-based <STRONG>ncurses</STRONG>:
296
297        <STRONG>o</STRONG>   The <STRONG>-S</STRONG> option of BSD <STRONG>tset</STRONG> no longer works;  it  prints
298            an error message to the standard error and dies.
299
300        <STRONG>o</STRONG>   The <STRONG>-s</STRONG> option only sets <STRONG>TERM</STRONG>, not <STRONG>TERMCAP</STRONG>.
301
302        There  was  an  undocumented  4.4BSD feature that invoking
303        <STRONG>tset</STRONG> via a link named "TSET" (or via any other name begin-
304        ning  with  an  upper-case letter) set the terminal to use
305        upper-case only.  This feature has been omitted.
306
307        The <STRONG>-A</STRONG>, <STRONG>-E</STRONG>, <STRONG>-h</STRONG>, <STRONG>-u</STRONG> and <STRONG>-v</STRONG> options were  deleted  from  the
308        <STRONG>tset</STRONG>  utility  in 4.4BSD.  None of them were documented in
309        4.3BSD and all are of limited utility at  best.   The  <STRONG>-a</STRONG>,
310        <STRONG>-d</STRONG>, and <STRONG>-p</STRONG> options are similarly not documented or useful,
311        but were retained as they appear to be in widespread  use.
312        It  is  strongly recommended that any usage of these three
313        options be changed to use the <STRONG>-m</STRONG> option instead.  The  <STRONG>-a</STRONG>,
314        <STRONG>-d</STRONG>,  and  <STRONG>-p</STRONG>  options are therefore omitted from the usage
315        summary above.
316
317        Very old systems, e.g., 3BSD, used  a  different  terminal
318        driver  which was replaced in 4BSD in the early 1980s.  To
319        accommodate these older systems, the 4BSD <STRONG>tset</STRONG> provided  a
320        <STRONG>-n</STRONG>  option  to specify that the new terminal driver should
321        be  used.   This  implementation  does  not  provide  that
322        choice.
323
324        It  is  still  permissible  to  specify the <STRONG>-e</STRONG>, <STRONG>-i</STRONG>, and <STRONG>-k</STRONG>
325        options without arguments, although it is strongly  recom-
326        mended  that such usage be fixed to explicitly specify the
327        character.
328
329        As of 4.4BSD, executing <STRONG>tset</STRONG> as <STRONG>reset</STRONG>  no  longer  implies
330        the <STRONG>-Q</STRONG> option.  Also, the interaction between the - option
331        and the <EM>terminal</EM> argument in some historic implementations
332        of <STRONG>tset</STRONG> has been removed.
333
334        The <STRONG>-c</STRONG> and <STRONG>-w</STRONG> options are not found in earlier implementa-
335        tions.  However, a different  window  size-change  feature
336        was provided in 4.4BSD.
337
338        <STRONG>o</STRONG>   In  4.4BSD, <STRONG>tset</STRONG> uses the window size from the termcap
339            description to set the window size if <STRONG>tset</STRONG> is not able
340            to obtain the window size from the operating system.
341
342        <STRONG>o</STRONG>   In   ncurses,  <STRONG>tset</STRONG>  obtains  the  window  size  using
343            <STRONG>setupterm</STRONG>, which may be from the operating system, the
344            <STRONG>LINES</STRONG>  and <STRONG>COLUMNS</STRONG> environment variables or the termi-
345            nal description.
346
347        Obtaining the window size from the terminal description is
348        common  to  both  implementations, but considered obsoles-
349        cent.  Its only practical use is for  hardware  terminals.
350        Generally  speaking,  a window size would be unset only if
351        there were some problem obtaining the value from the oper-
352        ating  system  (and <STRONG>setupterm</STRONG> would still fail).  For that
353        reason, the <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> environment variables may be
354        useful  for  working  around  window-size problems.  Those
355        have the drawback that if the  window  is  resized,  those
356        variables  must  be recomputed and reassigned.  To do this
357        more easily, use the <STRONG><A HREF="resize.1.html">resize(1)</A></STRONG> program.
358
359
360 </PRE><H2><a name="h2-ENVIRONMENT">ENVIRONMENT</a></H2><PRE>
361        The <STRONG>tset</STRONG> command uses these environment variables:
362
363        SHELL
364             tells <STRONG>tset</STRONG> whether to initialize <STRONG>TERM</STRONG> using <STRONG>sh</STRONG> or <STRONG>csh</STRONG>
365             syntax.
366
367        TERM Denotes  your  terminal  type.  Each terminal type is
368             distinct, though many are similar.
369
370        TERMCAP
371             may denote the location of a termcap database.  If it
372             is not an absolute pathname, e.g., begins with a "/",
373             <STRONG>tset</STRONG> removes the variable from the environment before
374             looking for the terminal description.
375
376
377 </PRE><H2><a name="h2-FILES">FILES</a></H2><PRE>
378        /etc/ttys
379             system  port  name  to terminal type mapping database
380             (BSD versions only).
381
382        /usr/share/terminfo
383             terminal capability database
384
385
386 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
387        <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>,
388        <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>, <STRONG>ttys(5)</STRONG>, <STRONG>environ(7)</STRONG>
389
390        This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
391
392
393
394                                                                 <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>
395 </PRE>
396 <div class="nav">
397 <ul>
398 <li><a href="#h2-NAME">NAME</a></li>
399 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
400 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
401 <ul>
402 <li><a href="#h3-tset---initialization">tset - initialization</a></li>
403 <li><a href="#h3-reset---reinitialization">reset - reinitialization</a></li>
404 </ul>
405 </li>
406 <li><a href="#h2-OPTIONS">OPTIONS</a></li>
407 <li><a href="#h2-SETTING-THE-ENVIRONMENT">SETTING THE ENVIRONMENT</a></li>
408 <li><a href="#h2-TERMINAL-TYPE-MAPPING">TERMINAL TYPE MAPPING</a></li>
409 <li><a href="#h2-HISTORY">HISTORY</a></li>
410 <li><a href="#h2-COMPATIBILITY">COMPATIBILITY</a></li>
411 <li><a href="#h2-ENVIRONMENT">ENVIRONMENT</a></li>
412 <li><a href="#h2-FILES">FILES</a></li>
413 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
414 </ul>
415 </div>
416 </BODY>
417 </HTML>