1994-09-12 10:41:22 +00:00
|
|
|
/* termiosmodule.c -- POSIX terminal I/O module implementation. */
|
|
|
|
|
1999-01-14 19:31:42 +00:00
|
|
|
#include "Python.h"
|
1994-09-12 10:41:22 +00:00
|
|
|
|
|
|
|
#define PyInit_termios inittermios
|
|
|
|
|
|
|
|
#include <termios.h>
|
2001-05-09 17:53:06 +00:00
|
|
|
#ifdef __osf__
|
|
|
|
/* On OSF, sys/ioctl.h requires that struct termio already be defined,
|
|
|
|
* so this needs to be included first on that platform. */
|
2001-05-07 17:55:35 +00:00
|
|
|
#include <termio.h>
|
2001-05-09 17:53:06 +00:00
|
|
|
#endif
|
2001-04-04 21:19:26 +00:00
|
|
|
#include <sys/ioctl.h>
|
2001-05-07 17:55:35 +00:00
|
|
|
|
2001-05-11 16:14:17 +00:00
|
|
|
/* HP-UX requires that this be included to pick up MDCD, MCTS, MDSR,
|
|
|
|
* MDTR, MRI, and MRTS (appearantly used internally by some things
|
|
|
|
* defined as macros; these are not used here directly).
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_SYS_MODEM_H
|
|
|
|
#include <sys/modem.h>
|
|
|
|
#endif
|
|
|
|
|
1998-03-03 22:10:18 +00:00
|
|
|
static char termios__doc__[] = "\
|
|
|
|
This module provides an interface to the Posix calls for tty I/O control.\n\
|
|
|
|
For a complete description of these calls, see the Posix or Unix manual\n\
|
|
|
|
pages. It is only available for those Unix versions that support Posix\n\
|
2001-05-07 17:55:35 +00:00
|
|
|
termios style tty I/O control.\n\
|
1998-03-03 22:10:18 +00:00
|
|
|
\n\
|
|
|
|
All functions in this module take a file descriptor fd as their first\n\
|
2001-05-07 17:55:35 +00:00
|
|
|
argument. This can be an integer file descriptor, such as returned by\n\
|
|
|
|
sys.stdin.fileno(), or a file object, such as sys.stdin itself.";
|
1998-03-03 22:10:18 +00:00
|
|
|
|
2001-05-07 17:55:35 +00:00
|
|
|
static PyObject *TermiosError;
|
1998-08-04 22:53:56 +00:00
|
|
|
|
2001-05-07 17:55:35 +00:00
|
|
|
static int fdconv(PyObject* obj, void* p)
|
|
|
|
{
|
|
|
|
int fd;
|
1994-09-12 10:41:22 +00:00
|
|
|
|
2001-05-07 17:55:35 +00:00
|
|
|
fd = PyObject_AsFileDescriptor(obj);
|
2001-05-09 20:14:09 +00:00
|
|
|
if (fd >= 0) {
|
|
|
|
*(int*)p = fd;
|
|
|
|
return 1;
|
2001-05-07 17:55:35 +00:00
|
|
|
}
|
2001-05-09 20:14:09 +00:00
|
|
|
return 0;
|
2001-05-07 17:55:35 +00:00
|
|
|
}
|
1994-09-12 10:41:22 +00:00
|
|
|
|
1998-03-03 22:10:18 +00:00
|
|
|
static char termios_tcgetattr__doc__[] = "\
|
|
|
|
tcgetattr(fd) -> list_of_attrs\n\
|
2001-05-07 17:55:35 +00:00
|
|
|
\n\
|
1998-03-03 22:10:18 +00:00
|
|
|
Get the tty attributes for file descriptor fd, as follows:\n\
|
|
|
|
[iflag, oflag, cflag, lflag, ispeed, ospeed, cc] where cc is a list\n\
|
|
|
|
of the tty special characters (each a string of length 1, except the items\n\
|
|
|
|
with indices VMIN and VTIME, which are integers when these fields are\n\
|
|
|
|
defined). The interpretation of the flags and the speeds as well as the\n\
|
|
|
|
indexing in the cc array must be done using the symbolic constants defined\n\
|
2001-04-09 19:32:52 +00:00
|
|
|
in this module.";
|
1998-03-03 22:10:18 +00:00
|
|
|
|
1994-09-12 10:41:22 +00:00
|
|
|
static PyObject *
|
2000-07-10 12:15:54 +00:00
|
|
|
termios_tcgetattr(PyObject *self, PyObject *args)
|
1994-09-12 10:41:22 +00:00
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
struct termios mode;
|
|
|
|
PyObject *cc;
|
|
|
|
speed_t ispeed, ospeed;
|
|
|
|
PyObject *v;
|
|
|
|
int i;
|
|
|
|
char ch;
|
|
|
|
|
2001-05-07 17:55:35 +00:00
|
|
|
if (!PyArg_ParseTuple(args, "O&:tcgetattr",
|
|
|
|
fdconv, (void*)&fd))
|
1994-09-12 10:41:22 +00:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (tcgetattr(fd, &mode) == -1)
|
1997-07-17 22:55:06 +00:00
|
|
|
return PyErr_SetFromErrno(TermiosError);
|
1994-09-12 10:41:22 +00:00
|
|
|
|
|
|
|
ispeed = cfgetispeed(&mode);
|
|
|
|
ospeed = cfgetospeed(&mode);
|
|
|
|
|
|
|
|
cc = PyList_New(NCCS);
|
|
|
|
if (cc == NULL)
|
|
|
|
return NULL;
|
|
|
|
for (i = 0; i < NCCS; i++) {
|
|
|
|
ch = (char)mode.c_cc[i];
|
|
|
|
v = PyString_FromStringAndSize(&ch, 1);
|
|
|
|
if (v == NULL)
|
1997-01-10 18:42:18 +00:00
|
|
|
goto err;
|
1994-09-12 10:41:22 +00:00
|
|
|
PyList_SetItem(cc, i, v);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert the MIN and TIME slots to integer. On some systems, the
|
|
|
|
MIN and TIME slots are the same as the EOF and EOL slots. So we
|
|
|
|
only do this in noncanonical input mode. */
|
1996-12-10 15:23:00 +00:00
|
|
|
if ((mode.c_lflag & ICANON) == 0) {
|
1994-09-12 10:41:22 +00:00
|
|
|
v = PyInt_FromLong((long)mode.c_cc[VMIN]);
|
|
|
|
if (v == NULL)
|
1997-01-10 18:42:18 +00:00
|
|
|
goto err;
|
1994-09-12 10:41:22 +00:00
|
|
|
PyList_SetItem(cc, VMIN, v);
|
|
|
|
v = PyInt_FromLong((long)mode.c_cc[VTIME]);
|
|
|
|
if (v == NULL)
|
1997-01-10 18:42:18 +00:00
|
|
|
goto err;
|
1994-09-12 10:41:22 +00:00
|
|
|
PyList_SetItem(cc, VTIME, v);
|
|
|
|
}
|
|
|
|
|
1997-01-10 18:42:18 +00:00
|
|
|
if (!(v = PyList_New(7)))
|
|
|
|
goto err;
|
|
|
|
|
1994-09-12 10:41:22 +00:00
|
|
|
PyList_SetItem(v, 0, PyInt_FromLong((long)mode.c_iflag));
|
|
|
|
PyList_SetItem(v, 1, PyInt_FromLong((long)mode.c_oflag));
|
|
|
|
PyList_SetItem(v, 2, PyInt_FromLong((long)mode.c_cflag));
|
|
|
|
PyList_SetItem(v, 3, PyInt_FromLong((long)mode.c_lflag));
|
|
|
|
PyList_SetItem(v, 4, PyInt_FromLong((long)ispeed));
|
|
|
|
PyList_SetItem(v, 5, PyInt_FromLong((long)ospeed));
|
|
|
|
PyList_SetItem(v, 6, cc);
|
1997-01-10 18:42:18 +00:00
|
|
|
if (PyErr_Occurred()){
|
|
|
|
Py_DECREF(v);
|
|
|
|
goto err;
|
|
|
|
}
|
1994-09-12 10:41:22 +00:00
|
|
|
return v;
|
1997-01-10 18:42:18 +00:00
|
|
|
err:
|
|
|
|
Py_DECREF(cc);
|
|
|
|
return NULL;
|
1994-09-12 10:41:22 +00:00
|
|
|
}
|
|
|
|
|
1998-03-03 22:10:18 +00:00
|
|
|
static char termios_tcsetattr__doc__[] = "\
|
|
|
|
tcsetattr(fd, when, attributes) -> None\n\
|
2001-05-07 17:55:35 +00:00
|
|
|
\n\
|
1998-03-03 22:10:18 +00:00
|
|
|
Set the tty attributes for file descriptor fd.\n\
|
|
|
|
The attributes to be set are taken from the attributes argument, which\n\
|
|
|
|
is a list like the one returned by tcgetattr(). The when argument\n\
|
2001-04-09 19:32:52 +00:00
|
|
|
determines when the attributes are changed: termios.TCSANOW to\n\
|
|
|
|
change immediately, termios.TCSADRAIN to change after transmitting all\n\
|
|
|
|
queued output, or termios.TCSAFLUSH to change after transmitting all\n\
|
1998-03-03 22:10:18 +00:00
|
|
|
queued output and discarding all queued input. ";
|
|
|
|
|
1994-09-12 10:41:22 +00:00
|
|
|
static PyObject *
|
2000-07-10 12:15:54 +00:00
|
|
|
termios_tcsetattr(PyObject *self, PyObject *args)
|
1994-09-12 10:41:22 +00:00
|
|
|
{
|
|
|
|
int fd, when;
|
|
|
|
struct termios mode;
|
|
|
|
speed_t ispeed, ospeed;
|
|
|
|
PyObject *term, *cc, *v;
|
|
|
|
int i;
|
|
|
|
|
2001-05-07 17:55:35 +00:00
|
|
|
if (!PyArg_ParseTuple(args, "O&iO:tcsetattr",
|
|
|
|
fdconv, &fd, &when, &term))
|
1994-09-12 10:41:22 +00:00
|
|
|
return NULL;
|
|
|
|
if (!PyList_Check(term) || PyList_Size(term) != 7) {
|
2001-05-07 17:55:35 +00:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
"tcsetattr, arg 3: must be 7 element list");
|
1994-09-12 10:41:22 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1998-06-12 14:26:18 +00:00
|
|
|
/* Get the old mode, in case there are any hidden fields... */
|
|
|
|
if (tcgetattr(fd, &mode) == -1)
|
|
|
|
return PyErr_SetFromErrno(TermiosError);
|
1994-09-12 10:41:22 +00:00
|
|
|
mode.c_iflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 0));
|
|
|
|
mode.c_oflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 1));
|
|
|
|
mode.c_cflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 2));
|
|
|
|
mode.c_lflag = (tcflag_t) PyInt_AsLong(PyList_GetItem(term, 3));
|
|
|
|
ispeed = (speed_t) PyInt_AsLong(PyList_GetItem(term, 4));
|
|
|
|
ospeed = (speed_t) PyInt_AsLong(PyList_GetItem(term, 5));
|
|
|
|
cc = PyList_GetItem(term, 6);
|
1997-01-10 18:42:18 +00:00
|
|
|
if (PyErr_Occurred())
|
|
|
|
return NULL;
|
1994-09-12 10:41:22 +00:00
|
|
|
|
|
|
|
if (!PyList_Check(cc) || PyList_Size(cc) != NCCS) {
|
2001-05-07 17:55:35 +00:00
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
"tcsetattr: attributes[6] must be %d element list",
|
|
|
|
NCCS);
|
1994-09-12 10:41:22 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < NCCS; i++) {
|
|
|
|
v = PyList_GetItem(cc, i);
|
1997-01-10 18:42:18 +00:00
|
|
|
|
1994-09-12 10:41:22 +00:00
|
|
|
if (PyString_Check(v) && PyString_Size(v) == 1)
|
|
|
|
mode.c_cc[i] = (cc_t) * PyString_AsString(v);
|
|
|
|
else if (PyInt_Check(v))
|
|
|
|
mode.c_cc[i] = (cc_t) PyInt_AsLong(v);
|
|
|
|
else {
|
2001-05-07 17:55:35 +00:00
|
|
|
PyErr_SetString(PyExc_TypeError,
|
|
|
|
"tcsetattr: elements of attributes must be characters or integers");
|
1994-09-12 10:41:22 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cfsetispeed(&mode, (speed_t) ispeed) == -1)
|
1997-07-17 22:55:06 +00:00
|
|
|
return PyErr_SetFromErrno(TermiosError);
|
1994-09-12 10:41:22 +00:00
|
|
|
if (cfsetospeed(&mode, (speed_t) ospeed) == -1)
|
1997-07-17 22:55:06 +00:00
|
|
|
return PyErr_SetFromErrno(TermiosError);
|
1994-09-12 10:41:22 +00:00
|
|
|
if (tcsetattr(fd, when, &mode) == -1)
|
1997-07-17 22:55:06 +00:00
|
|
|
return PyErr_SetFromErrno(TermiosError);
|
1994-09-12 10:41:22 +00:00
|
|
|
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
|
|
|
|
1998-03-03 22:10:18 +00:00
|
|
|
static char termios_tcsendbreak__doc__[] = "\
|
|
|
|
tcsendbreak(fd, duration) -> None\n\
|
2001-05-07 17:55:35 +00:00
|
|
|
\n\
|
1998-03-03 22:10:18 +00:00
|
|
|
Send a break on file descriptor fd.\n\
|
2001-05-07 17:55:35 +00:00
|
|
|
A zero duration sends a break for 0.25-0.5 seconds; a nonzero duration\n\
|
|
|
|
has a system dependent meaning.";
|
1998-03-03 22:10:18 +00:00
|
|
|
|
1994-09-12 10:41:22 +00:00
|
|
|
static PyObject *
|
2000-07-10 12:15:54 +00:00
|
|
|
termios_tcsendbreak(PyObject *self, PyObject *args)
|
1994-09-12 10:41:22 +00:00
|
|
|
{
|
|
|
|
int fd, duration;
|
|
|
|
|
2001-05-07 17:55:35 +00:00
|
|
|
if (!PyArg_ParseTuple(args, "O&i:tcsendbreak",
|
|
|
|
fdconv, &fd, &duration))
|
1994-09-12 10:41:22 +00:00
|
|
|
return NULL;
|
|
|
|
if (tcsendbreak(fd, duration) == -1)
|
1997-07-17 22:55:06 +00:00
|
|
|
return PyErr_SetFromErrno(TermiosError);
|
1994-09-12 10:41:22 +00:00
|
|
|
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
|
|
|
|
1998-03-03 22:10:18 +00:00
|
|
|
static char termios_tcdrain__doc__[] = "\
|
|
|
|
tcdrain(fd) -> None\n\
|
2001-05-07 17:55:35 +00:00
|
|
|
\n\
|
|
|
|
Wait until all output written to file descriptor fd has been transmitted.";
|
1998-03-03 22:10:18 +00:00
|
|
|
|
1994-09-12 10:41:22 +00:00
|
|
|
static PyObject *
|
2000-07-10 12:15:54 +00:00
|
|
|
termios_tcdrain(PyObject *self, PyObject *args)
|
1994-09-12 10:41:22 +00:00
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
|
2001-05-07 17:55:35 +00:00
|
|
|
if (!PyArg_ParseTuple(args, "O&:tcdrain",
|
|
|
|
fdconv, &fd))
|
1994-09-12 10:41:22 +00:00
|
|
|
return NULL;
|
|
|
|
if (tcdrain(fd) == -1)
|
1997-07-17 22:55:06 +00:00
|
|
|
return PyErr_SetFromErrno(TermiosError);
|
1994-09-12 10:41:22 +00:00
|
|
|
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
|
|
|
|
1998-03-03 22:10:18 +00:00
|
|
|
static char termios_tcflush__doc__[] = "\
|
|
|
|
tcflush(fd, queue) -> None\n\
|
2001-05-07 17:55:35 +00:00
|
|
|
\n\
|
1998-03-03 22:10:18 +00:00
|
|
|
Discard queued data on file descriptor fd.\n\
|
2001-04-09 19:32:52 +00:00
|
|
|
The queue selector specifies which queue: termios.TCIFLUSH for the input\n\
|
|
|
|
queue, termios.TCOFLUSH for the output queue, or termios.TCIOFLUSH for\n\
|
1998-03-03 22:10:18 +00:00
|
|
|
both queues. ";
|
|
|
|
|
1994-09-12 10:41:22 +00:00
|
|
|
static PyObject *
|
2000-07-10 12:15:54 +00:00
|
|
|
termios_tcflush(PyObject *self, PyObject *args)
|
1994-09-12 10:41:22 +00:00
|
|
|
{
|
|
|
|
int fd, queue;
|
|
|
|
|
2001-05-07 17:55:35 +00:00
|
|
|
if (!PyArg_ParseTuple(args, "O&i:tcflush",
|
|
|
|
fdconv, &fd, &queue))
|
1994-09-12 10:41:22 +00:00
|
|
|
return NULL;
|
|
|
|
if (tcflush(fd, queue) == -1)
|
1997-07-17 22:55:06 +00:00
|
|
|
return PyErr_SetFromErrno(TermiosError);
|
1994-09-12 10:41:22 +00:00
|
|
|
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
|
|
|
|
1998-03-03 22:10:18 +00:00
|
|
|
static char termios_tcflow__doc__[] = "\
|
|
|
|
tcflow(fd, action) -> None\n\
|
2001-05-07 17:55:35 +00:00
|
|
|
\n\
|
1998-03-03 22:10:18 +00:00
|
|
|
Suspend or resume input or output on file descriptor fd.\n\
|
2001-04-09 19:32:52 +00:00
|
|
|
The action argument can be termios.TCOOFF to suspend output,\n\
|
|
|
|
termios.TCOON to restart output, termios.TCIOFF to suspend input,\n\
|
|
|
|
or termios.TCION to restart input.";
|
1998-03-03 22:10:18 +00:00
|
|
|
|
1994-09-12 10:41:22 +00:00
|
|
|
static PyObject *
|
2000-07-10 12:15:54 +00:00
|
|
|
termios_tcflow(PyObject *self, PyObject *args)
|
1994-09-12 10:41:22 +00:00
|
|
|
{
|
|
|
|
int fd, action;
|
|
|
|
|
2001-05-07 17:55:35 +00:00
|
|
|
if (!PyArg_ParseTuple(args, "O&i:tcflow",
|
|
|
|
fdconv, &fd, &action))
|
1994-09-12 10:41:22 +00:00
|
|
|
return NULL;
|
|
|
|
if (tcflow(fd, action) == -1)
|
1997-07-17 22:55:06 +00:00
|
|
|
return PyErr_SetFromErrno(TermiosError);
|
1994-09-12 10:41:22 +00:00
|
|
|
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyMethodDef termios_methods[] =
|
|
|
|
{
|
2000-08-03 02:34:44 +00:00
|
|
|
{"tcgetattr", termios_tcgetattr,
|
2001-05-07 17:55:35 +00:00
|
|
|
METH_VARARGS, termios_tcgetattr__doc__},
|
2000-08-03 02:34:44 +00:00
|
|
|
{"tcsetattr", termios_tcsetattr,
|
2001-05-07 17:55:35 +00:00
|
|
|
METH_VARARGS, termios_tcsetattr__doc__},
|
2000-08-03 02:34:44 +00:00
|
|
|
{"tcsendbreak", termios_tcsendbreak,
|
2001-05-07 17:55:35 +00:00
|
|
|
METH_VARARGS, termios_tcsendbreak__doc__},
|
2000-08-03 02:34:44 +00:00
|
|
|
{"tcdrain", termios_tcdrain,
|
2001-05-07 17:55:35 +00:00
|
|
|
METH_VARARGS, termios_tcdrain__doc__},
|
2000-08-03 02:34:44 +00:00
|
|
|
{"tcflush", termios_tcflush,
|
2001-05-07 17:55:35 +00:00
|
|
|
METH_VARARGS, termios_tcflush__doc__},
|
2000-08-03 02:34:44 +00:00
|
|
|
{"tcflow", termios_tcflow,
|
2001-05-07 17:55:35 +00:00
|
|
|
METH_VARARGS, termios_tcflow__doc__},
|
1994-09-12 10:41:22 +00:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2001-02-27 21:22:39 +00:00
|
|
|
|
2001-03-01 21:54:49 +00:00
|
|
|
#if defined(VSWTCH) && !defined(VSWTC)
|
|
|
|
#define VSWTC VSWTCH
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(VSWTC) && !defined(VSWTCH)
|
|
|
|
#define VSWTCH VSWTC
|
|
|
|
#endif
|
|
|
|
|
2001-02-27 21:22:39 +00:00
|
|
|
static struct constant {
|
|
|
|
char *name;
|
|
|
|
long value;
|
|
|
|
} termios_constants[] = {
|
|
|
|
/* cfgetospeed(), cfsetospeed() constants */
|
|
|
|
{"B0", B0},
|
|
|
|
{"B50", B50},
|
|
|
|
{"B75", B75},
|
|
|
|
{"B110", B110},
|
|
|
|
{"B134", B134},
|
|
|
|
{"B150", B150},
|
|
|
|
{"B200", B200},
|
|
|
|
{"B300", B300},
|
|
|
|
{"B600", B600},
|
|
|
|
{"B1200", B1200},
|
|
|
|
{"B1800", B1800},
|
|
|
|
{"B2400", B2400},
|
|
|
|
{"B4800", B4800},
|
|
|
|
{"B9600", B9600},
|
|
|
|
{"B19200", B19200},
|
|
|
|
{"B38400", B38400},
|
2001-04-11 20:58:20 +00:00
|
|
|
#ifdef B57600
|
2001-02-27 21:22:39 +00:00
|
|
|
{"B57600", B57600},
|
2001-04-11 20:58:20 +00:00
|
|
|
#endif
|
|
|
|
#ifdef B115200
|
2001-02-27 21:22:39 +00:00
|
|
|
{"B115200", B115200},
|
2001-04-11 20:58:20 +00:00
|
|
|
#endif
|
2001-03-01 03:28:08 +00:00
|
|
|
#ifdef B230400
|
2001-02-27 21:22:39 +00:00
|
|
|
{"B230400", B230400},
|
2001-03-01 03:28:08 +00:00
|
|
|
#endif
|
2001-03-01 21:54:49 +00:00
|
|
|
#ifdef CBAUDEX
|
2001-02-27 21:22:39 +00:00
|
|
|
{"CBAUDEX", CBAUDEX},
|
2001-03-01 21:54:49 +00:00
|
|
|
#endif
|
2001-02-27 21:22:39 +00:00
|
|
|
|
|
|
|
/* tcsetattr() constants */
|
|
|
|
{"TCSANOW", TCSANOW},
|
|
|
|
{"TCSADRAIN", TCSADRAIN},
|
|
|
|
{"TCSAFLUSH", TCSAFLUSH},
|
|
|
|
|
|
|
|
/* tcflush() constants */
|
|
|
|
{"TCIFLUSH", TCIFLUSH},
|
|
|
|
{"TCOFLUSH", TCOFLUSH},
|
|
|
|
{"TCIOFLUSH", TCIOFLUSH},
|
|
|
|
|
|
|
|
/* tcflow() constants */
|
|
|
|
{"TCOOFF", TCOOFF},
|
|
|
|
{"TCOON", TCOON},
|
|
|
|
{"TCIOFF", TCIOFF},
|
|
|
|
{"TCION", TCION},
|
|
|
|
|
|
|
|
/* struct termios.c_iflag constants */
|
|
|
|
{"IGNBRK", IGNBRK},
|
|
|
|
{"BRKINT", BRKINT},
|
|
|
|
{"IGNPAR", IGNPAR},
|
|
|
|
{"PARMRK", PARMRK},
|
|
|
|
{"INPCK", INPCK},
|
|
|
|
{"ISTRIP", ISTRIP},
|
|
|
|
{"INLCR", INLCR},
|
|
|
|
{"IGNCR", IGNCR},
|
|
|
|
{"ICRNL", ICRNL},
|
2001-03-03 18:08:52 +00:00
|
|
|
#ifdef IUCLC
|
2001-02-27 21:22:39 +00:00
|
|
|
{"IUCLC", IUCLC},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
2001-02-27 21:22:39 +00:00
|
|
|
{"IXON", IXON},
|
|
|
|
{"IXANY", IXANY},
|
|
|
|
{"IXOFF", IXOFF},
|
2001-06-15 12:05:44 +00:00
|
|
|
#ifdef IMAXBEL
|
2001-02-27 21:22:39 +00:00
|
|
|
{"IMAXBEL", IMAXBEL},
|
2001-06-15 12:05:44 +00:00
|
|
|
#endif
|
2001-02-27 21:22:39 +00:00
|
|
|
|
|
|
|
/* struct termios.c_oflag constants */
|
|
|
|
{"OPOST", OPOST},
|
2001-03-03 18:08:52 +00:00
|
|
|
#ifdef OLCUC
|
2001-02-27 21:22:39 +00:00
|
|
|
{"OLCUC", OLCUC},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
2002-03-03 02:59:16 +00:00
|
|
|
#ifdef ONLCR
|
2001-02-27 21:22:39 +00:00
|
|
|
{"ONLCR", ONLCR},
|
2002-03-03 02:59:16 +00:00
|
|
|
#endif
|
2001-03-03 18:08:52 +00:00
|
|
|
#ifdef OCRNL
|
2001-02-27 21:22:39 +00:00
|
|
|
{"OCRNL", OCRNL},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ONOCR
|
2001-02-27 21:22:39 +00:00
|
|
|
{"ONOCR", ONOCR},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ONLRET
|
2001-02-27 21:22:39 +00:00
|
|
|
{"ONLRET", ONLRET},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef OFILL
|
2001-02-27 21:22:39 +00:00
|
|
|
{"OFILL", OFILL},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef OFDEL
|
2001-02-27 21:22:39 +00:00
|
|
|
{"OFDEL", OFDEL},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef NLDLY
|
2001-02-27 21:22:39 +00:00
|
|
|
{"NLDLY", NLDLY},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CRDLY
|
2001-02-27 21:22:39 +00:00
|
|
|
{"CRDLY", CRDLY},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef TABDLY
|
2001-02-27 21:22:39 +00:00
|
|
|
{"TABDLY", TABDLY},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef BSDLY
|
2001-02-27 21:22:39 +00:00
|
|
|
{"BSDLY", BSDLY},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef VTDLY
|
2001-02-27 21:22:39 +00:00
|
|
|
{"VTDLY", VTDLY},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef FFDLY
|
2001-02-27 21:22:39 +00:00
|
|
|
{"FFDLY", FFDLY},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
2001-02-27 21:22:39 +00:00
|
|
|
|
|
|
|
/* struct termios.c_oflag-related values (delay mask) */
|
2001-03-03 18:08:52 +00:00
|
|
|
#ifdef NL0
|
2001-02-27 21:22:39 +00:00
|
|
|
{"NL0", NL0},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef NL1
|
2001-02-27 21:22:39 +00:00
|
|
|
{"NL1", NL1},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CR0
|
2001-02-27 21:22:39 +00:00
|
|
|
{"CR0", CR0},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CR1
|
2001-02-27 21:22:39 +00:00
|
|
|
{"CR1", CR1},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CR2
|
2001-02-27 21:22:39 +00:00
|
|
|
{"CR2", CR2},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CR3
|
2001-02-27 21:22:39 +00:00
|
|
|
{"CR3", CR3},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef TAB0
|
2001-02-27 21:22:39 +00:00
|
|
|
{"TAB0", TAB0},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef TAB1
|
2001-02-27 21:22:39 +00:00
|
|
|
{"TAB1", TAB1},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef TAB2
|
2001-02-27 21:22:39 +00:00
|
|
|
{"TAB2", TAB2},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef TAB3
|
2001-02-27 21:22:39 +00:00
|
|
|
{"TAB3", TAB3},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
2001-03-02 06:50:58 +00:00
|
|
|
#ifdef XTABS
|
2001-02-27 21:22:39 +00:00
|
|
|
{"XTABS", XTABS},
|
2001-03-02 06:50:58 +00:00
|
|
|
#endif
|
2001-03-03 18:08:52 +00:00
|
|
|
#ifdef BS0
|
2001-02-27 21:22:39 +00:00
|
|
|
{"BS0", BS0},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef BS1
|
2001-02-27 21:22:39 +00:00
|
|
|
{"BS1", BS1},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef VT0
|
2001-02-27 21:22:39 +00:00
|
|
|
{"VT0", VT0},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef VT1
|
2001-02-27 21:22:39 +00:00
|
|
|
{"VT1", VT1},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef FF0
|
2001-02-27 21:22:39 +00:00
|
|
|
{"FF0", FF0},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
|
|
|
#ifdef FF1
|
2001-02-27 21:22:39 +00:00
|
|
|
{"FF1", FF1},
|
2001-03-03 18:08:52 +00:00
|
|
|
#endif
|
2001-02-27 21:22:39 +00:00
|
|
|
|
|
|
|
/* struct termios.c_cflag constants */
|
|
|
|
{"CSIZE", CSIZE},
|
|
|
|
{"CSTOPB", CSTOPB},
|
|
|
|
{"CREAD", CREAD},
|
|
|
|
{"PARENB", PARENB},
|
|
|
|
{"PARODD", PARODD},
|
|
|
|
{"HUPCL", HUPCL},
|
|
|
|
{"CLOCAL", CLOCAL},
|
2001-03-01 03:28:08 +00:00
|
|
|
#ifdef CIBAUD
|
2001-02-27 21:22:39 +00:00
|
|
|
{"CIBAUD", CIBAUD},
|
2001-03-01 03:28:08 +00:00
|
|
|
#endif
|
2001-03-02 06:50:58 +00:00
|
|
|
#ifdef CRTSCTS
|
|
|
|
{"CRTSCTS", (long)CRTSCTS},
|
|
|
|
#endif
|
2001-02-27 21:22:39 +00:00
|
|
|
|
|
|
|
/* struct termios.c_cflag-related values (character size) */
|
|
|
|
{"CS5", CS5},
|
|
|
|
{"CS6", CS6},
|
|
|
|
{"CS7", CS7},
|
|
|
|
{"CS8", CS8},
|
|
|
|
|
|
|
|
/* struct termios.c_lflag constants */
|
|
|
|
{"ISIG", ISIG},
|
|
|
|
{"ICANON", ICANON},
|
2001-03-01 03:28:08 +00:00
|
|
|
#ifdef XCASE
|
2001-02-27 21:22:39 +00:00
|
|
|
{"XCASE", XCASE},
|
2001-03-01 03:28:08 +00:00
|
|
|
#endif
|
2001-02-27 21:22:39 +00:00
|
|
|
{"ECHO", ECHO},
|
|
|
|
{"ECHOE", ECHOE},
|
|
|
|
{"ECHOK", ECHOK},
|
|
|
|
{"ECHONL", ECHONL},
|
2001-06-15 12:05:44 +00:00
|
|
|
#ifdef ECHOCTL
|
2001-02-27 21:22:39 +00:00
|
|
|
{"ECHOCTL", ECHOCTL},
|
2001-06-15 12:05:44 +00:00
|
|
|
#endif
|
2001-03-01 03:28:08 +00:00
|
|
|
#ifdef ECHOPRT
|
2001-02-27 21:22:39 +00:00
|
|
|
{"ECHOPRT", ECHOPRT},
|
2001-03-01 03:28:08 +00:00
|
|
|
#endif
|
2001-06-15 12:05:44 +00:00
|
|
|
#ifdef ECHOKE
|
2001-02-27 21:22:39 +00:00
|
|
|
{"ECHOKE", ECHOKE},
|
2001-06-15 12:05:44 +00:00
|
|
|
#endif
|
|
|
|
#ifdef FLUSHO
|
2001-02-27 21:22:39 +00:00
|
|
|
{"FLUSHO", FLUSHO},
|
2001-06-15 12:05:44 +00:00
|
|
|
#endif
|
2001-02-27 21:22:39 +00:00
|
|
|
{"NOFLSH", NOFLSH},
|
|
|
|
{"TOSTOP", TOSTOP},
|
2001-03-01 03:28:08 +00:00
|
|
|
#ifdef PENDIN
|
2001-02-27 21:22:39 +00:00
|
|
|
{"PENDIN", PENDIN},
|
2001-03-01 03:28:08 +00:00
|
|
|
#endif
|
2001-02-27 21:22:39 +00:00
|
|
|
{"IEXTEN", IEXTEN},
|
|
|
|
|
|
|
|
/* indexes into the control chars array returned by tcgetattr() */
|
|
|
|
{"VINTR", VINTR},
|
|
|
|
{"VQUIT", VQUIT},
|
|
|
|
{"VERASE", VERASE},
|
|
|
|
{"VKILL", VKILL},
|
|
|
|
{"VEOF", VEOF},
|
|
|
|
{"VTIME", VTIME},
|
|
|
|
{"VMIN", VMIN},
|
2001-03-02 06:50:58 +00:00
|
|
|
#ifdef VSWTC
|
|
|
|
/* The #defines above ensure that if either is defined, both are,
|
|
|
|
* but both may be omitted by the system headers. ;-( */
|
2001-02-27 21:22:39 +00:00
|
|
|
{"VSWTC", VSWTC},
|
2001-03-01 21:54:49 +00:00
|
|
|
{"VSWTCH", VSWTCH},
|
2001-03-02 06:50:58 +00:00
|
|
|
#endif
|
2001-02-27 21:22:39 +00:00
|
|
|
{"VSTART", VSTART},
|
|
|
|
{"VSTOP", VSTOP},
|
|
|
|
{"VSUSP", VSUSP},
|
|
|
|
{"VEOL", VEOL},
|
2001-05-22 15:44:15 +00:00
|
|
|
#ifdef VREPRINT
|
2001-02-27 21:22:39 +00:00
|
|
|
{"VREPRINT", VREPRINT},
|
2001-05-11 16:14:17 +00:00
|
|
|
#endif
|
2001-05-22 15:44:15 +00:00
|
|
|
#ifdef VDISCARD
|
2001-02-27 21:22:39 +00:00
|
|
|
{"VDISCARD", VDISCARD},
|
2001-05-11 16:14:17 +00:00
|
|
|
#endif
|
2001-06-11 15:25:16 +00:00
|
|
|
#ifdef VWERASE
|
2001-02-27 21:22:39 +00:00
|
|
|
{"VWERASE", VWERASE},
|
2001-06-11 15:25:16 +00:00
|
|
|
#endif
|
2001-06-15 12:05:44 +00:00
|
|
|
#ifdef VLNEXT
|
2001-02-27 21:22:39 +00:00
|
|
|
{"VLNEXT", VLNEXT},
|
2001-06-15 12:05:44 +00:00
|
|
|
#endif
|
2002-03-03 02:59:16 +00:00
|
|
|
#ifdef VEOL2
|
2001-02-27 21:22:39 +00:00
|
|
|
{"VEOL2", VEOL2},
|
2002-03-03 02:59:16 +00:00
|
|
|
#endif
|
2001-02-27 21:22:39 +00:00
|
|
|
|
2001-03-26 17:14:02 +00:00
|
|
|
|
|
|
|
#ifdef B460800
|
|
|
|
{"B460800", B460800},
|
|
|
|
#endif
|
|
|
|
#ifdef CBAUD
|
|
|
|
{"CBAUD", CBAUD},
|
|
|
|
#endif
|
|
|
|
#ifdef CDEL
|
|
|
|
{"CDEL", CDEL},
|
|
|
|
#endif
|
|
|
|
#ifdef CDSUSP
|
|
|
|
{"CDSUSP", CDSUSP},
|
|
|
|
#endif
|
|
|
|
#ifdef CEOF
|
|
|
|
{"CEOF", CEOF},
|
|
|
|
#endif
|
|
|
|
#ifdef CEOL
|
|
|
|
{"CEOL", CEOL},
|
|
|
|
#endif
|
|
|
|
#ifdef CEOL2
|
|
|
|
{"CEOL2", CEOL2},
|
|
|
|
#endif
|
|
|
|
#ifdef CEOT
|
|
|
|
{"CEOT", CEOT},
|
|
|
|
#endif
|
|
|
|
#ifdef CERASE
|
|
|
|
{"CERASE", CERASE},
|
|
|
|
#endif
|
|
|
|
#ifdef CESC
|
|
|
|
{"CESC", CESC},
|
|
|
|
#endif
|
|
|
|
#ifdef CFLUSH
|
|
|
|
{"CFLUSH", CFLUSH},
|
|
|
|
#endif
|
|
|
|
#ifdef CINTR
|
|
|
|
{"CINTR", CINTR},
|
|
|
|
#endif
|
|
|
|
#ifdef CKILL
|
|
|
|
{"CKILL", CKILL},
|
|
|
|
#endif
|
|
|
|
#ifdef CLNEXT
|
|
|
|
{"CLNEXT", CLNEXT},
|
|
|
|
#endif
|
|
|
|
#ifdef CNUL
|
|
|
|
{"CNUL", CNUL},
|
|
|
|
#endif
|
|
|
|
#ifdef COMMON
|
|
|
|
{"COMMON", COMMON},
|
|
|
|
#endif
|
|
|
|
#ifdef CQUIT
|
|
|
|
{"CQUIT", CQUIT},
|
|
|
|
#endif
|
|
|
|
#ifdef CRPRNT
|
|
|
|
{"CRPRNT", CRPRNT},
|
|
|
|
#endif
|
|
|
|
#ifdef CSTART
|
|
|
|
{"CSTART", CSTART},
|
|
|
|
#endif
|
|
|
|
#ifdef CSTOP
|
|
|
|
{"CSTOP", CSTOP},
|
|
|
|
#endif
|
|
|
|
#ifdef CSUSP
|
|
|
|
{"CSUSP", CSUSP},
|
|
|
|
#endif
|
|
|
|
#ifdef CSWTCH
|
|
|
|
{"CSWTCH", CSWTCH},
|
|
|
|
#endif
|
|
|
|
#ifdef CWERASE
|
|
|
|
{"CWERASE", CWERASE},
|
|
|
|
#endif
|
|
|
|
#ifdef EXTA
|
|
|
|
{"EXTA", EXTA},
|
|
|
|
#endif
|
|
|
|
#ifdef EXTB
|
|
|
|
{"EXTB", EXTB},
|
|
|
|
#endif
|
|
|
|
#ifdef FIOASYNC
|
|
|
|
{"FIOASYNC", FIOASYNC},
|
|
|
|
#endif
|
|
|
|
#ifdef FIOCLEX
|
|
|
|
{"FIOCLEX", FIOCLEX},
|
|
|
|
#endif
|
|
|
|
#ifdef FIONBIO
|
|
|
|
{"FIONBIO", FIONBIO},
|
|
|
|
#endif
|
|
|
|
#ifdef FIONCLEX
|
|
|
|
{"FIONCLEX", FIONCLEX},
|
|
|
|
#endif
|
|
|
|
#ifdef FIONREAD
|
|
|
|
{"FIONREAD", FIONREAD},
|
|
|
|
#endif
|
|
|
|
#ifdef IBSHIFT
|
|
|
|
{"IBSHIFT", IBSHIFT},
|
|
|
|
#endif
|
|
|
|
#ifdef INIT_C_CC
|
|
|
|
{"INIT_C_CC", INIT_C_CC},
|
|
|
|
#endif
|
|
|
|
#ifdef IOCSIZE_MASK
|
|
|
|
{"IOCSIZE_MASK", IOCSIZE_MASK},
|
|
|
|
#endif
|
|
|
|
#ifdef IOCSIZE_SHIFT
|
|
|
|
{"IOCSIZE_SHIFT", IOCSIZE_SHIFT},
|
|
|
|
#endif
|
|
|
|
#ifdef NCC
|
|
|
|
{"NCC", NCC},
|
|
|
|
#endif
|
|
|
|
#ifdef NCCS
|
|
|
|
{"NCCS", NCCS},
|
|
|
|
#endif
|
|
|
|
#ifdef NSWTCH
|
|
|
|
{"NSWTCH", NSWTCH},
|
|
|
|
#endif
|
|
|
|
#ifdef N_MOUSE
|
|
|
|
{"N_MOUSE", N_MOUSE},
|
|
|
|
#endif
|
|
|
|
#ifdef N_PPP
|
|
|
|
{"N_PPP", N_PPP},
|
|
|
|
#endif
|
|
|
|
#ifdef N_SLIP
|
|
|
|
{"N_SLIP", N_SLIP},
|
|
|
|
#endif
|
|
|
|
#ifdef N_STRIP
|
|
|
|
{"N_STRIP", N_STRIP},
|
|
|
|
#endif
|
|
|
|
#ifdef N_TTY
|
|
|
|
{"N_TTY", N_TTY},
|
|
|
|
#endif
|
|
|
|
#ifdef TCFLSH
|
|
|
|
{"TCFLSH", TCFLSH},
|
|
|
|
#endif
|
|
|
|
#ifdef TCGETA
|
|
|
|
{"TCGETA", TCGETA},
|
|
|
|
#endif
|
|
|
|
#ifdef TCGETS
|
|
|
|
{"TCGETS", TCGETS},
|
|
|
|
#endif
|
|
|
|
#ifdef TCSBRK
|
|
|
|
{"TCSBRK", TCSBRK},
|
|
|
|
#endif
|
|
|
|
#ifdef TCSBRKP
|
|
|
|
{"TCSBRKP", TCSBRKP},
|
|
|
|
#endif
|
|
|
|
#ifdef TCSETA
|
|
|
|
{"TCSETA", TCSETA},
|
|
|
|
#endif
|
|
|
|
#ifdef TCSETAF
|
|
|
|
{"TCSETAF", TCSETAF},
|
|
|
|
#endif
|
|
|
|
#ifdef TCSETAW
|
|
|
|
{"TCSETAW", TCSETAW},
|
|
|
|
#endif
|
|
|
|
#ifdef TCSETS
|
|
|
|
{"TCSETS", TCSETS},
|
|
|
|
#endif
|
|
|
|
#ifdef TCSETSF
|
|
|
|
{"TCSETSF", TCSETSF},
|
|
|
|
#endif
|
|
|
|
#ifdef TCSETSW
|
|
|
|
{"TCSETSW", TCSETSW},
|
|
|
|
#endif
|
|
|
|
#ifdef TCXONC
|
|
|
|
{"TCXONC", TCXONC},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCCONS
|
|
|
|
{"TIOCCONS", TIOCCONS},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCEXCL
|
|
|
|
{"TIOCEXCL", TIOCEXCL},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCGETD
|
|
|
|
{"TIOCGETD", TIOCGETD},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCGICOUNT
|
|
|
|
{"TIOCGICOUNT", TIOCGICOUNT},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCGLCKTRMIOS
|
|
|
|
{"TIOCGLCKTRMIOS", TIOCGLCKTRMIOS},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCGPGRP
|
|
|
|
{"TIOCGPGRP", TIOCGPGRP},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCGSERIAL
|
|
|
|
{"TIOCGSERIAL", TIOCGSERIAL},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCGSOFTCAR
|
|
|
|
{"TIOCGSOFTCAR", TIOCGSOFTCAR},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCGWINSZ
|
|
|
|
{"TIOCGWINSZ", TIOCGWINSZ},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCINQ
|
|
|
|
{"TIOCINQ", TIOCINQ},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCLINUX
|
|
|
|
{"TIOCLINUX", TIOCLINUX},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCMBIC
|
|
|
|
{"TIOCMBIC", TIOCMBIC},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCMBIS
|
|
|
|
{"TIOCMBIS", TIOCMBIS},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCMGET
|
|
|
|
{"TIOCMGET", TIOCMGET},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCMIWAIT
|
|
|
|
{"TIOCMIWAIT", TIOCMIWAIT},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCMSET
|
|
|
|
{"TIOCMSET", TIOCMSET},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCM_CAR
|
|
|
|
{"TIOCM_CAR", TIOCM_CAR},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCM_CD
|
|
|
|
{"TIOCM_CD", TIOCM_CD},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCM_CTS
|
|
|
|
{"TIOCM_CTS", TIOCM_CTS},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCM_DSR
|
|
|
|
{"TIOCM_DSR", TIOCM_DSR},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCM_DTR
|
|
|
|
{"TIOCM_DTR", TIOCM_DTR},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCM_LE
|
|
|
|
{"TIOCM_LE", TIOCM_LE},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCM_RI
|
|
|
|
{"TIOCM_RI", TIOCM_RI},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCM_RNG
|
|
|
|
{"TIOCM_RNG", TIOCM_RNG},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCM_RTS
|
|
|
|
{"TIOCM_RTS", TIOCM_RTS},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCM_SR
|
|
|
|
{"TIOCM_SR", TIOCM_SR},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCM_ST
|
|
|
|
{"TIOCM_ST", TIOCM_ST},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCNOTTY
|
|
|
|
{"TIOCNOTTY", TIOCNOTTY},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCNXCL
|
|
|
|
{"TIOCNXCL", TIOCNXCL},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCOUTQ
|
|
|
|
{"TIOCOUTQ", TIOCOUTQ},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCPKT
|
|
|
|
{"TIOCPKT", TIOCPKT},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCPKT_DATA
|
|
|
|
{"TIOCPKT_DATA", TIOCPKT_DATA},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCPKT_DOSTOP
|
|
|
|
{"TIOCPKT_DOSTOP", TIOCPKT_DOSTOP},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCPKT_FLUSHREAD
|
|
|
|
{"TIOCPKT_FLUSHREAD", TIOCPKT_FLUSHREAD},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCPKT_FLUSHWRITE
|
|
|
|
{"TIOCPKT_FLUSHWRITE", TIOCPKT_FLUSHWRITE},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCPKT_NOSTOP
|
|
|
|
{"TIOCPKT_NOSTOP", TIOCPKT_NOSTOP},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCPKT_START
|
|
|
|
{"TIOCPKT_START", TIOCPKT_START},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCPKT_STOP
|
|
|
|
{"TIOCPKT_STOP", TIOCPKT_STOP},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSCTTY
|
|
|
|
{"TIOCSCTTY", TIOCSCTTY},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSERCONFIG
|
|
|
|
{"TIOCSERCONFIG", TIOCSERCONFIG},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSERGETLSR
|
|
|
|
{"TIOCSERGETLSR", TIOCSERGETLSR},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSERGETMULTI
|
|
|
|
{"TIOCSERGETMULTI", TIOCSERGETMULTI},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSERGSTRUCT
|
|
|
|
{"TIOCSERGSTRUCT", TIOCSERGSTRUCT},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSERGWILD
|
|
|
|
{"TIOCSERGWILD", TIOCSERGWILD},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSERSETMULTI
|
|
|
|
{"TIOCSERSETMULTI", TIOCSERSETMULTI},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSERSWILD
|
|
|
|
{"TIOCSERSWILD", TIOCSERSWILD},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSER_TEMT
|
|
|
|
{"TIOCSER_TEMT", TIOCSER_TEMT},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSETD
|
|
|
|
{"TIOCSETD", TIOCSETD},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSLCKTRMIOS
|
|
|
|
{"TIOCSLCKTRMIOS", TIOCSLCKTRMIOS},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSPGRP
|
|
|
|
{"TIOCSPGRP", TIOCSPGRP},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSSERIAL
|
|
|
|
{"TIOCSSERIAL", TIOCSSERIAL},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSSOFTCAR
|
|
|
|
{"TIOCSSOFTCAR", TIOCSSOFTCAR},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSTI
|
|
|
|
{"TIOCSTI", TIOCSTI},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCSWINSZ
|
|
|
|
{"TIOCSWINSZ", TIOCSWINSZ},
|
|
|
|
#endif
|
|
|
|
#ifdef TIOCTTYGSTRUCT
|
|
|
|
{"TIOCTTYGSTRUCT", TIOCTTYGSTRUCT},
|
|
|
|
#endif
|
|
|
|
|
2001-02-27 21:22:39 +00:00
|
|
|
/* sentinel */
|
|
|
|
{NULL, 0}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
1998-12-04 18:50:17 +00:00
|
|
|
DL_EXPORT(void)
|
2000-07-21 06:00:07 +00:00
|
|
|
PyInit_termios(void)
|
1994-09-12 10:41:22 +00:00
|
|
|
{
|
2002-02-14 07:11:23 +00:00
|
|
|
PyObject *m;
|
2001-02-27 21:22:39 +00:00
|
|
|
struct constant *constant = termios_constants;
|
1994-09-12 10:41:22 +00:00
|
|
|
|
1998-03-03 22:10:18 +00:00
|
|
|
m = Py_InitModule4("termios", termios_methods, termios__doc__,
|
|
|
|
(PyObject *)NULL, PYTHON_API_VERSION);
|
1994-09-12 10:41:22 +00:00
|
|
|
|
2002-02-14 07:11:23 +00:00
|
|
|
if (TermiosError == NULL) {
|
|
|
|
TermiosError = PyErr_NewException("termios.error", NULL, NULL);
|
|
|
|
}
|
|
|
|
Py_INCREF(TermiosError);
|
|
|
|
PyModule_AddObject(m, "error", TermiosError);
|
2001-02-27 21:22:39 +00:00
|
|
|
|
|
|
|
while (constant->name != NULL) {
|
|
|
|
PyModule_AddIntConstant(m, constant->name, constant->value);
|
|
|
|
++constant;
|
|
|
|
}
|
1994-09-12 10:41:22 +00:00
|
|
|
}
|