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