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