1<termios.h>(0P) POSIX Programmer's Manual <termios.h>(0P)
2
3
4
6 termios.h - define values for termios
7
9 #include <termios.h>
10
12 The <termios.h> header contains the definitions used by the terminal
13 I/O interfaces (see General Terminal Interface for the structures and
14 names defined).
15
16 The termios Structure
17 The following data types shall be defined through typedef:
18
19 cc_t Used for terminal special characters.
20
21 speed_t
22 Used for terminal baud rates.
23
24 tcflag_t
25 Used for terminal modes.
26
27
28 The above types shall be all unsigned integer types.
29
30 The implementation shall support one or more programming environments
31 in which the widths of cc_t, speed_t, and tcflag_t are no greater than
32 the width of type long. The names of these programming environments can
33 be obtained using the confstr() function or the getconf utility.
34
35 The termios structure shall be defined, and shall include at least the
36 following members:
37
38
39 tcflag_t c_iflag Input modes.
40 tcflag_t c_oflag Output modes.
41 tcflag_t c_cflag Control modes.
42 tcflag_t c_lflag Local modes.
43 cc_t c_cc[NCCS] Control characters.
44
45 A definition shall be provided for:
46
47 NCCS Size of the array c_cc for control characters.
48
49
50 The following subscript names for the array c_cc shall be defined:
51
52 Subscript Usage
53 Canonical Mode Non-Canonical Mode Description
54 VEOF EOF character.
55 VEOL EOL character.
56 VERASE ERASE character.
57 VINTR VINTR INTR character.
58 VKILL KILL character.
59 VMIN MIN value.
60 VQUIT VQUIT QUIT character.
61 VSTART VSTART START character.
62 VSTOP VSTOP STOP character.
63 VSUSP VSUSP SUSP character.
64 VTIME TIME value.
65
66 The subscript values shall be unique, except that the VMIN and VTIME
67 subscripts may have the same values as the VEOF and VEOL subscripts,
68 respectively.
69
70 The following flags shall be provided.
71
72 Input Modes
73 The c_iflag field describes the basic terminal input control:
74
75 BRKINT Signal interrupt on break.
76
77 ICRNL Map CR to NL on input.
78
79 IGNBRK Ignore break condition.
80
81 IGNCR Ignore CR.
82
83 IGNPAR Ignore characters with parity errors.
84
85 INLCR Map NL to CR on input.
86
87 INPCK Enable input parity check.
88
89 ISTRIP Strip character.
90
91 IXANY Enable any character to restart output.
92
93 IXOFF Enable start/stop input control.
94
95 IXON Enable start/stop output control.
96
97 PARMRK Mark parity errors.
98
99
100 Output Modes
101 The c_oflag field specifies the system treatment of output:
102
103 OPOST Post-process output.
104
105 ONLCR Map NL to CR-NL on output.
106
107 OCRNL Map CR to NL on output.
108
109 ONOCR No CR output at column 0.
110
111 ONLRET NL performs CR function.
112
113 OFILL Use fill characters for delay.
114
115 NLDLY Select newline delays:
116
117 NL0
118 Newline type 0.
119
120 NL1
121 Newline type 1.
122
123
124 CRDLY Select carriage-return delays:
125
126 CR0
127 Carriage-return delay type 0.
128
129 CR1
130 Carriage-return delay type 1.
131
132 CR2
133 Carriage-return delay type 2.
134
135 CR3
136 Carriage-return delay type 3.
137
138
139 TABDLY Select horizontal-tab delays:
140
141 TAB0
142 Horizontal-tab delay type 0.
143
144 TAB1
145 Horizontal-tab delay type 1.
146
147 TAB2
148 Horizontal-tab delay type 2.
149
150 TAB3
151 Expand tabs to spaces.
152
153
154 BSDLY Select backspace delays:
155
156 BS0
157 Backspace-delay type 0.
158
159 BS1
160 Backspace-delay type 1.
161
162
163 VTDLY Select vertical-tab delays:
164
165 VT0
166 Vertical-tab delay type 0.
167
168 VT1
169 Vertical-tab delay type 1.
170
171
172 FFDLY Select form-feed delays:
173
174 FF0
175 Form-feed delay type 0.
176
177 FF1
178 Form-feed delay type 1.
179
180
181
182 Baud Rate Selection
183 The input and output baud rates are stored in the termios structure.
184 These are the valid values for objects of type speed_t. The following
185 values shall be defined, but not all baud rates need be supported by
186 the underlying hardware.
187
188 B0 Hang up
189
190 B50 50 baud
191
192 B75 75 baud
193
194 B110 110 baud
195
196 B134 134.5 baud
197
198 B150 150 baud
199
200 B200 200 baud
201
202 B300 300 baud
203
204 B600 600 baud
205
206 B1200 1200 baud
207
208 B1800 1800 baud
209
210 B2400 2400 baud
211
212 B4800 4800 baud
213
214 B9600 9600 baud
215
216 B19200 19200 baud
217
218 B38400 38400 baud
219
220
221 Control Modes
222 The c_cflag field describes the hardware control of the terminal; not
223 all values specified are required to be supported by the underlying
224 hardware:
225
226 CSIZE Character size:
227
228 CS5
229 5 bits
230
231 CS6
232 6 bits
233
234 CS7
235 7 bits
236
237 CS8
238 8 bits
239
240
241 CSTOPB Send two stop bits, else one.
242
243 CREAD Enable receiver.
244
245 PARENB Parity enable.
246
247 PARODD Odd parity, else even.
248
249 HUPCL Hang up on last close.
250
251 CLOCAL Ignore modem status lines.
252
253
254 The implementation shall support the functionality associated with the
255 symbols CS7, CS8, CSTOPB, PARODD, and PARENB.
256
257 Local Modes
258 The c_lflag field of the argument structure is used to control various
259 terminal functions:
260
261 ECHO Enable echo.
262
263 ECHOE Echo erase character as error-correcting backspace.
264
265 ECHOK Echo KILL.
266
267 ECHONL Echo NL.
268
269 ICANON Canonical input (erase and kill processing).
270
271 IEXTEN Enable extended input character processing.
272
273 ISIG Enable signals.
274
275 NOFLSH Disable flush after interrupt or quit.
276
277 TOSTOP Send SIGTTOU for background output.
278
279
280 Attribute Selection
281 The following symbolic constants for use with tcsetattr() are defined:
282
283 TCSANOW
284 Change attributes immediately.
285
286 TCSADRAIN
287 Change attributes when output has drained.
288
289 TCSAFLUSH
290 Change attributes when output has drained; also flush pending
291 input.
292
293
294 Line Control
295 The following symbolic constants for use with tcflush() shall be
296 defined:
297
298 TCIFLUSH
299 Flush pending input.
300
301 TCIOFLUSH
302 Flush both pending input and untransmitted output.
303
304 TCOFLUSH
305 Flush untransmitted output.
306
307
308 The following symbolic constants for use with tcflow() shall be
309 defined:
310
311 TCIOFF Transmit a STOP character, intended to suspend input data.
312
313 TCION Transmit a START character, intended to restart input data.
314
315 TCOOFF Suspend output.
316
317 TCOON Restart output.
318
319
320 The following shall be declared as functions and may also be defined as
321 macros. Function prototypes shall be provided.
322
323
324 speed_t cfgetispeed(const struct termios *);
325 speed_t cfgetospeed(const struct termios *);
326 int cfsetispeed(struct termios *, speed_t);
327 int cfsetospeed(struct termios *, speed_t);
328 int tcdrain(int);
329 int tcflow(int, int);
330 int tcflush(int, int);
331 int tcgetattr(int, struct termios *);
332
333 pid_t tcgetsid(int);
334
335 int tcsendbreak(int, int);
336 int tcsetattr(int, int, const struct termios *);
337
338 The following sections are informative.
339
341 The following names are reserved for XSI-conformant systems to use as
342 an extension to the above; therefore strictly conforming applications
343 shall not use them:
344
345 CBAUD EXTB VDSUSP
346 DEFECHO FLUSHO VLNEXT
347 ECHOCTL LOBLK VREPRINT
348 ECHOKE PENDIN VSTATUS
349 ECHOPRT SWTCH VWERASE
350 EXTA VDISCARD
351
353 None.
354
356 None.
357
359 The System Interfaces volume of IEEE Std 1003.1-2001, cfgetispeed(),
360 cfgetospeed(), cfsetispeed(), cfsetospeed(), confstr(), tcdrain(),
361 tcflow(), tcflush(), tcgetattr(), tcgetsid(), tcsendbreak(), tcse‐
362 tattr(), the Shell and Utilities volume of IEEE Std 1003.1-2001, get‐
363 conf, General Terminal Interface
364
366 Portions of this text are reprinted and reproduced in electronic form
367 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
368 -- Portable Operating System Interface (POSIX), The Open Group Base
369 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
370 Electrical and Electronics Engineers, Inc and The Open Group. In the
371 event of any discrepancy between this version and the original IEEE and
372 The Open Group Standard, the original IEEE and The Open Group Standard
373 is the referee document. The original Standard can be obtained online
374 at http://www.opengroup.org/unix/online.html .
375
376
377
378IEEE/The Open Group 2003 <termios.h>(0P)