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