|
|
1.1 root 1: .TH TTYLD 4
2: .CT 2 comm_term
3: .SH NAME
4: tty_ld \- terminal processing line discipline
5: .SH SYNOPSIS
6: .B #include <sys/ttyio.h>
7: .SH DESCRIPTION
8: .I Tty_ld
9: is usually inserted
10: into a stream
11: connected to a terminal device.
12: It gathers input into lines,
13: handles special characters like erase, kill, and interrupt,
14: inserts output delays,
15: and the like.
16: It does not deal with hardware parameters
17: such as speed and parity;
18: see
19: .IR tty (4)
20: for such matters.
21: .PP
22: Certain special characters have particular meaning on input.
23: These characters are not passed to a program
24: except in raw mode, where they lose their special character.
25: It is possible to change these characters from the default.
26: .PP
27: The
28: .I erase
29: character
30: (default
31: .BR # )
32: erases the last-typed character.
33: It will not erase beyond the beginning of a line or
34: an end-of-file character.
35: .PP
36: The
37: .I kill
38: character
39: (default
40: .BR @ )
41: erases the entire preceding part of the line, but not beyond
42: an end-of-file character.
43: .PP
44: The
45: .I end-of-file
46: character
47: (default
48: .RB control- d )
49: causes any characters
50: waiting to be read
51: to be passed immediately
52: to the program,
53: without waiting for newline.
54: The
55: end-of-file character itself is discarded.
56: Thus if the end-of-file character
57: occurs at the beginning of a line,
58: there are no characters waiting,
59: and zero characters will be passed back;
60: this is
61: the standard end-of-file indication.
62: .PP
63: The
64: .I escape
65: character
66: .RB ( \e )
67: escapes a following erase, kill, or end-of-file character
68: and allows it to be treated as ordinary data.
69: .PP
70: The
71: .I interrupt
72: character
73: (default
74: DEL)
75: is not passed to a program but sends
76: signal
77: .L SIGINT
78: to any processes in the process group of the stream;
79: see
80: .IR signal (2)
81: and
82: .IR stream (4).
83: .PP
84: The
85: .I quit
86: character
87: (default
88: FS,
89: .RB control- \e )
90: sends signal
91: .BR SIGQUIT .
92: .PP
93: The
94: .I stop
95: character
96: (default DC3,
97: .RB control- s )
98: delays printing on the terminal
99: until something is typed in.
100: .PP
101: The
102: .I start
103: character
104: (default DC1,
105: .RB control- q )
106: restarts printing after
107: a stop character without generating
108: any input to a program.
109: .PP
110: Two
111: .IR ioctl (2)
112: calls affect these characters:
113: .TF TIOCGETC
114: .TP
115: .B TIOCGETC
116: The argument points to a
117: .B tchars
118: structure to be filled in with current settings.
119: .TP
120: .B TIOCSETC
121: The argument points to a
122: .B tchars
123: structure from which the characters are set.
124: .PD
125: .PP
126: The
127: .B tchars
128: structure, as defined in
129: .LR <sys/ttyio.h> ,
130: is
131: .PP
132: .EX
133: .ta \w'struct 'u +\w'tchars 'u +\w't_startc; 'u
134: struct tchars {
135: char t_intrc; /* interrupt */
136: char t_quitc; /* quit */
137: char t_startc; /* start output */
138: char t_stopc; /* stop output */
139: char t_eofc; /* end-of-file */
140: char t_brkc; /* input delimiter (like nl) */
141: };
142: .EE
143: .PP
144: A character value of 0377
145: eliminates the effect of that character.
146: The
147: .L t_brkc
148: character, by default 0377,
149: acts like a new-line in that it terminates a line,
150: is echoed, and is passed to the program.
151: The stop and start characters may be the same,
152: to produce a toggle effect.
153: It is counterproductive to make
154: other special characters (including erase and kill)
155: identical.
156: .PP
157: Two
158: .I ioctl
159: calls affect other terminal processing parameters:
160: .TF TIOCGETP
161: .TP
162: .B TIOCGETP
163: The argument points to a
164: .B sgttyb
165: structure to be filled in with the current settings.
166: .TP
167: .B TIOCSETP
168: The argument points to a
169: .B sgttyb
170: structure from which the parameters are set.
171: .PD
172: .PP
173: The
174: .B sgttyb
175: structure, as
176: defined in
177: .LR <sys/ttyio.h> ,
178: is
179: .EX
180: .ta \w'struct 'u +\w'sgttyb 'u +\w'sg_ispeed 'u
181: struct sgttyb {
182: char sg_ispeed; /* unused */
183: char sg_ospeed; /* unused */
184: char sg_erase; /* erase character */
185: char sg_kill; /* kill character */
186: short sg_flags; /* mode flags */
187: };
188: .EE
189: .PP
190: The flag bits are
191: .PP
192: .ta \w'\f5ALLDELAY\fP 'u +\w'\f50100000\fP 'u
193: .nf
194: \f5ALLDELAY 0177400\fP Delay algorithm selection
195: \f5VTDELAY 0040000\fP Form-feed and vertical-tab delays:
196: \f5FF0 0\fP
197: \f5FF1 0040000\fP
198: \f5CRDELAY 0030000\fP Carriage-return delays:
199: \f5CR0 0\fP
200: \f5CR1 0010000\fP
201: \f5CR2 0020000\fP
202: \f5CR3 0030000\fP
203: \f5TBDELAY 0006000\fP Tab delays:
204: \f5TAB0 0\fP
205: \f5TAB1 0002000\fP
206: \f5TAB2 0004000\fP
207: \f5XTABS 0006000\fP
208: \f5NLDELAY 0001400\fP New-line delays:
209: \f5NL0 0\fP
210: \f5NL1 0000400\fP
211: \f5NL2 0001000\fP
212: \f5NL3 0001400\fP
213: \f5RAW 0000040\fP Raw mode: wake up on all characters
214: \f5CRMOD 0000020\fP Map CR into LF; echo LF or CR as CR-LF
215: \f5ECHO 0000010\fP Echo (full duplex)
216: \f5LCASE 0000004\fP Map upper case to lower on input
217: \f5CBREAK 0000002\fP Return each character as soon as typed
218: \f5TANDEM 0000001\fP Automatic flow control
219: .DT
220: .fi
221: .PP
222: The delay bits specify how long
223: transmission stops to allow for mechanical or other movement
224: when certain characters are sent to the terminal.
225: In all cases a value of 0 indicates no delay.
226: .PP
227: If a form-feed/vertical tab delay is specified,
228: it lasts for about 2 seconds.
229: .PP
230: Carriage-return delay type 1 lasts about .08 seconds;
231: type 2 about .16 seconds;
232: type 3 about .32 seconds.
233: .PP
234: New-line delay type 1 is supposed to be for the Teletype model 37;
235: type 2 is about .10 seconds.
236: .PP
237: Tab delay type 1 is supposed to be for the Teletype model 37.
238: Type 3, called
239: .LR XTABS ,
240: is not a delay at all but causes tabs to be replaced
241: by the appropriate number of spaces on output.
242: .PP
243: In
244: .B RAW
245: mode,
246: every character is passed immediately
247: to the program without waiting until a full line has been typed.
248: No erase or kill processing is done;
249: the end-of-file, interrupt, and quit characters
250: are not treated specially.
251: There are no delays and no echoing, and no replacement of
252: one character for another.
253: .PP
254: .L CRMOD
255: causes input carriage returns to be turned into
256: new-lines;
257: input of either CR or LF causes CR-LF both to
258: be echoed
259: (for terminals without a new-line function).
260: .PP
261: .L CBREAK
262: is a sort of half-cooked mode.
263: Programs read each character as soon as typed, instead
264: of waiting for a full line,
265: but quit and interrupt work, and output delays
266: .LR CRMOD ,
267: .LR XTABS ,
268: and
269: .LR ECHO
270: work normally.
271: On the other hand there is no erase or kill,
272: and no special treatment of
273: .L \e
274: or end-of-file.
275: .PP
276: .L TANDEM
277: mode causes the system to transmit
278: the stop character whenever the input
279: queue is in danger of overflowing,
280: and the start character
281: when the input queue has drained sufficiently.
282: It is useful for flow control when the `terminal'
283: is actually another machine that obeys the conventions.
284: .SH SEE ALSO
285: .IR getty (8),
286: .IR stty (1),
287: .IR signal (2),
288: .IR ioctl (2),
289: .IR stream (4),
290: .IR tty (4)
291: .SH BUGS
292: The
293: escape character
294: cannot be changed.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.