Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 1 | /* termiosmodule.c -- POSIX terminal I/O module implementation. */ |
| 2 | |
Guido van Rossum | ca6954a | 1999-01-14 19:31:42 +0000 | [diff] [blame] | 3 | #include "Python.h" |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 4 | |
Martin v. Löwis | be4fea6 | 2003-10-31 13:01:24 +0000 | [diff] [blame] | 5 | /* Apparently, on SGI, termios.h won't define CTRL if _XOPEN_SOURCE |
| 6 | is defined, so we define it here. */ |
| 7 | #if defined(__sgi) |
| 8 | #define CTRL(c) ((c)&037) |
| 9 | #endif |
| 10 | |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 11 | #include <termios.h> |
Fred Drake | b2877dd | 2001-05-09 17:53:06 +0000 | [diff] [blame] | 12 | #ifdef __osf__ |
| 13 | /* On OSF, sys/ioctl.h requires that struct termio already be defined, |
| 14 | * so this needs to be included first on that platform. */ |
Fred Drake | b638aaf | 2001-05-07 17:55:35 +0000 | [diff] [blame] | 15 | #include <termio.h> |
Fred Drake | b2877dd | 2001-05-09 17:53:06 +0000 | [diff] [blame] | 16 | #endif |
Fred Drake | 9b3bc49 | 2001-04-04 21:19:26 +0000 | [diff] [blame] | 17 | #include <sys/ioctl.h> |
Guido van Rossum | 1aca4d8 | 1998-03-03 22:10:18 +0000 | [diff] [blame] | 18 | |
Fred Drake | 87068f1 | 2001-05-11 16:14:17 +0000 | [diff] [blame] | 19 | /* HP-UX requires that this be included to pick up MDCD, MCTS, MDSR, |
| 20 | * MDTR, MRI, and MRTS (appearantly used internally by some things |
| 21 | * defined as macros; these are not used here directly). |
| 22 | */ |
| 23 | #ifdef HAVE_SYS_MODEM_H |
| 24 | #include <sys/modem.h> |
| 25 | #endif |
Neal Norwitz | 8225103 | 2003-05-23 14:35:24 +0000 | [diff] [blame] | 26 | /* HP-UX requires that this be included to pick up TIOCGPGRP and friends */ |
| 27 | #ifdef HAVE_SYS_BSDTTY_H |
| 28 | #include <sys/bsdtty.h> |
| 29 | #endif |
Fred Drake | 87068f1 | 2001-05-11 16:14:17 +0000 | [diff] [blame] | 30 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 31 | PyDoc_STRVAR(termios__doc__, |
| 32 | "This module provides an interface to the Posix calls for tty I/O control.\n\ |
Fred Drake | b638aaf | 2001-05-07 17:55:35 +0000 | [diff] [blame] | 33 | For a complete description of these calls, see the Posix or Unix manual\n\ |
| 34 | pages. It is only available for those Unix versions that support Posix\n\ |
| 35 | termios style tty I/O control.\n\ |
| 36 | \n\ |
| 37 | All functions in this module take a file descriptor fd as their first\n\ |
| 38 | argument. This can be an integer file descriptor, such as returned by\n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 39 | sys.stdin.fileno(), or a file object, such as sys.stdin itself."); |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 40 | |
| 41 | static PyObject *TermiosError; |
| 42 | |
Fred Drake | b638aaf | 2001-05-07 17:55:35 +0000 | [diff] [blame] | 43 | static int fdconv(PyObject* obj, void* p) |
| 44 | { |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 45 | int fd; |
Fred Drake | b638aaf | 2001-05-07 17:55:35 +0000 | [diff] [blame] | 46 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 47 | fd = PyObject_AsFileDescriptor(obj); |
| 48 | if (fd >= 0) { |
| 49 | *(int*)p = fd; |
| 50 | return 1; |
| 51 | } |
| 52 | return 0; |
Fred Drake | b638aaf | 2001-05-07 17:55:35 +0000 | [diff] [blame] | 53 | } |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 54 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 55 | PyDoc_STRVAR(termios_tcgetattr__doc__, |
| 56 | "tcgetattr(fd) -> list_of_attrs\n\ |
Fred Drake | b638aaf | 2001-05-07 17:55:35 +0000 | [diff] [blame] | 57 | \n\ |
Guido van Rossum | 1aca4d8 | 1998-03-03 22:10:18 +0000 | [diff] [blame] | 58 | Get the tty attributes for file descriptor fd, as follows:\n\ |
| 59 | [iflag, oflag, cflag, lflag, ispeed, ospeed, cc] where cc is a list\n\ |
| 60 | of the tty special characters (each a string of length 1, except the items\n\ |
| 61 | with indices VMIN and VTIME, which are integers when these fields are\n\ |
| 62 | defined). The interpretation of the flags and the speeds as well as the\n\ |
| 63 | indexing in the cc array must be done using the symbolic constants defined\n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 64 | in this module."); |
Guido van Rossum | 1aca4d8 | 1998-03-03 22:10:18 +0000 | [diff] [blame] | 65 | |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 66 | static PyObject * |
Peter Schneider-Kamp | 416d413 | 2000-07-10 12:15:54 +0000 | [diff] [blame] | 67 | termios_tcgetattr(PyObject *self, PyObject *args) |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 68 | { |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 69 | int fd; |
| 70 | struct termios mode; |
| 71 | PyObject *cc; |
| 72 | speed_t ispeed, ospeed; |
| 73 | PyObject *v; |
| 74 | int i; |
| 75 | char ch; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 76 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 77 | if (!PyArg_ParseTuple(args, "O&:tcgetattr", |
| 78 | fdconv, (void*)&fd)) |
| 79 | return NULL; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 80 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 81 | if (tcgetattr(fd, &mode) == -1) |
| 82 | return PyErr_SetFromErrno(TermiosError); |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 83 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 84 | ispeed = cfgetispeed(&mode); |
| 85 | ospeed = cfgetospeed(&mode); |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 86 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 87 | cc = PyList_New(NCCS); |
| 88 | if (cc == NULL) |
| 89 | return NULL; |
| 90 | for (i = 0; i < NCCS; i++) { |
| 91 | ch = (char)mode.c_cc[i]; |
| 92 | v = PyBytes_FromStringAndSize(&ch, 1); |
| 93 | if (v == NULL) |
| 94 | goto err; |
| 95 | PyList_SetItem(cc, i, v); |
| 96 | } |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 97 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 98 | /* Convert the MIN and TIME slots to integer. On some systems, the |
| 99 | MIN and TIME slots are the same as the EOF and EOL slots. So we |
| 100 | only do this in noncanonical input mode. */ |
| 101 | if ((mode.c_lflag & ICANON) == 0) { |
| 102 | v = PyLong_FromLong((long)mode.c_cc[VMIN]); |
| 103 | if (v == NULL) |
| 104 | goto err; |
| 105 | PyList_SetItem(cc, VMIN, v); |
| 106 | v = PyLong_FromLong((long)mode.c_cc[VTIME]); |
| 107 | if (v == NULL) |
| 108 | goto err; |
| 109 | PyList_SetItem(cc, VTIME, v); |
| 110 | } |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 111 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 112 | if (!(v = PyList_New(7))) |
| 113 | goto err; |
Barry Warsaw | 5709dcf | 1997-01-10 18:42:18 +0000 | [diff] [blame] | 114 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 115 | PyList_SetItem(v, 0, PyLong_FromLong((long)mode.c_iflag)); |
| 116 | PyList_SetItem(v, 1, PyLong_FromLong((long)mode.c_oflag)); |
| 117 | PyList_SetItem(v, 2, PyLong_FromLong((long)mode.c_cflag)); |
| 118 | PyList_SetItem(v, 3, PyLong_FromLong((long)mode.c_lflag)); |
| 119 | PyList_SetItem(v, 4, PyLong_FromLong((long)ispeed)); |
| 120 | PyList_SetItem(v, 5, PyLong_FromLong((long)ospeed)); |
| 121 | PyList_SetItem(v, 6, cc); |
| 122 | if (PyErr_Occurred()){ |
| 123 | Py_DECREF(v); |
| 124 | goto err; |
| 125 | } |
| 126 | return v; |
Barry Warsaw | 5709dcf | 1997-01-10 18:42:18 +0000 | [diff] [blame] | 127 | err: |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 128 | Py_DECREF(cc); |
| 129 | return NULL; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 130 | } |
| 131 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 132 | PyDoc_STRVAR(termios_tcsetattr__doc__, |
| 133 | "tcsetattr(fd, when, attributes) -> None\n\ |
Fred Drake | b638aaf | 2001-05-07 17:55:35 +0000 | [diff] [blame] | 134 | \n\ |
Guido van Rossum | 1aca4d8 | 1998-03-03 22:10:18 +0000 | [diff] [blame] | 135 | Set the tty attributes for file descriptor fd.\n\ |
| 136 | The attributes to be set are taken from the attributes argument, which\n\ |
| 137 | is a list like the one returned by tcgetattr(). The when argument\n\ |
Fred Drake | 29fd031 | 2001-04-09 19:32:52 +0000 | [diff] [blame] | 138 | determines when the attributes are changed: termios.TCSANOW to\n\ |
| 139 | change immediately, termios.TCSADRAIN to change after transmitting all\n\ |
| 140 | queued output, or termios.TCSAFLUSH to change after transmitting all\n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 141 | queued output and discarding all queued input. "); |
Guido van Rossum | 1aca4d8 | 1998-03-03 22:10:18 +0000 | [diff] [blame] | 142 | |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 143 | static PyObject * |
Peter Schneider-Kamp | 416d413 | 2000-07-10 12:15:54 +0000 | [diff] [blame] | 144 | termios_tcsetattr(PyObject *self, PyObject *args) |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 145 | { |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 146 | int fd, when; |
| 147 | struct termios mode; |
| 148 | speed_t ispeed, ospeed; |
| 149 | PyObject *term, *cc, *v; |
| 150 | int i; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 151 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 152 | if (!PyArg_ParseTuple(args, "O&iO:tcsetattr", |
| 153 | fdconv, &fd, &when, &term)) |
| 154 | return NULL; |
| 155 | if (!PyList_Check(term) || PyList_Size(term) != 7) { |
| 156 | PyErr_SetString(PyExc_TypeError, |
| 157 | "tcsetattr, arg 3: must be 7 element list"); |
| 158 | return NULL; |
| 159 | } |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 160 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 161 | /* Get the old mode, in case there are any hidden fields... */ |
| 162 | if (tcgetattr(fd, &mode) == -1) |
| 163 | return PyErr_SetFromErrno(TermiosError); |
| 164 | mode.c_iflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 0)); |
| 165 | mode.c_oflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 1)); |
| 166 | mode.c_cflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 2)); |
| 167 | mode.c_lflag = (tcflag_t) PyLong_AsLong(PyList_GetItem(term, 3)); |
| 168 | ispeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 4)); |
| 169 | ospeed = (speed_t) PyLong_AsLong(PyList_GetItem(term, 5)); |
| 170 | cc = PyList_GetItem(term, 6); |
| 171 | if (PyErr_Occurred()) |
| 172 | return NULL; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 173 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 174 | if (!PyList_Check(cc) || PyList_Size(cc) != NCCS) { |
| 175 | PyErr_Format(PyExc_TypeError, |
| 176 | "tcsetattr: attributes[6] must be %d element list", |
| 177 | NCCS); |
| 178 | return NULL; |
| 179 | } |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 180 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 181 | for (i = 0; i < NCCS; i++) { |
| 182 | v = PyList_GetItem(cc, i); |
Barry Warsaw | 5709dcf | 1997-01-10 18:42:18 +0000 | [diff] [blame] | 183 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 184 | if (PyBytes_Check(v) && PyBytes_Size(v) == 1) |
| 185 | mode.c_cc[i] = (cc_t) * PyBytes_AsString(v); |
| 186 | else if (PyLong_Check(v)) |
| 187 | mode.c_cc[i] = (cc_t) PyLong_AsLong(v); |
| 188 | else { |
| 189 | PyErr_SetString(PyExc_TypeError, |
Fred Drake | b638aaf | 2001-05-07 17:55:35 +0000 | [diff] [blame] | 190 | "tcsetattr: elements of attributes must be characters or integers"); |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 191 | return NULL; |
| 192 | } |
| 193 | } |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 194 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 195 | if (cfsetispeed(&mode, (speed_t) ispeed) == -1) |
| 196 | return PyErr_SetFromErrno(TermiosError); |
| 197 | if (cfsetospeed(&mode, (speed_t) ospeed) == -1) |
| 198 | return PyErr_SetFromErrno(TermiosError); |
| 199 | if (tcsetattr(fd, when, &mode) == -1) |
| 200 | return PyErr_SetFromErrno(TermiosError); |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 201 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 202 | Py_INCREF(Py_None); |
| 203 | return Py_None; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 204 | } |
| 205 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 206 | PyDoc_STRVAR(termios_tcsendbreak__doc__, |
| 207 | "tcsendbreak(fd, duration) -> None\n\ |
Fred Drake | b638aaf | 2001-05-07 17:55:35 +0000 | [diff] [blame] | 208 | \n\ |
Guido van Rossum | 1aca4d8 | 1998-03-03 22:10:18 +0000 | [diff] [blame] | 209 | Send a break on file descriptor fd.\n\ |
Fred Drake | b638aaf | 2001-05-07 17:55:35 +0000 | [diff] [blame] | 210 | A zero duration sends a break for 0.25-0.5 seconds; a nonzero duration\n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 211 | has a system dependent meaning."); |
Guido van Rossum | 1aca4d8 | 1998-03-03 22:10:18 +0000 | [diff] [blame] | 212 | |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 213 | static PyObject * |
Peter Schneider-Kamp | 416d413 | 2000-07-10 12:15:54 +0000 | [diff] [blame] | 214 | termios_tcsendbreak(PyObject *self, PyObject *args) |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 215 | { |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 216 | int fd, duration; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 217 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 218 | if (!PyArg_ParseTuple(args, "O&i:tcsendbreak", |
| 219 | fdconv, &fd, &duration)) |
| 220 | return NULL; |
| 221 | if (tcsendbreak(fd, duration) == -1) |
| 222 | return PyErr_SetFromErrno(TermiosError); |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 223 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 224 | Py_INCREF(Py_None); |
| 225 | return Py_None; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 226 | } |
| 227 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 228 | PyDoc_STRVAR(termios_tcdrain__doc__, |
| 229 | "tcdrain(fd) -> None\n\ |
Fred Drake | b638aaf | 2001-05-07 17:55:35 +0000 | [diff] [blame] | 230 | \n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 231 | Wait until all output written to file descriptor fd has been transmitted."); |
Guido van Rossum | 1aca4d8 | 1998-03-03 22:10:18 +0000 | [diff] [blame] | 232 | |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 233 | static PyObject * |
Peter Schneider-Kamp | 416d413 | 2000-07-10 12:15:54 +0000 | [diff] [blame] | 234 | termios_tcdrain(PyObject *self, PyObject *args) |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 235 | { |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 236 | int fd; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 237 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 238 | if (!PyArg_ParseTuple(args, "O&:tcdrain", |
| 239 | fdconv, &fd)) |
| 240 | return NULL; |
| 241 | if (tcdrain(fd) == -1) |
| 242 | return PyErr_SetFromErrno(TermiosError); |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 243 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 244 | Py_INCREF(Py_None); |
| 245 | return Py_None; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 246 | } |
| 247 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 248 | PyDoc_STRVAR(termios_tcflush__doc__, |
| 249 | "tcflush(fd, queue) -> None\n\ |
Fred Drake | b638aaf | 2001-05-07 17:55:35 +0000 | [diff] [blame] | 250 | \n\ |
Guido van Rossum | 1aca4d8 | 1998-03-03 22:10:18 +0000 | [diff] [blame] | 251 | Discard queued data on file descriptor fd.\n\ |
Fred Drake | 29fd031 | 2001-04-09 19:32:52 +0000 | [diff] [blame] | 252 | The queue selector specifies which queue: termios.TCIFLUSH for the input\n\ |
| 253 | queue, termios.TCOFLUSH for the output queue, or termios.TCIOFLUSH for\n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 254 | both queues. "); |
Guido van Rossum | 1aca4d8 | 1998-03-03 22:10:18 +0000 | [diff] [blame] | 255 | |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 256 | static PyObject * |
Peter Schneider-Kamp | 416d413 | 2000-07-10 12:15:54 +0000 | [diff] [blame] | 257 | termios_tcflush(PyObject *self, PyObject *args) |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 258 | { |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 259 | int fd, queue; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 260 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 261 | if (!PyArg_ParseTuple(args, "O&i:tcflush", |
| 262 | fdconv, &fd, &queue)) |
| 263 | return NULL; |
| 264 | if (tcflush(fd, queue) == -1) |
| 265 | return PyErr_SetFromErrno(TermiosError); |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 266 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 267 | Py_INCREF(Py_None); |
| 268 | return Py_None; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 269 | } |
| 270 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 271 | PyDoc_STRVAR(termios_tcflow__doc__, |
| 272 | "tcflow(fd, action) -> None\n\ |
Fred Drake | b638aaf | 2001-05-07 17:55:35 +0000 | [diff] [blame] | 273 | \n\ |
Guido van Rossum | 1aca4d8 | 1998-03-03 22:10:18 +0000 | [diff] [blame] | 274 | Suspend or resume input or output on file descriptor fd.\n\ |
Fred Drake | 29fd031 | 2001-04-09 19:32:52 +0000 | [diff] [blame] | 275 | The action argument can be termios.TCOOFF to suspend output,\n\ |
| 276 | termios.TCOON to restart output, termios.TCIOFF to suspend input,\n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 277 | or termios.TCION to restart input."); |
Guido van Rossum | 1aca4d8 | 1998-03-03 22:10:18 +0000 | [diff] [blame] | 278 | |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 279 | static PyObject * |
Peter Schneider-Kamp | 416d413 | 2000-07-10 12:15:54 +0000 | [diff] [blame] | 280 | termios_tcflow(PyObject *self, PyObject *args) |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 281 | { |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 282 | int fd, action; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 283 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 284 | if (!PyArg_ParseTuple(args, "O&i:tcflow", |
| 285 | fdconv, &fd, &action)) |
| 286 | return NULL; |
| 287 | if (tcflow(fd, action) == -1) |
| 288 | return PyErr_SetFromErrno(TermiosError); |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 289 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 290 | Py_INCREF(Py_None); |
| 291 | return Py_None; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 292 | } |
| 293 | |
| 294 | static PyMethodDef termios_methods[] = |
| 295 | { |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 296 | {"tcgetattr", termios_tcgetattr, |
| 297 | METH_VARARGS, termios_tcgetattr__doc__}, |
| 298 | {"tcsetattr", termios_tcsetattr, |
| 299 | METH_VARARGS, termios_tcsetattr__doc__}, |
| 300 | {"tcsendbreak", termios_tcsendbreak, |
| 301 | METH_VARARGS, termios_tcsendbreak__doc__}, |
| 302 | {"tcdrain", termios_tcdrain, |
| 303 | METH_VARARGS, termios_tcdrain__doc__}, |
| 304 | {"tcflush", termios_tcflush, |
| 305 | METH_VARARGS, termios_tcflush__doc__}, |
| 306 | {"tcflow", termios_tcflow, |
| 307 | METH_VARARGS, termios_tcflow__doc__}, |
| 308 | {NULL, NULL} |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 309 | }; |
| 310 | |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 311 | |
Fred Drake | 9ef7fa8 | 2001-03-01 21:54:49 +0000 | [diff] [blame] | 312 | #if defined(VSWTCH) && !defined(VSWTC) |
| 313 | #define VSWTC VSWTCH |
| 314 | #endif |
| 315 | |
| 316 | #if defined(VSWTC) && !defined(VSWTCH) |
| 317 | #define VSWTCH VSWTC |
| 318 | #endif |
| 319 | |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 320 | static struct constant { |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 321 | char *name; |
| 322 | long value; |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 323 | } termios_constants[] = { |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 324 | /* cfgetospeed(), cfsetospeed() constants */ |
| 325 | {"B0", B0}, |
| 326 | {"B50", B50}, |
| 327 | {"B75", B75}, |
| 328 | {"B110", B110}, |
| 329 | {"B134", B134}, |
| 330 | {"B150", B150}, |
| 331 | {"B200", B200}, |
| 332 | {"B300", B300}, |
| 333 | {"B600", B600}, |
| 334 | {"B1200", B1200}, |
| 335 | {"B1800", B1800}, |
| 336 | {"B2400", B2400}, |
| 337 | {"B4800", B4800}, |
| 338 | {"B9600", B9600}, |
| 339 | {"B19200", B19200}, |
| 340 | {"B38400", B38400}, |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 341 | #ifdef B57600 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 342 | {"B57600", B57600}, |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 343 | #endif |
| 344 | #ifdef B115200 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 345 | {"B115200", B115200}, |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 346 | #endif |
Fred Drake | abb379e | 2001-03-01 03:28:08 +0000 | [diff] [blame] | 347 | #ifdef B230400 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 348 | {"B230400", B230400}, |
Fred Drake | abb379e | 2001-03-01 03:28:08 +0000 | [diff] [blame] | 349 | #endif |
Fred Drake | 9ef7fa8 | 2001-03-01 21:54:49 +0000 | [diff] [blame] | 350 | #ifdef CBAUDEX |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 351 | {"CBAUDEX", CBAUDEX}, |
Fred Drake | 9ef7fa8 | 2001-03-01 21:54:49 +0000 | [diff] [blame] | 352 | #endif |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 353 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 354 | /* tcsetattr() constants */ |
| 355 | {"TCSANOW", TCSANOW}, |
| 356 | {"TCSADRAIN", TCSADRAIN}, |
| 357 | {"TCSAFLUSH", TCSAFLUSH}, |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 358 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 359 | /* tcflush() constants */ |
| 360 | {"TCIFLUSH", TCIFLUSH}, |
| 361 | {"TCOFLUSH", TCOFLUSH}, |
| 362 | {"TCIOFLUSH", TCIOFLUSH}, |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 363 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 364 | /* tcflow() constants */ |
| 365 | {"TCOOFF", TCOOFF}, |
| 366 | {"TCOON", TCOON}, |
| 367 | {"TCIOFF", TCIOFF}, |
| 368 | {"TCION", TCION}, |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 369 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 370 | /* struct termios.c_iflag constants */ |
| 371 | {"IGNBRK", IGNBRK}, |
| 372 | {"BRKINT", BRKINT}, |
| 373 | {"IGNPAR", IGNPAR}, |
| 374 | {"PARMRK", PARMRK}, |
| 375 | {"INPCK", INPCK}, |
| 376 | {"ISTRIP", ISTRIP}, |
| 377 | {"INLCR", INLCR}, |
| 378 | {"IGNCR", IGNCR}, |
| 379 | {"ICRNL", ICRNL}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 380 | #ifdef IUCLC |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 381 | {"IUCLC", IUCLC}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 382 | #endif |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 383 | {"IXON", IXON}, |
| 384 | {"IXANY", IXANY}, |
| 385 | {"IXOFF", IXOFF}, |
Thomas Wouters | 2b30524 | 2001-06-15 12:05:44 +0000 | [diff] [blame] | 386 | #ifdef IMAXBEL |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 387 | {"IMAXBEL", IMAXBEL}, |
Thomas Wouters | 2b30524 | 2001-06-15 12:05:44 +0000 | [diff] [blame] | 388 | #endif |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 389 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 390 | /* struct termios.c_oflag constants */ |
| 391 | {"OPOST", OPOST}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 392 | #ifdef OLCUC |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 393 | {"OLCUC", OLCUC}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 394 | #endif |
Andrew MacIntyre | 7bf6833 | 2002-03-03 02:59:16 +0000 | [diff] [blame] | 395 | #ifdef ONLCR |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 396 | {"ONLCR", ONLCR}, |
Andrew MacIntyre | 7bf6833 | 2002-03-03 02:59:16 +0000 | [diff] [blame] | 397 | #endif |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 398 | #ifdef OCRNL |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 399 | {"OCRNL", OCRNL}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 400 | #endif |
| 401 | #ifdef ONOCR |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 402 | {"ONOCR", ONOCR}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 403 | #endif |
| 404 | #ifdef ONLRET |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 405 | {"ONLRET", ONLRET}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 406 | #endif |
| 407 | #ifdef OFILL |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 408 | {"OFILL", OFILL}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 409 | #endif |
| 410 | #ifdef OFDEL |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 411 | {"OFDEL", OFDEL}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 412 | #endif |
| 413 | #ifdef NLDLY |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 414 | {"NLDLY", NLDLY}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 415 | #endif |
| 416 | #ifdef CRDLY |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 417 | {"CRDLY", CRDLY}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 418 | #endif |
| 419 | #ifdef TABDLY |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 420 | {"TABDLY", TABDLY}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 421 | #endif |
| 422 | #ifdef BSDLY |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 423 | {"BSDLY", BSDLY}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 424 | #endif |
| 425 | #ifdef VTDLY |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 426 | {"VTDLY", VTDLY}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 427 | #endif |
| 428 | #ifdef FFDLY |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 429 | {"FFDLY", FFDLY}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 430 | #endif |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 431 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 432 | /* struct termios.c_oflag-related values (delay mask) */ |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 433 | #ifdef NL0 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 434 | {"NL0", NL0}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 435 | #endif |
| 436 | #ifdef NL1 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 437 | {"NL1", NL1}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 438 | #endif |
| 439 | #ifdef CR0 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 440 | {"CR0", CR0}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 441 | #endif |
| 442 | #ifdef CR1 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 443 | {"CR1", CR1}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 444 | #endif |
| 445 | #ifdef CR2 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 446 | {"CR2", CR2}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 447 | #endif |
| 448 | #ifdef CR3 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 449 | {"CR3", CR3}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 450 | #endif |
| 451 | #ifdef TAB0 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 452 | {"TAB0", TAB0}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 453 | #endif |
| 454 | #ifdef TAB1 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 455 | {"TAB1", TAB1}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 456 | #endif |
| 457 | #ifdef TAB2 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 458 | {"TAB2", TAB2}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 459 | #endif |
| 460 | #ifdef TAB3 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 461 | {"TAB3", TAB3}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 462 | #endif |
Fred Drake | dedbebf | 2001-03-02 06:50:58 +0000 | [diff] [blame] | 463 | #ifdef XTABS |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 464 | {"XTABS", XTABS}, |
Fred Drake | dedbebf | 2001-03-02 06:50:58 +0000 | [diff] [blame] | 465 | #endif |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 466 | #ifdef BS0 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 467 | {"BS0", BS0}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 468 | #endif |
| 469 | #ifdef BS1 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 470 | {"BS1", BS1}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 471 | #endif |
| 472 | #ifdef VT0 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 473 | {"VT0", VT0}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 474 | #endif |
| 475 | #ifdef VT1 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 476 | {"VT1", VT1}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 477 | #endif |
| 478 | #ifdef FF0 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 479 | {"FF0", FF0}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 480 | #endif |
| 481 | #ifdef FF1 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 482 | {"FF1", FF1}, |
Fred Drake | d85556c | 2001-03-03 18:08:52 +0000 | [diff] [blame] | 483 | #endif |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 484 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 485 | /* struct termios.c_cflag constants */ |
| 486 | {"CSIZE", CSIZE}, |
| 487 | {"CSTOPB", CSTOPB}, |
| 488 | {"CREAD", CREAD}, |
| 489 | {"PARENB", PARENB}, |
| 490 | {"PARODD", PARODD}, |
| 491 | {"HUPCL", HUPCL}, |
| 492 | {"CLOCAL", CLOCAL}, |
Fred Drake | abb379e | 2001-03-01 03:28:08 +0000 | [diff] [blame] | 493 | #ifdef CIBAUD |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 494 | {"CIBAUD", CIBAUD}, |
Fred Drake | abb379e | 2001-03-01 03:28:08 +0000 | [diff] [blame] | 495 | #endif |
Fred Drake | dedbebf | 2001-03-02 06:50:58 +0000 | [diff] [blame] | 496 | #ifdef CRTSCTS |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 497 | {"CRTSCTS", (long)CRTSCTS}, |
Fred Drake | dedbebf | 2001-03-02 06:50:58 +0000 | [diff] [blame] | 498 | #endif |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 499 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 500 | /* struct termios.c_cflag-related values (character size) */ |
| 501 | {"CS5", CS5}, |
| 502 | {"CS6", CS6}, |
| 503 | {"CS7", CS7}, |
| 504 | {"CS8", CS8}, |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 505 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 506 | /* struct termios.c_lflag constants */ |
| 507 | {"ISIG", ISIG}, |
| 508 | {"ICANON", ICANON}, |
Fred Drake | abb379e | 2001-03-01 03:28:08 +0000 | [diff] [blame] | 509 | #ifdef XCASE |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 510 | {"XCASE", XCASE}, |
Fred Drake | abb379e | 2001-03-01 03:28:08 +0000 | [diff] [blame] | 511 | #endif |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 512 | {"ECHO", ECHO}, |
| 513 | {"ECHOE", ECHOE}, |
| 514 | {"ECHOK", ECHOK}, |
| 515 | {"ECHONL", ECHONL}, |
Thomas Wouters | 2b30524 | 2001-06-15 12:05:44 +0000 | [diff] [blame] | 516 | #ifdef ECHOCTL |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 517 | {"ECHOCTL", ECHOCTL}, |
Thomas Wouters | 2b30524 | 2001-06-15 12:05:44 +0000 | [diff] [blame] | 518 | #endif |
Fred Drake | abb379e | 2001-03-01 03:28:08 +0000 | [diff] [blame] | 519 | #ifdef ECHOPRT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 520 | {"ECHOPRT", ECHOPRT}, |
Fred Drake | abb379e | 2001-03-01 03:28:08 +0000 | [diff] [blame] | 521 | #endif |
Thomas Wouters | 2b30524 | 2001-06-15 12:05:44 +0000 | [diff] [blame] | 522 | #ifdef ECHOKE |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 523 | {"ECHOKE", ECHOKE}, |
Thomas Wouters | 2b30524 | 2001-06-15 12:05:44 +0000 | [diff] [blame] | 524 | #endif |
| 525 | #ifdef FLUSHO |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 526 | {"FLUSHO", FLUSHO}, |
Thomas Wouters | 2b30524 | 2001-06-15 12:05:44 +0000 | [diff] [blame] | 527 | #endif |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 528 | {"NOFLSH", NOFLSH}, |
| 529 | {"TOSTOP", TOSTOP}, |
Fred Drake | abb379e | 2001-03-01 03:28:08 +0000 | [diff] [blame] | 530 | #ifdef PENDIN |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 531 | {"PENDIN", PENDIN}, |
Fred Drake | abb379e | 2001-03-01 03:28:08 +0000 | [diff] [blame] | 532 | #endif |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 533 | {"IEXTEN", IEXTEN}, |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 534 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 535 | /* indexes into the control chars array returned by tcgetattr() */ |
| 536 | {"VINTR", VINTR}, |
| 537 | {"VQUIT", VQUIT}, |
| 538 | {"VERASE", VERASE}, |
| 539 | {"VKILL", VKILL}, |
| 540 | {"VEOF", VEOF}, |
| 541 | {"VTIME", VTIME}, |
| 542 | {"VMIN", VMIN}, |
Fred Drake | dedbebf | 2001-03-02 06:50:58 +0000 | [diff] [blame] | 543 | #ifdef VSWTC |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 544 | /* The #defines above ensure that if either is defined, both are, |
| 545 | * but both may be omitted by the system headers. ;-( */ |
| 546 | {"VSWTC", VSWTC}, |
| 547 | {"VSWTCH", VSWTCH}, |
Fred Drake | dedbebf | 2001-03-02 06:50:58 +0000 | [diff] [blame] | 548 | #endif |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 549 | {"VSTART", VSTART}, |
| 550 | {"VSTOP", VSTOP}, |
| 551 | {"VSUSP", VSUSP}, |
| 552 | {"VEOL", VEOL}, |
Fred Drake | d0b625d | 2001-05-22 15:44:15 +0000 | [diff] [blame] | 553 | #ifdef VREPRINT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 554 | {"VREPRINT", VREPRINT}, |
Fred Drake | 87068f1 | 2001-05-11 16:14:17 +0000 | [diff] [blame] | 555 | #endif |
Fred Drake | d0b625d | 2001-05-22 15:44:15 +0000 | [diff] [blame] | 556 | #ifdef VDISCARD |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 557 | {"VDISCARD", VDISCARD}, |
Fred Drake | 87068f1 | 2001-05-11 16:14:17 +0000 | [diff] [blame] | 558 | #endif |
Thomas Wouters | 819bb2c | 2001-06-11 15:25:16 +0000 | [diff] [blame] | 559 | #ifdef VWERASE |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 560 | {"VWERASE", VWERASE}, |
Thomas Wouters | 819bb2c | 2001-06-11 15:25:16 +0000 | [diff] [blame] | 561 | #endif |
Thomas Wouters | 2b30524 | 2001-06-15 12:05:44 +0000 | [diff] [blame] | 562 | #ifdef VLNEXT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 563 | {"VLNEXT", VLNEXT}, |
Thomas Wouters | 2b30524 | 2001-06-15 12:05:44 +0000 | [diff] [blame] | 564 | #endif |
Andrew MacIntyre | 7bf6833 | 2002-03-03 02:59:16 +0000 | [diff] [blame] | 565 | #ifdef VEOL2 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 566 | {"VEOL2", VEOL2}, |
Andrew MacIntyre | 7bf6833 | 2002-03-03 02:59:16 +0000 | [diff] [blame] | 567 | #endif |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 568 | |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 569 | |
| 570 | #ifdef B460800 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 571 | {"B460800", B460800}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 572 | #endif |
| 573 | #ifdef CBAUD |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 574 | {"CBAUD", CBAUD}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 575 | #endif |
| 576 | #ifdef CDEL |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 577 | {"CDEL", CDEL}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 578 | #endif |
| 579 | #ifdef CDSUSP |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 580 | {"CDSUSP", CDSUSP}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 581 | #endif |
| 582 | #ifdef CEOF |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 583 | {"CEOF", CEOF}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 584 | #endif |
| 585 | #ifdef CEOL |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 586 | {"CEOL", CEOL}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 587 | #endif |
| 588 | #ifdef CEOL2 |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 589 | {"CEOL2", CEOL2}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 590 | #endif |
| 591 | #ifdef CEOT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 592 | {"CEOT", CEOT}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 593 | #endif |
| 594 | #ifdef CERASE |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 595 | {"CERASE", CERASE}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 596 | #endif |
| 597 | #ifdef CESC |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 598 | {"CESC", CESC}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 599 | #endif |
| 600 | #ifdef CFLUSH |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 601 | {"CFLUSH", CFLUSH}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 602 | #endif |
| 603 | #ifdef CINTR |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 604 | {"CINTR", CINTR}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 605 | #endif |
| 606 | #ifdef CKILL |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 607 | {"CKILL", CKILL}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 608 | #endif |
| 609 | #ifdef CLNEXT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 610 | {"CLNEXT", CLNEXT}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 611 | #endif |
| 612 | #ifdef CNUL |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 613 | {"CNUL", CNUL}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 614 | #endif |
| 615 | #ifdef COMMON |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 616 | {"COMMON", COMMON}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 617 | #endif |
| 618 | #ifdef CQUIT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 619 | {"CQUIT", CQUIT}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 620 | #endif |
| 621 | #ifdef CRPRNT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 622 | {"CRPRNT", CRPRNT}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 623 | #endif |
| 624 | #ifdef CSTART |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 625 | {"CSTART", CSTART}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 626 | #endif |
| 627 | #ifdef CSTOP |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 628 | {"CSTOP", CSTOP}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 629 | #endif |
| 630 | #ifdef CSUSP |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 631 | {"CSUSP", CSUSP}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 632 | #endif |
| 633 | #ifdef CSWTCH |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 634 | {"CSWTCH", CSWTCH}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 635 | #endif |
| 636 | #ifdef CWERASE |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 637 | {"CWERASE", CWERASE}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 638 | #endif |
| 639 | #ifdef EXTA |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 640 | {"EXTA", EXTA}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 641 | #endif |
| 642 | #ifdef EXTB |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 643 | {"EXTB", EXTB}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 644 | #endif |
| 645 | #ifdef FIOASYNC |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 646 | {"FIOASYNC", FIOASYNC}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 647 | #endif |
| 648 | #ifdef FIOCLEX |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 649 | {"FIOCLEX", FIOCLEX}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 650 | #endif |
| 651 | #ifdef FIONBIO |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 652 | {"FIONBIO", FIONBIO}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 653 | #endif |
| 654 | #ifdef FIONCLEX |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 655 | {"FIONCLEX", FIONCLEX}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 656 | #endif |
| 657 | #ifdef FIONREAD |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 658 | {"FIONREAD", FIONREAD}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 659 | #endif |
| 660 | #ifdef IBSHIFT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 661 | {"IBSHIFT", IBSHIFT}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 662 | #endif |
| 663 | #ifdef INIT_C_CC |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 664 | {"INIT_C_CC", INIT_C_CC}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 665 | #endif |
| 666 | #ifdef IOCSIZE_MASK |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 667 | {"IOCSIZE_MASK", IOCSIZE_MASK}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 668 | #endif |
| 669 | #ifdef IOCSIZE_SHIFT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 670 | {"IOCSIZE_SHIFT", IOCSIZE_SHIFT}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 671 | #endif |
| 672 | #ifdef NCC |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 673 | {"NCC", NCC}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 674 | #endif |
| 675 | #ifdef NCCS |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 676 | {"NCCS", NCCS}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 677 | #endif |
| 678 | #ifdef NSWTCH |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 679 | {"NSWTCH", NSWTCH}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 680 | #endif |
| 681 | #ifdef N_MOUSE |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 682 | {"N_MOUSE", N_MOUSE}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 683 | #endif |
| 684 | #ifdef N_PPP |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 685 | {"N_PPP", N_PPP}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 686 | #endif |
| 687 | #ifdef N_SLIP |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 688 | {"N_SLIP", N_SLIP}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 689 | #endif |
| 690 | #ifdef N_STRIP |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 691 | {"N_STRIP", N_STRIP}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 692 | #endif |
| 693 | #ifdef N_TTY |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 694 | {"N_TTY", N_TTY}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 695 | #endif |
| 696 | #ifdef TCFLSH |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 697 | {"TCFLSH", TCFLSH}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 698 | #endif |
| 699 | #ifdef TCGETA |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 700 | {"TCGETA", TCGETA}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 701 | #endif |
| 702 | #ifdef TCGETS |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 703 | {"TCGETS", TCGETS}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 704 | #endif |
| 705 | #ifdef TCSBRK |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 706 | {"TCSBRK", TCSBRK}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 707 | #endif |
| 708 | #ifdef TCSBRKP |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 709 | {"TCSBRKP", TCSBRKP}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 710 | #endif |
| 711 | #ifdef TCSETA |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 712 | {"TCSETA", TCSETA}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 713 | #endif |
| 714 | #ifdef TCSETAF |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 715 | {"TCSETAF", TCSETAF}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 716 | #endif |
| 717 | #ifdef TCSETAW |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 718 | {"TCSETAW", TCSETAW}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 719 | #endif |
| 720 | #ifdef TCSETS |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 721 | {"TCSETS", TCSETS}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 722 | #endif |
| 723 | #ifdef TCSETSF |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 724 | {"TCSETSF", TCSETSF}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 725 | #endif |
| 726 | #ifdef TCSETSW |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 727 | {"TCSETSW", TCSETSW}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 728 | #endif |
| 729 | #ifdef TCXONC |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 730 | {"TCXONC", TCXONC}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 731 | #endif |
| 732 | #ifdef TIOCCONS |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 733 | {"TIOCCONS", TIOCCONS}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 734 | #endif |
| 735 | #ifdef TIOCEXCL |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 736 | {"TIOCEXCL", TIOCEXCL}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 737 | #endif |
| 738 | #ifdef TIOCGETD |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 739 | {"TIOCGETD", TIOCGETD}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 740 | #endif |
| 741 | #ifdef TIOCGICOUNT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 742 | {"TIOCGICOUNT", TIOCGICOUNT}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 743 | #endif |
| 744 | #ifdef TIOCGLCKTRMIOS |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 745 | {"TIOCGLCKTRMIOS", TIOCGLCKTRMIOS}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 746 | #endif |
| 747 | #ifdef TIOCGPGRP |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 748 | {"TIOCGPGRP", TIOCGPGRP}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 749 | #endif |
| 750 | #ifdef TIOCGSERIAL |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 751 | {"TIOCGSERIAL", TIOCGSERIAL}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 752 | #endif |
| 753 | #ifdef TIOCGSOFTCAR |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 754 | {"TIOCGSOFTCAR", TIOCGSOFTCAR}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 755 | #endif |
| 756 | #ifdef TIOCGWINSZ |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 757 | {"TIOCGWINSZ", TIOCGWINSZ}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 758 | #endif |
| 759 | #ifdef TIOCINQ |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 760 | {"TIOCINQ", TIOCINQ}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 761 | #endif |
| 762 | #ifdef TIOCLINUX |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 763 | {"TIOCLINUX", TIOCLINUX}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 764 | #endif |
| 765 | #ifdef TIOCMBIC |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 766 | {"TIOCMBIC", TIOCMBIC}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 767 | #endif |
| 768 | #ifdef TIOCMBIS |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 769 | {"TIOCMBIS", TIOCMBIS}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 770 | #endif |
| 771 | #ifdef TIOCMGET |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 772 | {"TIOCMGET", TIOCMGET}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 773 | #endif |
| 774 | #ifdef TIOCMIWAIT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 775 | {"TIOCMIWAIT", TIOCMIWAIT}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 776 | #endif |
| 777 | #ifdef TIOCMSET |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 778 | {"TIOCMSET", TIOCMSET}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 779 | #endif |
| 780 | #ifdef TIOCM_CAR |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 781 | {"TIOCM_CAR", TIOCM_CAR}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 782 | #endif |
| 783 | #ifdef TIOCM_CD |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 784 | {"TIOCM_CD", TIOCM_CD}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 785 | #endif |
| 786 | #ifdef TIOCM_CTS |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 787 | {"TIOCM_CTS", TIOCM_CTS}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 788 | #endif |
| 789 | #ifdef TIOCM_DSR |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 790 | {"TIOCM_DSR", TIOCM_DSR}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 791 | #endif |
| 792 | #ifdef TIOCM_DTR |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 793 | {"TIOCM_DTR", TIOCM_DTR}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 794 | #endif |
| 795 | #ifdef TIOCM_LE |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 796 | {"TIOCM_LE", TIOCM_LE}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 797 | #endif |
| 798 | #ifdef TIOCM_RI |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 799 | {"TIOCM_RI", TIOCM_RI}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 800 | #endif |
| 801 | #ifdef TIOCM_RNG |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 802 | {"TIOCM_RNG", TIOCM_RNG}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 803 | #endif |
| 804 | #ifdef TIOCM_RTS |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 805 | {"TIOCM_RTS", TIOCM_RTS}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 806 | #endif |
| 807 | #ifdef TIOCM_SR |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 808 | {"TIOCM_SR", TIOCM_SR}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 809 | #endif |
| 810 | #ifdef TIOCM_ST |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 811 | {"TIOCM_ST", TIOCM_ST}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 812 | #endif |
| 813 | #ifdef TIOCNOTTY |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 814 | {"TIOCNOTTY", TIOCNOTTY}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 815 | #endif |
| 816 | #ifdef TIOCNXCL |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 817 | {"TIOCNXCL", TIOCNXCL}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 818 | #endif |
| 819 | #ifdef TIOCOUTQ |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 820 | {"TIOCOUTQ", TIOCOUTQ}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 821 | #endif |
| 822 | #ifdef TIOCPKT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 823 | {"TIOCPKT", TIOCPKT}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 824 | #endif |
| 825 | #ifdef TIOCPKT_DATA |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 826 | {"TIOCPKT_DATA", TIOCPKT_DATA}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 827 | #endif |
| 828 | #ifdef TIOCPKT_DOSTOP |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 829 | {"TIOCPKT_DOSTOP", TIOCPKT_DOSTOP}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 830 | #endif |
| 831 | #ifdef TIOCPKT_FLUSHREAD |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 832 | {"TIOCPKT_FLUSHREAD", TIOCPKT_FLUSHREAD}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 833 | #endif |
| 834 | #ifdef TIOCPKT_FLUSHWRITE |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 835 | {"TIOCPKT_FLUSHWRITE", TIOCPKT_FLUSHWRITE}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 836 | #endif |
| 837 | #ifdef TIOCPKT_NOSTOP |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 838 | {"TIOCPKT_NOSTOP", TIOCPKT_NOSTOP}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 839 | #endif |
| 840 | #ifdef TIOCPKT_START |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 841 | {"TIOCPKT_START", TIOCPKT_START}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 842 | #endif |
| 843 | #ifdef TIOCPKT_STOP |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 844 | {"TIOCPKT_STOP", TIOCPKT_STOP}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 845 | #endif |
| 846 | #ifdef TIOCSCTTY |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 847 | {"TIOCSCTTY", TIOCSCTTY}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 848 | #endif |
| 849 | #ifdef TIOCSERCONFIG |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 850 | {"TIOCSERCONFIG", TIOCSERCONFIG}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 851 | #endif |
| 852 | #ifdef TIOCSERGETLSR |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 853 | {"TIOCSERGETLSR", TIOCSERGETLSR}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 854 | #endif |
| 855 | #ifdef TIOCSERGETMULTI |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 856 | {"TIOCSERGETMULTI", TIOCSERGETMULTI}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 857 | #endif |
| 858 | #ifdef TIOCSERGSTRUCT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 859 | {"TIOCSERGSTRUCT", TIOCSERGSTRUCT}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 860 | #endif |
| 861 | #ifdef TIOCSERGWILD |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 862 | {"TIOCSERGWILD", TIOCSERGWILD}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 863 | #endif |
| 864 | #ifdef TIOCSERSETMULTI |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 865 | {"TIOCSERSETMULTI", TIOCSERSETMULTI}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 866 | #endif |
| 867 | #ifdef TIOCSERSWILD |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 868 | {"TIOCSERSWILD", TIOCSERSWILD}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 869 | #endif |
| 870 | #ifdef TIOCSER_TEMT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 871 | {"TIOCSER_TEMT", TIOCSER_TEMT}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 872 | #endif |
| 873 | #ifdef TIOCSETD |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 874 | {"TIOCSETD", TIOCSETD}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 875 | #endif |
| 876 | #ifdef TIOCSLCKTRMIOS |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 877 | {"TIOCSLCKTRMIOS", TIOCSLCKTRMIOS}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 878 | #endif |
| 879 | #ifdef TIOCSPGRP |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 880 | {"TIOCSPGRP", TIOCSPGRP}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 881 | #endif |
| 882 | #ifdef TIOCSSERIAL |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 883 | {"TIOCSSERIAL", TIOCSSERIAL}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 884 | #endif |
| 885 | #ifdef TIOCSSOFTCAR |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 886 | {"TIOCSSOFTCAR", TIOCSSOFTCAR}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 887 | #endif |
| 888 | #ifdef TIOCSTI |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 889 | {"TIOCSTI", TIOCSTI}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 890 | #endif |
| 891 | #ifdef TIOCSWINSZ |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 892 | {"TIOCSWINSZ", TIOCSWINSZ}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 893 | #endif |
| 894 | #ifdef TIOCTTYGSTRUCT |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 895 | {"TIOCTTYGSTRUCT", TIOCTTYGSTRUCT}, |
Fred Drake | 55a0034 | 2001-03-26 17:14:02 +0000 | [diff] [blame] | 896 | #endif |
| 897 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 898 | /* sentinel */ |
| 899 | {NULL, 0} |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 900 | }; |
| 901 | |
| 902 | |
Martin v. Löwis | 1a21451 | 2008-06-11 05:26:20 +0000 | [diff] [blame] | 903 | static struct PyModuleDef termiosmodule = { |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 904 | PyModuleDef_HEAD_INIT, |
| 905 | "termios", |
| 906 | termios__doc__, |
| 907 | -1, |
| 908 | termios_methods, |
| 909 | NULL, |
| 910 | NULL, |
| 911 | NULL, |
| 912 | NULL |
Martin v. Löwis | 1a21451 | 2008-06-11 05:26:20 +0000 | [diff] [blame] | 913 | }; |
| 914 | |
Mark Hammond | fe51c6d | 2002-08-02 02:27:13 +0000 | [diff] [blame] | 915 | PyMODINIT_FUNC |
Thomas Wouters | f3f33dc | 2000-07-21 06:00:07 +0000 | [diff] [blame] | 916 | PyInit_termios(void) |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 917 | { |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 918 | PyObject *m; |
| 919 | struct constant *constant = termios_constants; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 920 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 921 | m = PyModule_Create(&termiosmodule); |
| 922 | if (m == NULL) |
| 923 | return NULL; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 924 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 925 | if (TermiosError == NULL) { |
| 926 | TermiosError = PyErr_NewException("termios.error", NULL, NULL); |
| 927 | } |
| 928 | Py_INCREF(TermiosError); |
| 929 | PyModule_AddObject(m, "error", TermiosError); |
Fred Drake | df48d14 | 2001-02-27 21:22:39 +0000 | [diff] [blame] | 930 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 931 | while (constant->name != NULL) { |
| 932 | PyModule_AddIntConstant(m, constant->name, constant->value); |
| 933 | ++constant; |
| 934 | } |
| 935 | return m; |
Guido van Rossum | 9adae8e | 1994-09-12 10:41:22 +0000 | [diff] [blame] | 936 | } |