Annotation of cci/usr/src/man/man1/tset.1, revision 1.1.1.1

1.1       root        1: .TH TSET 1 "16 October 1982"
                      2: .UC 4
                      3: .\"    @(#)tset.1      1.2
                      4: .SH NAME
                      5: tset \- terminal dependent initialization
                      6: .SH SYNOPSIS
                      7: .B tset
                      8: [ options ] [
                      9: .B \-m
                     10: [ident][test baudrate]:type ] \&... [ type ]
                     11: .sp 1
                     12: .B reset
                     13: \&...
                     14: .SH DESCRIPTION
                     15: .I Tset
                     16: sets up your terminal when you first log in to a UNIX system.
                     17: It does terminal dependent processing such as setting
                     18: erase and kill characters, setting or resetting delays,
                     19: sending any sequences needed to properly initialized the terminal,
                     20: and the like.
                     21: It first determines the
                     22: .I type
                     23: of terminal involved,
                     24: and then does necessary initializations and mode settings.
                     25: The type of terminal attached to each \s-2UNIX\s0 port is specified in the
                     26: .I /etc/ttytype
                     27: database.
                     28: Type names for terminals may be found in the
                     29: .IR termcap (5)
                     30: database.
                     31: If a port is not wired permanently to a specific terminal (not hardwired)
                     32: it will be given an appropriate generic identifier such as
                     33: .IR dialup .
                     34: .PP
                     35: In the case where no arguments are specified,
                     36: .I tset
                     37: simply reads the terminal type out of the environment variable TERM
                     38: and re-initializes the terminal.  The rest of this manual concerns
                     39: itself with mode and environment initialization,
                     40: typically done once at login, and options
                     41: used at initialization time to determine the terminal type and set up
                     42: terminal modes.
                     43: .PP
                     44: When used in a startup script (\fI\&.profile\fR for
                     45: .IR sh (1)
                     46: users or
                     47: .I \&.login
                     48: for
                     49: .IR csh (1)
                     50: users) it is desirable to give information about the type of terminal
                     51: you will usually use on ports which are not hardwired.
                     52: These ports are identified in
                     53: .I /etc/ttytype
                     54: as
                     55: .I dialup
                     56: or
                     57: .I plugboard
                     58: or
                     59: .I arpanet,
                     60: etc.
                     61: To specify
                     62: what terminal type you usually use on these ports, the
                     63: .B \-m
                     64: (map) option flag is followed by the appropriate port type identifier,
                     65: an optional baud rate specification,
                     66: and the terminal type.
                     67: (The effect is to ``map'' from some conditions to a terminal type,
                     68: that is, to tell
                     69: .I tset
                     70: ``If I'm on this kind of port, guess that I'm on that kind of terminal''.)
                     71: If more than one mapping is specified, the first applicable mapping prevails.
                     72: A missing port type identifier matches all identifiers.
                     73: Any of the alternate generic names given in
                     74: .I termcap
                     75: may be used for the identifier.
                     76: .PP
                     77: A
                     78: .I baudrate
                     79: is specified as with
                     80: .IR stty (1),
                     81: and is compared with the
                     82: speed of the diagnostic output (which should be the control terminal).
                     83: The baud rate
                     84: .I test
                     85: may be any combination of:
                     86: .BR > ,
                     87: .BR @ ,
                     88: .BR < ,
                     89: and
                     90: .BR ! ;
                     91: .B @
                     92: means ``at''
                     93: and
                     94: .B !
                     95: inverts the sense of the test.  To avoid problems with metacharacters, it
                     96: is best to place the entire argument to
                     97: .B \-m
                     98: within ``\''' characters; users of
                     99: .IR csh (1)
                    100: must also put a ``\e'' before any ``!'' used here.
                    101: .PP
                    102: .KS
                    103: Thus
                    104: .IP
                    105: tset \-m \'dialup>300:adm3a\' -m dialup:dw2 -m \'plugboard:?adm3a\'
                    106: .KE
                    107: .LP
                    108: causes the terminal type to be set to an
                    109: .I adm3a
                    110: if the port in use is a dialup at a speed greater than 300 baud;
                    111: to a 
                    112: .I dw2
                    113: if the port is (otherwise) a dialup (i.e. at 300 baud or less).
                    114: (\fBNOTE:\fP the examples given here appear to take up more than
                    115: one line, for text processing reasons.  When you type in real
                    116: .I tset
                    117: commands, you must enter them entirely on one line.)
                    118: If the
                    119: .I type
                    120: finally determined by
                    121: .I tset
                    122: begins with a question mark,
                    123: the user is asked if s/he really wants that type.
                    124: A null response means to use that type;
                    125: otherwise, another type can be entered which will be used instead.
                    126: Thus, in the above case, the user will be queried on a plugboard port
                    127: as to whether they are actually using an
                    128: .IR adm3a .
                    129: .PP
                    130: If no mapping applies and a final
                    131: .I type
                    132: option, not preceded by a
                    133: .BR \-m ,
                    134: is given on the command line
                    135: then that type is used;
                    136: otherwise the identifier found in the
                    137: .I /etc/ttytype
                    138: database will be taken to be the terminal type.
                    139: This should always be the case for hardwired ports.
                    140: .PP
                    141: It is usually desirable to return the terminal type, as finally determined by
                    142: .IR tset ,
                    143: and information about the terminal's capabilities
                    144: to a shell's environment.  This can be done using the
                    145: .B \-
                    146: option; using the Bourne shell,
                    147: .IR sh (1):
                    148: .IP
                    149: export TERM; TERM=\`tset \- \fIoptions...\fR\`
                    150: .LP
                    151: or using the C shell,
                    152: .IR csh (1):
                    153: .IP
                    154: setenv TERM \`tset - \fIoptions...\fR\`
                    155: .PP
                    156: With
                    157: .I csh
                    158: it is convenient to make an alias in your .cshrc:
                    159: .PP
                    160: .RS
                    161: alias tset \'setenv TERM \`tset \- \e!*\`\'
                    162: .RE
                    163: Either of these aliases allow the command
                    164: .RS
                    165: tset 2621
                    166: .RE
                    167: to be invoked at any time from your login csh.
                    168: .B "Note to Bourne Shell users:"
                    169: It is
                    170: .B not
                    171: possible to get this aliasing effect with a shell script,
                    172: because shell scripts cannot set the environment of their parent.
                    173: (If a process could set its parent's environment,
                    174: none of this nonsense would be necessary in the first place.)
                    175: .PP
                    176: These commands cause
                    177: .I tset
                    178: to place the name of your terminal in the variable
                    179: TERM in the environment; see
                    180: .IR environ (7).
                    181: .PP
                    182: Once the terminal type is known,
                    183: .I tset
                    184: engages in terminal driver mode setting.
                    185: This normally involves sending an initialization sequence to the
                    186: terminal, setting the single character erase (and optionally
                    187: the line-kill (full line erase)) characters,
                    188: and setting special character delays.
                    189: Tab and newline expansion are turned off during transmission of
                    190: the terminal initialization sequence.
                    191: .PP
                    192: On terminals that can backspace but not overstrike
                    193: (such as a \s-2CRT\s0),
                    194: and when the erase character is the default erase character
                    195: (`#' on standard systems),
                    196: the erase character is changed to \s-2BACKSPACE\s0 (Control-H).
                    197: .PP
                    198: The options are:
                    199: .TP
                    200: .B \-e\fIc
                    201: set the erase character to be the named character
                    202: .I c
                    203: on all terminals,
                    204: the default being the backspace character on the terminal, usually ^H.
                    205: The character
                    206: .I c
                    207: can either be typed directly, or entered using the hat
                    208: notation used here.
                    209: .TP
                    210: .B \-k\fIc
                    211: is similar to
                    212: .B \-e
                    213: but for the line kill character rather than the erase character;
                    214: .I c
                    215: defaults to ^X (for purely historical reasons).
                    216: The kill characters is left alone if
                    217: .B \-k
                    218: is not specified.
                    219: The hat notation can also be used for this option.
                    220: .TP
                    221: .B \-
                    222: The name of the terminal finally decided upon is output on the
                    223: standard output.
                    224: This is intended to be captured by the shell and placed in the
                    225: environment variable TERM.
                    226: .TP
                    227: .B \-n
                    228: On systems with the Berkeley 4BSD tty driver,
                    229: specifies that the new tty driver modes should be initialized for this terminal.
                    230: For a \s-2CRT\s0,
                    231: the CRTERASE and CRTKILL
                    232: modes are set only if the baud rate is 1200 or greater.
                    233: See tty(4) for more detail.
                    234: .TP
                    235: .B \-I
                    236: suppresses transmitting terminal initialization strings.
                    237: .TP
                    238: .B \-Q
                    239: suppresses printing the
                    240: ``Erase set to'' and ``Kill set to'' messages.
                    241: .PP
                    242: If
                    243: .B tset
                    244: is invoked as
                    245: .BR reset ,
                    246: it will set cooked and echo modes, turn off cbreak and raw modes,
                    247: turn on newline translation, and restore special characters
                    248: to a sensible state before any terminal dependent processing is done.
                    249: Any special character that is found to be \s-2NULL\s0
                    250: or ``\-1'' is reset to its default value.
                    251: .PP
                    252: This is most useful after a program dies leaving a terminal in a funny
                    253: state. You may have to type ``\s-2<LF>\s0reset\s-2<LF>\s0'' to get it to work
                    254: since \s-2<CR>\s0 may not work in this state. Often none of this will echo.
                    255: .SH EXAMPLES
                    256: .PP
                    257: These examples all assume the Bourne shell and use the - option.
                    258: If you use
                    259: .IR csh ,
                    260: use one of the variations described above.
                    261: Note that a typical use of
                    262: .I tset
                    263: in a .profile or .login will also use the
                    264: .B \-e
                    265: and
                    266: .B \-k
                    267: options, and often the
                    268: .B \-n
                    269: or
                    270: .B \-Q
                    271: options as well.
                    272: These options have not been included here to keep the examples small.
                    273: (\fBNOTE:\fP some of the examples given here appear to take up more than
                    274: one line, for text processing reasons.  When you type in real
                    275: .I tset
                    276: commands, you must enter them entirely on one line.)
                    277: .PP
                    278: At the moment, you are on a 2621.
                    279: This is suitable for typing by hand but
                    280: not for a .profile, unless you are
                    281: .I always
                    282: on a 2621.
                    283: .IP
                    284: export TERM; TERM=\`tset \- 2621\`
                    285: .PP
                    286: You have an h19 at home which you dial up on, but your office terminal
                    287: is hardwired and known in /etc/ttytype.
                    288: .IP
                    289: export TERM; TERM=\`tset \- \-m dialup:h19\`
                    290: .PP
                    291: You have a switch which connects everything to everything, making
                    292: it nearly impossible to key on what port you are coming in on.
                    293: You use a vt100 in your office at 9600 baud, and dial up to switch
                    294: ports at 1200 baud from home on a 2621.
                    295: Sometimes you use someone elses terminal at work,
                    296: so you want it to ask you to make sure what terminal
                    297: type you have at high speeds, but at 1200 baud you are
                    298: always on a 2621.
                    299: Note the placement of the question mark, and the quotes
                    300: to protect the greater than and question mark from
                    301: interpretation by the shell.
                    302: .IP
                    303: export TERM; TERM=\`tset \- \-m 'switch>1200:?vt100' \-m 'switch<=1200:2621'
                    304: .PP
                    305: All of the above entries will fall back on the terminal type
                    306: specified in
                    307: .I /etc/ttytype
                    308: if none of the conditions hold.
                    309: The following entry is appropriate if
                    310: you always dial up, always at the same baud rate,
                    311: on many different kinds of terminals.
                    312: Your most common terminal is an adm3a.
                    313: It always asks you what kind of terminal you are on,
                    314: defaulting to adm3a.
                    315: .IP
                    316: export TERM; TERM=\`tset \- \?adm3a\`
                    317: .PP
                    318: If the file
                    319: .I /etc/ttytype
                    320: is not properly installed and you want to
                    321: key entirely on the baud rate, the following can be used:
                    322: .IP
                    323: export TERM; TERM=\`tset \- \-m '>1200:vt100' 2621\`
                    324: .PP
                    325: Here is a fancy example to illustrate the power of
                    326: .I tset
                    327: and to hopelessly confuse anyone who has made it this far.
                    328: You dial up at 1200 baud or less on a concept100,
                    329: sometimes over switch ports and sometimes over regular dialups.
                    330: You use various terminals at speeds higher than 1200 over switch ports,
                    331: most often the terminal in your office, which is a vt100.
                    332: However, sometimes you log in from the university you used to go to,
                    333: over the ARPANET; in this case you are on an ALTO emulating a dm2500.
                    334: You also often log in on various hardwired ports, such as the console,
                    335: all of which are properly entered in
                    336: .IR /etc/ttytype .
                    337: You want your erase character set to control H,
                    338: your kill character set to control U,
                    339: and don't want
                    340: .I tset
                    341: to print the ``Erase set to Backspace, Kill set to Control U'' message.
                    342: .IP
                    343: export TERM; TERM=\`tset \-e \-k^U \-Q \- \-m 'switch<=1200:concept100' \-m 'switch:?vt100' \-m dialup:concept100 \-m arpanet:dm2500\`
                    344: .SH FILES
                    345: .DT
                    346: /etc/ttytype   port name to terminal type mapping database
                    347: .br
                    348: /etc/termcap   terminal capability database
                    349: .SH SEE\ ALSO
                    350: csh(1), sh(1), stty(1), ttytype(5), termcap(5), environ(7)
                    351: .SH AUTHORS
                    352: Eric Allman
                    353: .br
                    354: David Wasley
                    355: .br
                    356: Mark Horton
                    357: .SH BUGS
                    358: .PP
                    359: The
                    360: .I tset
                    361: command is one of the first commands a user must master when getting
                    362: started on a UNIX system.
                    363: Unfortunately, it is one of the most complex,
                    364: largely because of the extra effort the user must go through
                    365: to get the environment of the login shell set.
                    366: Something needs to be done to make all this simpler,
                    367: either the
                    368: .IR login (1)
                    369: program should do this stuff,
                    370: or a default shell alias should be made,
                    371: or a way to set the environment of the parent should exist.
                    372: .ig
                    373: .SH NOTES
                    374: For compatibility with earlier versions of
                    375: .I tset
                    376: a number of flags are accepted whose use is discouraged:
                    377: .TP 10
                    378: \fB\-d\fR type
                    379: equivalent to
                    380: .B \-m
                    381: dialup:type
                    382: .TP 10
                    383: \fB\-p\fR type
                    384: equivalent to
                    385: .B \-m
                    386: plugboard:type
                    387: .TP 10
                    388: \fB\-a\fR type
                    389: equivalent to
                    390: .B \-m
                    391: arpanet:type
                    392: .TP 10
                    393: \fB\-E\fR c
                    394: Sets the erase character to
                    395: .I c
                    396: only if the terminal can backspace.
                    397: .TP 10
                    398: \fB\-\fR
                    399: prints the terminal type on the standard output
                    400: .TP 10
                    401: \fB\-r\fR
                    402: prints the terminal type on the diagnostic output.
                    403: ..

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.