[BACK]Return to tset.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / tset

Annotation of src/usr.bin/tset/tset.1, Revision 1.20

1.20    ! bentley     1: .\"    $OpenBSD: tset.1,v 1.19 2013/09/18 16:21:30 millert Exp $
1.1       deraadt     2: .\"
                      3: .\" Copyright (c) 1985, 1990, 1993
                      4: .\"    The Regents of the University of California.  All rights reserved.
                      5: .\"
                      6: .\" Redistribution and use in source and binary forms, with or without
                      7: .\" modification, are permitted provided that the following conditions
                      8: .\" are met:
                      9: .\" 1. Redistributions of source code must retain the above copyright
                     10: .\"    notice, this list of conditions and the following disclaimer.
                     11: .\" 2. Redistributions in binary form must reproduce the above copyright
                     12: .\"    notice, this list of conditions and the following disclaimer in the
                     13: .\"    documentation and/or other materials provided with the distribution.
1.12      millert    14: .\" 3. Neither the name of the University nor the names of its contributors
1.1       deraadt    15: .\"    may be used to endorse or promote products derived from this software
                     16: .\"    without specific prior written permission.
                     17: .\"
                     18: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     19: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     20: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     21: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     22: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     23: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     24: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     25: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     26: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     27: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     28: .\" SUCH DAMAGE.
                     29: .\"
                     30: .\"    @(#)tset.1      8.1 (Berkeley) 6/9/93
                     31: .\"
1.20    ! bentley    32: .Dd $Mdocdate: September 18 2013 $
1.1       deraadt    33: .Dt TSET 1
1.6       millert    34: .Os
1.1       deraadt    35: .Sh NAME
                     36: .Nm tset
                     37: .Nd terminal initialization
                     38: .Sh SYNOPSIS
                     39: .Nm tset
1.19      millert    40: .Op Fl cIQqrsVw
1.1       deraadt    41: .Op Fl
                     42: .Op Fl e Ar ch
                     43: .Op Fl i Ar ch
                     44: .Op Fl k Ar ch
                     45: .Op Fl m Ar mapping
                     46: .Op Ar terminal
                     47: .Nm reset
1.19      millert    48: .Op Fl cIQqrsVw
1.1       deraadt    49: .Op Fl
                     50: .Op Fl e Ar ch
                     51: .Op Fl i Ar ch
                     52: .Op Fl k Ar ch
                     53: .Op Fl m Ar mapping
                     54: .Op Ar terminal
                     55: .Sh DESCRIPTION
1.5       aaron      56: .Nm tset
1.1       deraadt    57: initializes terminals.
1.5       aaron      58: .Nm tset
1.1       deraadt    59: first determines the type of terminal that you are using.
1.5       aaron      60: This determination is done as follows, using the first terminal type found:
1.6       millert    61: .Bl -enum -offset indent
1.1       deraadt    62: .It
                     63: The
                     64: .Ar terminal
                     65: argument specified on the command line.
                     66: .It
                     67: The value of the
                     68: .Ev TERM
1.2       deraadt    69: environment variable.
1.1       deraadt    70: .It
                     71: The terminal type associated with the standard error output device in the
                     72: .Pa /etc/ttys
                     73: file.
                     74: .It
1.6       millert    75: The default terminal type,
                     76: .Dq unknown .
1.1       deraadt    77: .El
                     78: .Pp
1.7       aaron      79: If the terminal type was not specified on the command line, the
1.1       deraadt    80: .Fl m
1.19      millert    81: option mappings are then applied (see the
                     82: .Sx TERMINAL TYPE MAPPING
                     83: section below for more information).
1.7       aaron      84: Then, if the terminal type begins with a question mark
1.14      jmc        85: .Pq Ql \&? ,
1.7       aaron      86: the user is prompted for confirmation of the terminal type.
1.11      henning    87: An empty response confirms the type, or another type can be entered to
1.1       deraadt    88: specify a new type.
1.19      millert    89: Once the terminal type has been determined, the terminfo entry for the terminal
1.1       deraadt    90: is retrieved.
1.19      millert    91: If no terminfo entry is found for the type, the user is prompted for another
1.1       deraadt    92: terminal type.
                     93: .Pp
1.19      millert    94: Once the terminfo entry is retrieved, the window size, backspace, interrupt,
1.1       deraadt    95: and line kill characters (among many other things) are set and the terminal
                     96: and tab initialization strings are sent to the standard error output.
                     97: Finally, if the erase, interrupt and line kill characters have changed,
                     98: or are not set to their default values, their values are displayed to the
                     99: standard error output.
1.17      nicm      100: Use the
                    101: .Fl c
                    102: or
                    103: .Fl w
                    104: option to select only the window sizing versus the other initialization.
                    105: If neither option is given, both are assumed.
1.1       deraadt   106: .Pp
                    107: When invoked as
                    108: .Nm reset ,
                    109: .Nm tset
                    110: sets cooked and echo modes, turns off cbreak and raw modes, turns on
                    111: newline translation and resets any unset special characters to their
                    112: default values before doing the terminal initialization described above.
1.5       aaron     113: This is useful after a program dies leaving a terminal in an abnormal state.
1.1       deraadt   114: Note, you may have to type
1.7       aaron     115: .Dq <LF>reset<LF>
1.1       deraadt   116: (the line-feed character is normally control-J) to get the terminal
                    117: to work, as carriage-return may no longer work in the abnormal state.
                    118: Also, the terminal will often not echo the command.
                    119: .Pp
                    120: The options are as follows:
1.10      aaron     121: .Bl -tag -width Ds
1.1       deraadt   122: .It Fl
                    123: The terminal type is displayed to the standard output, and the terminal is
1.7       aaron     124: not initialized in any way.
                    125: This option has been deprecated in favor of the
1.6       millert   126: .Fl q
                    127: flag.
1.17      nicm      128: .It Fl c
                    129: Set control characters and modes.
1.5       aaron     130: .It Fl e Ar ch
1.1       deraadt   131: Set the erase character to
                    132: .Ar ch .
                    133: .It Fl I
                    134: Do not send the terminal or tab initialization strings to the terminal.
1.5       aaron     135: .It Fl i Ar ch
1.1       deraadt   136: Set the interrupt character to
                    137: .Ar ch .
1.5       aaron     138: .It Fl k Ar ch
1.1       deraadt   139: Set the line kill character to
                    140: .Ar ch .
1.5       aaron     141: .It Fl m Ar mapping
1.1       deraadt   142: Specify a mapping from a port type to a terminal.
1.19      millert   143: See the
                    144: .Sx TERMINAL TYPE MAPPING
                    145: section below for more information.
1.1       deraadt   146: .It Fl Q
                    147: Don't display any values for the erase, interrupt and line kill characters.
1.17      nicm      148: Normally
                    149: .Nm
                    150: displays the values for control characters which differ from the system's
                    151: default values.
1.6       millert   152: .It Fl q
                    153: The terminal type is displayed to the standard output, and the terminal is
                    154: not initialized in any way.
1.1       deraadt   155: .It Fl r
                    156: Print the terminal type to the standard error output.
                    157: .It Fl s
1.19      millert   158: Print the sequence of shell commands to initialize the environment variable
1.1       deraadt   159: .Ev TERM
                    160: to the standard output.
1.19      millert   161: See the
                    162: .Sx SETTING THE ENVIRONMENT
                    163: section below for details.
1.9       millert   164: .It Fl V
                    165: Report the version of ncurses which was used in this program, and exit.
1.17      nicm      166: .It Fl w
                    167: Resize the window to match the size deduced via
                    168: .Xr setupterm 3 .
                    169: Normally this has no effect, unless
                    170: .Xr setupterm 3
                    171: is not able to detect the window size.
1.1       deraadt   172: .El
                    173: .Pp
                    174: The arguments for the
                    175: .Fl e ,
1.7       aaron     176: .Fl i ,
1.1       deraadt   177: and
                    178: .Fl k
                    179: options may either be entered as actual characters or by using the
                    180: .Dq hat
1.7       aaron     181: notation, i.e., control-H may be specified as
                    182: .Dq ^H
1.1       deraadt   183: or
1.7       aaron     184: .Dq ^h .
1.1       deraadt   185: .Sh SETTING THE ENVIRONMENT
                    186: It is often desirable to enter the terminal type and information about
                    187: the terminal's capabilities into the shell's environment.
                    188: This is done using the
                    189: .Fl s
1.19      millert   190: option.
1.1       deraadt   191: .Pp
                    192: When the
                    193: .Fl s
                    194: option is specified, the commands to enter the information into the
                    195: shell's environment are written to the standard output.
                    196: If the
                    197: .Ev SHELL
1.6       millert   198: environment variable ends in
                    199: .Dq csh ,
                    200: the commands are for
1.5       aaron     201: .Xr csh 1 ,
1.1       deraadt   202: otherwise, they are for
1.5       aaron     203: .Xr sh 1 .
1.1       deraadt   204: Note, the
1.5       aaron     205: .Xr csh 1
1.1       deraadt   206: commands set and unset the shell variable
                    207: .Dq noglob ,
                    208: leaving it unset.
                    209: The following line in the
                    210: .Pa .login
                    211: or
                    212: .Pa .profile
                    213: files will initialize the environment correctly:
                    214: .Bd -literal -offset indent
                    215: eval \`tset -s options ... \`
                    216: .Ed
                    217: .Sh TERMINAL TYPE MAPPING
                    218: When the terminal is not hardwired into the system (or the current system
1.5       aaron     219: information is incorrect), the terminal type derived from the
1.1       deraadt   220: .Pa /etc/ttys
                    221: file or the
                    222: .Ev TERM
1.2       deraadt   223: environment variable is often something generic like
1.1       deraadt   224: .Dq network ,
                    225: .Dq dialup ,
                    226: or
                    227: .Dq unknown .
                    228: When
                    229: .Nm tset
                    230: is used in a startup script
                    231: .Pf ( Pa .profile
                    232: for
                    233: .Xr sh 1
                    234: users or
                    235: .Pa .login
                    236: for
                    237: .Xr csh 1
                    238: users) it is often desirable to provide information about the type of
                    239: terminal used on such ports.
1.6       millert   240: .Pp
1.1       deraadt   241: The purpose of the
                    242: .Fl m
                    243: option is to
                    244: .Dq map
                    245: from some set of conditions to a terminal type, that is, to
                    246: tell
1.20    ! bentley   247: .Nm tset :
        !           248: .Do
        !           249: If I'm on this port at a particular speed, guess that I'm on that
        !           250: kind of terminal
        !           251: .Dc .
1.1       deraadt   252: .Pp
                    253: The argument to the
                    254: .Fl m
                    255: option consists of an optional port type, an optional operator, an optional
1.7       aaron     256: baud rate specification, an optional colon
1.8       aaron     257: .Pq Ql \&:
1.7       aaron     258: character, and a terminal type.
1.1       deraadt   259: The port type is a string (delimited by either the operator or the colon
                    260: character).
                    261: The operator may be any combination of:
1.7       aaron     262: .Ql > ,
                    263: .Ql < ,
                    264: .Ql @ ,
1.1       deraadt   265: and
1.14      jmc       266: .Ql \&! ;
1.7       aaron     267: .Ql >
1.1       deraadt   268: means greater than,
1.7       aaron     269: .Ql <
1.1       deraadt   270: means less than,
1.7       aaron     271: .Ql @
1.5       aaron     272: means equal to,
1.1       deraadt   273: and
1.14      jmc       274: .Ql \&!
1.1       deraadt   275: inverts the sense of the test.
                    276: The baud rate is specified as a number and is compared with the speed
                    277: of the standard error output (which should be the control terminal).
                    278: The terminal type is a string.
                    279: .Pp
                    280: If the terminal type is not specified on the command line, the
                    281: .Fl m
                    282: mappings are applied to the terminal type.
                    283: If the port type and baud rate match the mapping, the terminal type specified
                    284: in the mapping replaces the current type.
                    285: If more than one mapping is specified, the first applicable mapping is used.
                    286: .Pp
                    287: For example, consider the following mapping:
1.7       aaron     288: .Dq dialup>9600:vt100 .
1.1       deraadt   289: The port type is
1.7       aaron     290: .Dq dialup ,
1.1       deraadt   291: the operator is
1.7       aaron     292: .Dq > ,
1.1       deraadt   293: the baud rate specification is
1.7       aaron     294: .Dq 9600 ,
1.1       deraadt   295: and the terminal type is
1.7       aaron     296: .Dq vt100 .
1.1       deraadt   297: The result of this mapping is to specify that if the terminal type is
1.7       aaron     298: .Dq dialup ,
1.1       deraadt   299: and the baud rate is greater than 9600 baud, a terminal type of
1.7       aaron     300: .Dq vt100
1.1       deraadt   301: will be used.
                    302: .Pp
                    303: If no port type is specified, the terminal type will match any port type,
                    304: for example,
1.7       aaron     305: .Dq -m dialup:vt100 -m :?xterm
1.1       deraadt   306: will cause any dialup port, regardless of baud rate, to match the terminal
                    307: type
1.7       aaron     308: .Dq vt100 ,
1.1       deraadt   309: and any non-dialup port type to match the terminal type
1.7       aaron     310: .Dq ?xterm .
1.1       deraadt   311: Note, because of the leading question mark, the user will be
                    312: queried on a default port as to whether they are actually using an
                    313: .Ar xterm
                    314: terminal.
                    315: .Pp
                    316: No whitespace characters are permitted in the
                    317: .Fl m
                    318: option argument.
1.5       aaron     319: Also, to avoid problems with meta-characters, it is suggested that the entire
1.1       deraadt   320: .Fl m
                    321: option argument be placed within single quote characters, and that
1.5       aaron     322: .Xr csh 1
1.7       aaron     323: users insert a backslash character
                    324: .Pq Ql \e
                    325: before any exclamation marks
1.14      jmc       326: .Pq Ql \&! .
1.1       deraadt   327: .Sh ENVIRONMENT
                    328: The
                    329: .Nm tset
                    330: command utilizes the
                    331: .Ev SHELL
                    332: and
                    333: .Ev TERM
                    334: environment variables.
                    335: .Sh FILES
1.19      millert   336: .Bl -tag -width /usr/share/misc/terminfo.db -compact
1.1       deraadt   337: .It Pa /etc/ttys
1.7       aaron     338: port name to terminal type mapping database
1.19      millert   339: .It Pa /usr/share/misc/terminfo.db
1.1       deraadt   340: terminal capability database
                    341: .El
                    342: .Sh SEE ALSO
                    343: .Xr csh 1 ,
                    344: .Xr sh 1 ,
                    345: .Xr stty 1 ,
                    346: .Xr tty 4 ,
1.19      millert   347: .Xr terminfo 5 ,
1.1       deraadt   348: .Xr ttys 5 ,
                    349: .Xr environ 7
1.13      jmc       350: .Sh STANDARDS
1.6       millert   351: The
                    352: .Nm tset
                    353: command now uses the
                    354: .Xr terminfo 5
                    355: database where previous versions used
                    356: .Xr termcap 5 .
1.19      millert   357: .Pp
                    358: Historic versions of the
                    359: .Xr termcap 3
                    360: library limited entries to 1023 bytes.
                    361: Modern
                    362: .Xr terminfo 3
                    363: entries are often much larger, making it impossible to
                    364: store the full entry in the
                    365: .Ev TERMCAP
                    366: environment variable.
                    367: Because of this, the
                    368: .Fl S
                    369: option is no longer supported (it prints an error message to the standard
                    370: error and exits) and the
1.6       millert   371: .Fl s
1.19      millert   372: option only sets
                    373: .Ev TERM ,
                    374: not
                    375: .Ev TERMCAP .
1.6       millert   376: .Pp
1.1       deraadt   377: The
                    378: .Fl A ,
                    379: .Fl E ,
                    380: .Fl h ,
1.5       aaron     381: .Fl u ,
1.1       deraadt   382: and
                    383: .Fl v
                    384: options have been deleted from the
                    385: .Nm tset
                    386: utility.
1.4       mickey    387: None of them were documented in
                    388: .Bx 4.3
                    389: and all are of limited utility at best.
1.1       deraadt   390: The
                    391: .Fl a ,
                    392: .Fl d
                    393: and
                    394: .Fl p
                    395: options are similarly not documented or useful, but were retained as they
                    396: appear to be in widespread use.
                    397: It is strongly recommended that any usage of these three options be
                    398: changed to use the
                    399: .Fl m
                    400: option instead.
                    401: The
                    402: .Fl n
                    403: option remains, but has no effect.
                    404: It is still permissible to specify the
                    405: .Fl e ,
                    406: .Fl i
                    407: and
                    408: .Fl k
                    409: options without arguments, although it is strongly recommended that such
                    410: usage be fixed to explicitly specify the character.
                    411: .Pp
                    412: Executing
                    413: .Nm tset
                    414: as
                    415: .Nm reset
                    416: no longer implies the
                    417: .Fl Q
                    418: option.
                    419: Also, the interaction between the
                    420: .Fl
                    421: option and the
                    422: .Ar terminal
                    423: argument in some historic implementations of
                    424: .Nm tset
                    425: has been removed.
                    426: .Pp
                    427: Finally, the
                    428: .Nm tset
                    429: implementation has been completely redone (as part of the addition to the
                    430: system of a
                    431: .St -p1003.1-88
                    432: compliant terminal interface) and will no longer compile on systems with
                    433: older terminal interfaces.
1.7       aaron     434: .Sh HISTORY
                    435: The
                    436: .Nm tset
1.18      schwarze  437: and
                    438: .Nm reset
                    439: utilities first appeared in
                    440: .Bx 1 .
                    441: .Sh AUTHORS
                    442: .An -nosplit
                    443: The original version of
                    444: .Nm tset
                    445: was written by
                    446: .An Eric P. Allman
                    447: in October 1977, and
                    448: .Nm reset
                    449: was originally written by
                    450: .An Kurt Shoens .
                    451: The current version also contains code by
                    452: .An Zeyd M. Ben-Halim ,
                    453: .An Eric S. Raymond ,
                    454: and
                    455: .An Thomas E. Dickey .