1termios.h(0P)              POSIX Programmer's Manual             termios.h(0P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       termios.h — define values for termios
13

SYNOPSIS

15       #include <termios.h>
16

DESCRIPTION

18       The <termios.h> header shall contain the definitions used by the termi‐
19       nal  I/O interfaces (see Chapter 11, General Terminal Interface for the
20       structures and names defined).
21
22   The termios Structure
23       The <termios.h> header shall define the following  data  types  through
24       typedef:
25
26       cc_t        Used for terminal special characters.
27
28       speed_t     Used for terminal baud rates.
29
30       tcflag_t    Used for terminal modes.
31
32       The above types shall be all unsigned integer types.
33
34       The  implementation  shall support one or more programming environments
35       in which the widths of cc_t, speed_t, and tcflag_t are no greater  than
36       the  width  of  type long.  The names of these programming environments
37       can be obtained using the confstr() function or the getconf utility.
38
39       The <termios.h> header shall define the termios structure, which  shall
40       include at least the following members:
41
42
43           tcflag_t  c_iflag     Input modes.
44           tcflag_t  c_oflag     Output modes.
45           tcflag_t  c_cflag     Control modes.
46           tcflag_t  c_lflag     Local modes.
47           cc_t      c_cc[NCCS]  Control characters.
48
49       The <termios.h> header shall define the following symbolic constant:
50
51       NCCS        Size of the array c_cc for control characters.
52
53       The  <termios.h>  header  shall define the following symbolic constants
54       for use as subscripts for the array c_cc:
55
56              ┌────────────────────────────────────┬──────────────────┐
57Subscript Usage           │                  │
58Canonical Mode   Non-Canonical Mode Description    
59              ├───────────────┬────────────────────┼──────────────────┤
60              │VEOF           │                    │ EOF character.   │
61              │VEOL           │                    │ EOL character.   │
62              │VERASE         │                    │ ERASE character. │
63              │VINTR          │ VINTR              │ INTR character.  │
64              │VKILL          │                    │ KILL character.  │
65              │               │ VMIN               │ MIN value.       │
66              │VQUIT          │ VQUIT              │ QUIT character.  │
67              │VSTART         │ VSTART             │ START character. │
68              │VSTOP          │ VSTOP              │ STOP character.  │
69              │VSUSP          │ VSUSP              │ SUSP character.  │
70              │               │ VTIME              │ TIME value.      │
71              └───────────────┴────────────────────┴──────────────────┘
72       The subscript values shall be suitable for  use  in  #if  preprocessing
73       directives  and  shall be distinct, except that the VMIN and VTIME sub‐
74       scripts may have the same values  as  the  VEOF  and  VEOL  subscripts,
75       respectively.
76
77   Input Modes
78       The  <termios.h>  header  shall define the following symbolic constants
79       for use as flags in the c_iflag field. The c_iflag field describes  the
80       basic terminal input control.
81
82       BRKINT      Signal interrupt on break.
83
84       ICRNL       Map CR to NL on input.
85
86       IGNBRK      Ignore break condition.
87
88       IGNCR       Ignore CR.
89
90       IGNPAR      Ignore characters with parity errors.
91
92       INLCR       Map NL to CR on input.
93
94       INPCK       Enable input parity check.
95
96       ISTRIP      Strip character.
97
98       IXANY       Enable any character to restart output.
99
100       IXOFF       Enable start/stop input control.
101
102       IXON        Enable start/stop output control.
103
104       PARMRK      Mark parity errors.
105
106   Output Modes
107       The  <termios.h>  header  shall define the following symbolic constants
108       for use as flags in the c_oflag field. The c_oflag field specifies  the
109       system treatment of output.
110
111       OPOST       Post-process output.
112
113       ONLCR       Map NL to CR-NL on output.
114
115       OCRNL       Map CR to NL on output.
116
117       ONOCR       No CR output at column 0.
118
119       ONLRET      NL performs CR function.
120
121       OFDEL       Fill is DEL.
122
123       OFILL       Use fill characters for delay.
124
125       NLDLY       Select newline delays:
126
127                   NL0     Newline type 0.
128
129                   NL1     Newline type 1.
130
131       CRDLY       Select carriage-return delays:
132
133                   CR0     Carriage-return delay type 0.
134
135                   CR1     Carriage-return delay type 1.
136
137                   CR2     Carriage-return delay type 2.
138
139                   CR3     Carriage-return delay type 3.
140
141       TABDLY      Select horizontal-tab delays:
142
143                   TAB0    Horizontal-tab delay type 0.
144
145                   TAB1    Horizontal-tab delay type 1.
146
147                   TAB2    Horizontal-tab delay type 2.
148
149                   TAB3    Expand tabs to spaces.
150
151       BSDLY       Select backspace delays:
152
153                   BS0     Backspace-delay type 0.
154
155                   BS1     Backspace-delay type 1.
156
157       VTDLY       Select vertical-tab delays:
158
159                   VT0     Vertical-tab delay type 0.
160
161                   VT1     Vertical-tab delay type 1.
162
163       FFDLY       Select form-feed delays:
164
165                   FF0     Form-feed delay type 0.
166
167                   FF1     Form-feed delay type 1.
168
169   Baud Rate Selection
170       The  <termios.h>  header  shall define the following symbolic constants
171       for use as values of objects of type speed_t.
172
173       The input and output baud rates are stored in  the  termios  structure.
174       These  are  the valid values for objects of type speed_t.  Not all baud
175       rates need be supported by the underlying hardware.
176
177       B0          Hang up
178
179       B50         50 baud
180
181       B75         75 baud
182
183       B110        110 baud
184
185       B134        134.5 baud
186
187       B150        150 baud
188
189       B200        200 baud
190
191       B300        300 baud
192
193       B600        600 baud
194
195       B1200       1200 baud
196
197       B1800       1800 baud
198
199       B2400       2400 baud
200
201       B4800       4800 baud
202
203       B9600       9600 baud
204
205       B19200      19200 baud
206
207       B38400      38400 baud
208
209   Control Modes
210       The <termios.h> header shall define the  following  symbolic  constants
211       for  use as flags in the c_cflag field. The c_cflag field describes the
212       hardware control of the terminal; not all values specified are required
213       to be supported by the underlying hardware.
214
215       CSIZE       Character size:
216
217                   CS5     5 bits
218
219                   CS6     6 bits
220
221                   CS7     7 bits
222
223                   CS8     8 bits
224
225       CSTOPB      Send two stop bits, else one.
226
227       CREAD       Enable receiver.
228
229       PARENB      Parity enable.
230
231       PARODD      Odd parity, else even.
232
233       HUPCL       Hang up on last close.
234
235       CLOCAL      Ignore modem status lines.
236
237       The  implementation shall support the functionality associated with the
238       symbols CS7, CS8, CSTOPB, PARODD, and PARENB.
239
240   Local Modes
241       The <termios.h> header shall define the  following  symbolic  constants
242       for  use  as flags in the c_lflag field. The c_lflag field of the argu‐
243       ment structure is used to control various terminal functions.
244
245       ECHO        Enable echo.
246
247       ECHOE       Echo erase character as error-correcting backspace.
248
249       ECHOK       Echo KILL.
250
251       ECHONL      Echo NL.
252
253       ICANON      Canonical input (erase and kill processing).
254
255       IEXTEN      Enable extended input character processing.
256
257       ISIG        Enable signals.
258
259       NOFLSH      Disable flush after interrupt or quit.
260
261       TOSTOP      Send SIGTTOU for background output.
262
263   Attribute Selection
264       The <termios.h> header shall define the  following  symbolic  constants
265       for use with tcsetattr():
266
267       TCSANOW     Change attributes immediately.
268
269       TCSADRAIN   Change attributes when output has drained.
270
271       TCSAFLUSH   Change attributes when output has drained; also flush pend‐
272                   ing input.
273
274   Line Control
275       The <termios.h> header shall define the  following  symbolic  constants
276       for use with tcflush():
277
278       TCIFLUSH    Flush pending input.
279
280       TCIOFLUSH   Flush both pending input and untransmitted output.
281
282       TCOFLUSH    Flush untransmitted output.
283
284       The  <termios.h>  header  shall define the following symbolic constants
285       for use with tcflow():
286
287       TCIOFF      Transmit a STOP character, intended to suspend input data.
288
289       TCION       Transmit a START character, intended to restart input data.
290
291       TCOOFF      Suspend output.
292
293       TCOON       Restart output.
294
295       The <termios.h> header shall define the  pid_t  type  as  described  in
296       <sys/types.h>.
297
298       The following shall be declared as functions and may also be defined as
299       macros. Function prototypes shall be provided.
300
301
302           speed_t cfgetispeed(const struct termios *);
303           speed_t cfgetospeed(const struct termios *);
304           int     cfsetispeed(struct termios *, speed_t);
305           int     cfsetospeed(struct termios *, speed_t);
306           int     tcdrain(int);
307           int     tcflow(int, int);
308           int     tcflush(int, int);
309           int     tcgetattr(int, struct termios *);
310           pid_t   tcgetsid(int);
311           int     tcsendbreak(int, int);
312           int     tcsetattr(int, int, const struct termios *);
313
314       The following sections are informative.
315

APPLICATION USAGE

317       The following names are reserved for XSI-conformant systems to  use  as
318       an  extension  to the above; therefore strictly conforming applications
319       shall not use them:
320
321       CBAUD      EXTB       VDSUSP
322       DEFECHO    FLUSHO     VLNEXT
323       ECHOCTL    LOBLK      VREPRINT
324       ECHOKE     PENDIN     VSTATUS
325       ECHOPRT    SWTCH      VWERASE
326       EXTA       VDISCARD
327

RATIONALE

329       None.
330

FUTURE DIRECTIONS

332       None.
333

SEE ALSO

335       <sys_types.h>
336
337       The System Interfaces  volume  of  POSIX.1‐2017,  cfgetispeed(),  cfge‐
338       tospeed(),    cfsetispeed(),   cfsetospeed(),   confstr(),   tcdrain(),
339       tcflow(),  tcflush(),  tcgetattr(),  tcgetsid(),  tcsendbreak(),  tcse‐
340       tattr()
341
342       The  Shell  and  Utilities  volume of POSIX.1‐2017, Chapter 11, General
343       Terminal Interface, getconf
344
346       Portions of this text are reprinted and reproduced in  electronic  form
347       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
348       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
349       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
350       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
351       event of any discrepancy between this version and the original IEEE and
352       The Open Group Standard, the original IEEE and The Open Group  Standard
353       is  the  referee document. The original Standard can be obtained online
354       at http://www.opengroup.org/unix/online.html .
355
356       Any typographical or formatting errors that appear  in  this  page  are
357       most likely to have been introduced during the conversion of the source
358       files to man page format. To report such errors,  see  https://www.ker
359       nel.org/doc/man-pages/reporting_bugs.html .
360
361
362
363IEEE/The Open Group                  2017                        termios.h(0P)
Impressum