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