1 /* Copyright (C) 1991 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
20 * POSIX Standard: 7.1-2 General Terminal Interface <termios.h>
28 /* Type of terminal control flag masks. */
29 typedef unsigned short int tcflag_t;
31 /* Type of control characters. */
32 typedef unsigned char cc_t;
34 /* Type of baud rate specifiers. */
35 typedef unsigned char speed_t;
37 /* Terminal control structure. */
42 #define BRKINT (1 << 0) /* Signal interrupt on break. */
43 #define ICRNL (1 << 1) /* Map CR to NL on input. */
44 #define IGNBRK (1 << 2) /* Ignore break condition. */
45 #define IGNCR (1 << 3) /* Ignore CR. */
46 #define IGNPAR (1 << 4) /* Ignore characters with parity errors. */
47 #define INLCR (1 << 5) /* Map NL to CR on input. */
48 #define INPCK (1 << 6) /* Enable input parity check. */
49 #define ISTRIP (1 << 7) /* Strip character. */
50 #define IXOFF (1 << 8) /* Enable start/stop input control. */
51 #define IXON (1 << 9) /* Enable start/stop output control. */
52 #define PARMRK (1 << 10) /* Mark parity errors. */
56 #define OPOST (1 << 0) /* Perform output processing. */
60 #define CLOCAL (1 << 0) /* Ignore modem status lines. */
61 #define CREAD (1 << 1) /* Enable receiver. */
62 #define CSIZE (CS5|CS6|CS7|CS8) /* Number of bits per byte. */
63 #define CS5 (1 << 2) /* 5 bits per byte. */
64 #define CS6 (1 << 3) /* 6 bits per byte. */
65 #define CS7 (1 << 4) /* 7 bits per byte. */
66 #define CS8 (1 << 5) /* 8 bits per byte. */
67 #define CSTOPB (1 << 6) /* Two stop bits instead of one. */
68 #define HUPCL (1 << 7) /* Hang up on last close. */
69 #define PARENB (1 << 8) /* Parity enable. */
70 #define PARODD (1 << 9) /* Odd parity instead of even. */
74 #define _ECHO (1 << 0) /* Enable echo. */
75 #define _ECHOE (1 << 1) /* Echo ERASE as a destructive backspace. */
76 #define _ECHOK (1 << 2) /* Echo KILL. */
77 #define _ECHONL (1 << 3) /* Echo '\n'. */
78 #define _ICANON (1 << 4) /* Do erase and kill processing. */
79 #define _IEXTEN (1 << 5) /* Enable extended functions. */
80 #define _ISIG (1 << 6) /* Enable signals. */
81 #define _NOFLSH (1 << 7) /* Disable flush after INTR, QUIT, or SUSP. */
82 #define _TOSTOP (1 << 8) /* Send SIGTTOU for background output. */
86 #define ECHONL _ECHONL
87 #define ICANON _ICANON
88 #define IEXTEN _IEXTEN
90 #define NOFLSH _NOFLSH
91 #define TOSTOP _TOSTOP
93 /* Control characters. */
96 #define VEOF 0 /* End-of-file character. */
97 #define VEOL 1 /* End-of-line character. */
98 #define VERASE 2 /* Erase character. */
99 #define VINTR 3 /* Interrupt character. */
100 #define VKILL 4 /* Kill character. */
101 #define VMIN 5 /* Minimum number of bytes read at once. */
102 #define VQUIT 6 /* Quit character. */
103 #define VSUSP 7 /* Suspend character. */
104 #define VTIME 8 /* Time-out value (tenths of a second). */
105 #define VSTART 9 /* Start (X-ON) character. */
106 #define VSTOP 10 /* Stop (X-OFF) character. */
108 /* Input and output baud rates. */
109 speed_t __ispeed, __ospeed;
110 #define _B0 0 /* Hang up. */
111 #define _B50 50 /* 50 baud. */
112 #define _B75 75 /* 75 baud. */
113 #define _B110 110 /* 110 baud. */
114 #define _B134 134 /* 134.5 baud. */
115 #define _B150 150 /* 150 baud. */
116 #define _B200 200 /* 200 baud. */
117 #define _B300 300 /* 300 baud. */
118 #define _B600 600 /* 600 baud. */
119 #define _B1200 1200 /* 1200 baud. */
120 #define _B1800 1800 /* 1800 baud. */
121 #define _B2400 2400 /* 2400 baud. */
122 #define _B4800 4800 /* 4800 baud. */
123 #define _B9600 9600 /* 9600 baud. */
124 #define _B19200 19200 /* 19200 baud. */
125 #define _B38400 38400 /* 38400 baud. */
145 /* Return the output baud rate stored in *TERMIOS_P. */
146 extern speed_t EXFUN(cfgetospeed, (CONST struct termios *__termios_p));
148 /* Return the input baud rate stored in *TERMIOS_P. */
149 extern speed_t EXFUN(cfgetispeed, (CONST struct termios *__termios_p));
151 /* Set the output baud rate stored in *TERMIOS_P to SPEED. */
152 extern int EXFUN(cfsetospeed, (struct termios *__termios_p, speed_t __speed));
154 /* Set the input baud rate stored in *TERMIOS_P to SPEED. */
155 extern int EXFUN(cfsetispeed, (struct termios *__termios_p, speed_t __speed));
158 /* Put the state of FD into *TERMIOS_P. */
159 extern int EXFUN(__tcgetattr, (int __fd, struct termios *__termios_p));
160 extern int EXFUN(tcgetattr, (int __fd, struct termios *__termios_p));
163 #define tcgetattr(fd, termios_p) __tcgetattr((fd), (termios_p))
164 #endif /* Optimizing. */
166 /* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */
167 #define TCSANOW 0 /* Change immediately. */
168 #define TCSADRAIN 1 /* Change when pending output is written. */
169 #define TCSAFLUSH 2 /* Flush pending input before changing. */
171 /* Set the state of FD to *TERMIOS_P. */
172 extern int EXFUN(tcsetattr, (int __fd, int __optional_actions,
173 CONST struct termios *__termios_p));
176 /* Send zero bits on FD. */
177 extern int EXFUN(tcsendbreak, (int __fd, int __duration));
179 /* Wait for pending output to be written on FD. */
180 extern int EXFUN(tcdrain, (int __fd));
182 /* Values for the QUEUE_SELECTOR argument to `tcflush'. */
183 #define TCIFLUSH 0 /* Discard data received but not yet read. */
184 #define TCOFLUSH 1 /* Discard data written but not yet sent. */
185 #define TCIOFLUSH 2 /* Discard all pending data. */
187 /* Flush pending data on FD. */
188 extern int EXFUN(tcflush, (int __fd, int __queue_selector));
190 /* Values for the ACTION argument to `tcflow'. */
191 #define TCOOFF 0 /* Suspend output. */
192 #define TCOON 1 /* Restart suspended output. */
193 #define TCIOFF 2 /* Send a STOP character. */
194 #define TCION 3 /* Send a START character. */
196 /* Suspend or restart transmission on FD. */
197 extern int EXFUN(tcflow, (int __fd, int __action));
200 #endif /* termios.h */