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