1 /* termios.cc provide access to the terminal.
3 Copyright (C) 2010-2022 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. */
30 #define EXPORT(FUNC) m2pim ## _termios_ ## FUNC
31 #define M2EXPORT(FUNC) m2pim ## _M2_termios_ ## FUNC
32 #define M2LIBNAME "m2pim"
34 #if defined(HAVE_STDIO_H)
37 #if defined(HAVE_STDARG_H)
40 #if defined(HAVE_STDLIB_H)
43 #if defined(HAVE_STRING_H)
46 #if defined(HAVE_STRINGS_H)
50 #ifdef TERMIOS_NEEDS_XOPEN_SOURCE
54 #if defined(HAVE_SYS_TYPES_H)
55 #include <sys/types.h>
58 #if defined(HAVE_TERMIOS_H)
62 void _M2_termios_init (void);
63 void _M2_termios_finish (void);
65 #if defined(HAVE_TERMIOS_H)
88 /* Input flag bits. */
103 /* Output flag bits. */
162 /* Character size. */
192 extern "C" void *EXPORT (InitTermios
) (void);
193 extern "C" void *EXPORT (KillTermios
) (struct termios
*p
);
194 extern "C" int EXPORT (cfgetospeed
) (struct termios
*t
);
195 extern "C" int EXPORT (cfgetispeed
) (struct termios
*t
);
196 extern "C" int EXPORT (cfsetospeed
) (struct termios
*t
, unsigned int b
);
197 extern "C" int EXPORT (cfsetispeed
) (struct termios
*t
, unsigned int b
);
198 extern "C" int EXPORT (cfsetspeed
) (struct termios
*t
, unsigned int b
);
199 extern "C" int EXPORT (tcgetattr
) (int fd
, struct termios
*t
);
200 extern "C" int EXPORT (tcsetattr
) (int fd
, int option
, struct termios
*t
);
201 extern "C" void EXPORT (cfmakeraw
) (struct termios
*t
);
202 extern "C" int EXPORT (tcsendbreak
) (int fd
, int duration
);
203 extern "C" int EXPORT (tcdrain
) (int fd
);
204 extern "C" int EXPORT (tcflushi
) (int fd
);
205 extern "C" int EXPORT (tcflusho
) (int fd
);
206 extern "C" int EXPORT (tcflushio
) (int fd
);
207 extern "C" int EXPORT (tcflowoni
) (int fd
);
208 extern "C" int EXPORT (tcflowoffi
) (int fd
);
209 extern "C" int EXPORT (tcflowono
) (int fd
);
210 extern "C" int EXPORT (tcflowoffo
) (int fd
);
211 extern "C" bool EXPORT (GetFlag
) (struct termios
*t
, Flag f
, bool *b
);
212 extern "C" bool EXPORT (SetFlag
) (struct termios
*t
, Flag f
, bool b
);
213 extern "C" bool EXPORT (GetChar
) (struct termios
*t
, ControlChar c
, char *ch
);
214 extern "C" bool EXPORT (SetChar
) (struct termios
*t
, ControlChar c
, char ch
);
215 extern "C" int EXPORT (tcsnow
) (void);
216 extern "C" int EXPORT (tcsflush
) (void);
217 extern "C" int EXPORT (tcsdrain
) (void);
218 extern "C" bool doSetUnset (tcflag_t
*bitset
, unsigned int mask
, bool value
);
220 /* InitTermios new data structure. */
223 *EXPORT (InitTermios
) (void)
225 struct termios
*p
= (struct termios
*)malloc (sizeof (struct termios
));
227 memset (p
, 0, sizeof (struct termios
));
231 /* KillTermios delete data structure. */
234 EXPORT (KillTermios
) (struct termios
*p
)
240 /* tcsnow return the value of TCSANOW. */
243 EXPORT (tcsnow
) (void) { return TCSANOW
; }
245 /* tcsdrain return the value of TCSADRAIN. */
248 EXPORT (tcsdrain
) (void) { return TCSADRAIN
; }
250 /* tcsflush return the value of TCSAFLUSH. */
253 EXPORT (tcsflush
) (void) { return TCSAFLUSH
; }
255 /* cfgetospeed return output baud rate. */
258 EXPORT (cfgetospeed
) (struct termios
*t
) { return cfgetospeed (t
); }
260 /* cfgetispeed return input baud rate. */
263 EXPORT (cfgetispeed
) (struct termios
*t
) { return cfgetispeed (t
); }
265 /* cfsetospeed set output baud rate. */
268 EXPORT (cfsetospeed
) (struct termios
*t
, unsigned int b
)
270 return cfsetospeed (t
, b
);
273 /* cfsetispeed set input baud rate. */
276 EXPORT (cfsetispeed
) (struct termios
*t
, unsigned int b
)
278 return cfsetispeed (t
, b
);
281 /* cfsetspeed set input and output baud rate. */
284 EXPORT (cfsetspeed
) (struct termios
*t
, unsigned int b
)
286 int val
= cfsetispeed (t
, b
);
288 return cfsetospeed (t
, b
);
293 /* tcgetattr get state of, fd, into, t. */
296 EXPORT (tcgetattr
) (int fd
, struct termios
*t
)
298 return tcgetattr (fd
, t
);
301 /* tcsetattr set state of, fd, to, t, using option. */
303 int EXPORT (tcsetattr
) (int fd
, int option
, struct termios
*t
)
305 return tcsetattr (fd
, option
, t
);
308 /* cfmakeraw sets the terminal to raw mode. */
311 EXPORT (cfmakeraw
) (struct termios
*t
)
313 #if defined(HAVE_CFMAKERAW)
314 return cfmakeraw (t
);
318 /* tcsendbreak send zero bits for duration. */
321 EXPORT (tcsendbreak
) (int fd
, int duration
)
323 return tcsendbreak (fd
, duration
);
326 /* tcdrain waits for pending output to be written on, fd. */
329 EXPORT (tcdrain
) (int fd
) { return tcdrain (fd
); }
331 /* tcflushi flush input. */
334 EXPORT (tcflushi
) (int fd
)
336 #if defined(TCIFLUSH)
337 return tcflush (fd
, TCIFLUSH
);
343 /* tcflusho flush output. */
346 EXPORT (tcflusho
) (int fd
)
348 #if defined(TCOFLUSH)
349 return tcflush (fd
, TCOFLUSH
);
355 /* tcflushio flush input and output. */
358 EXPORT (tcflushio
) (int fd
)
360 #if defined(TCIOFLUSH)
361 return tcflush (fd
, TCIOFLUSH
);
367 /* tcflowoni restart input on, fd. */
370 EXPORT (tcflowoni
) (int fd
)
373 return tcflow (fd
, TCION
);
379 /* tcflowoffi stop input on, fd. */
382 EXPORT (tcflowoffi
) (int fd
)
385 return tcflow (fd
, TCIOFF
);
391 /* tcflowono restart output on, fd. */
394 EXPORT (tcflowono
) (int fd
)
397 return tcflow (fd
, TCOON
);
403 /* tcflowoffo stop output on, fd. */
406 EXPORT (tcflowoffo
) (int fd
)
409 return tcflow (fd
, TCOOFF
);
415 /* doSetUnset applies mask or undoes mask depending upon value and returns true. */
418 doSetUnset (tcflag_t
*bitset
, unsigned int mask
, bool value
)
423 (*bitset
) &= (~mask
);
427 /* GetFlag sets a flag value from t in b and returns true if t supports f. */
430 EXPORT (GetFlag
) (struct termios
*t
, Flag f
, bool *b
)
437 *b
= ((t
->c_iflag
& IGNBRK
) == IGNBRK
);
444 *b
= ((t
->c_iflag
& BRKINT
) == BRKINT
);
451 *b
= ((t
->c_iflag
& IGNPAR
) == IGNPAR
);
458 *b
= ((t
->c_iflag
& PARMRK
) == PARMRK
);
465 *b
= ((t
->c_iflag
& INPCK
) == INPCK
);
472 *b
= ((t
->c_iflag
& ISTRIP
) == ISTRIP
);
479 *b
= ((t
->c_iflag
& INLCR
) == INLCR
);
486 *b
= ((t
->c_iflag
& IGNCR
) == IGNCR
);
493 *b
= ((t
->c_iflag
& ICRNL
) == ICRNL
);
500 *b
= ((t
->c_iflag
& IUCLC
) == IUCLC
);
507 *b
= ((t
->c_iflag
& IXON
) == IXON
);
514 *b
= ((t
->c_iflag
& IXANY
) == IXANY
);
521 *b
= ((t
->c_iflag
& IXOFF
) == IXOFF
);
528 *b
= ((t
->c_iflag
& IMAXBEL
) == IMAXBEL
);
535 *b
= ((t
->c_oflag
& OPOST
) == OPOST
);
542 *b
= ((t
->c_oflag
& OLCUC
) == OLCUC
);
549 *b
= ((t
->c_oflag
& ONLCR
) == ONLCR
);
556 *b
= ((t
->c_oflag
& OCRNL
) == OCRNL
);
563 *b
= ((t
->c_oflag
& ONOCR
) == ONOCR
);
570 *b
= ((t
->c_oflag
& ONLRET
) == ONLRET
);
577 *b
= ((t
->c_oflag
& OFILL
) == OFILL
);
584 *b
= ((t
->c_oflag
& OFDEL
) == OFDEL
);
591 *b
= ((t
->c_oflag
& NL0
) == NL0
);
598 *b
= ((t
->c_oflag
& NL1
) == NL1
);
605 *b
= ((t
->c_oflag
& CR0
) == CR0
);
612 *b
= ((t
->c_oflag
& CR1
) == CR1
);
619 *b
= ((t
->c_oflag
& CR2
) == CR2
);
626 *b
= ((t
->c_oflag
& CR3
) == CR3
);
633 *b
= ((t
->c_oflag
& TAB0
) == TAB0
);
640 *b
= ((t
->c_oflag
& TAB1
) == TAB1
);
647 *b
= ((t
->c_oflag
& TAB2
) == TAB2
);
654 *b
= ((t
->c_oflag
& TAB3
) == TAB3
);
661 *b
= ((t
->c_oflag
& BS0
) == BS0
);
668 *b
= ((t
->c_oflag
& BS1
) == BS1
);
675 *b
= ((t
->c_oflag
& FF0
) == FF0
);
682 *b
= ((t
->c_oflag
& FF1
) == FF1
);
689 *b
= ((t
->c_oflag
& VT0
) == VT0
);
696 *b
= ((t
->c_oflag
& VT1
) == VT1
);
703 *b
= ((t
->c_cflag
& B0
) == B0
);
710 *b
= ((t
->c_cflag
& B50
) == B50
);
717 *b
= ((t
->c_cflag
& B75
) == B75
);
724 *b
= ((t
->c_cflag
& B110
) == B110
);
731 *b
= ((t
->c_cflag
& B134
) == B134
);
738 *b
= ((t
->c_cflag
& B150
) == B150
);
745 *b
= ((t
->c_cflag
& B200
) == B200
);
752 *b
= ((t
->c_cflag
& B300
) == B300
);
759 *b
= ((t
->c_cflag
& B600
) == B600
);
766 *b
= ((t
->c_cflag
& B1200
) == B1200
);
773 *b
= ((t
->c_cflag
& B1800
) == B1800
);
780 *b
= ((t
->c_cflag
& B2400
) == B2400
);
787 *b
= ((t
->c_cflag
& B4800
) == B4800
);
794 *b
= ((t
->c_cflag
& B9600
) == B9600
);
801 *b
= ((t
->c_cflag
& B19200
) == B19200
);
808 *b
= ((t
->c_cflag
& B38400
) == B38400
);
815 *b
= ((t
->c_cflag
& B57600
) == B57600
);
822 *b
= ((t
->c_cflag
& B115200
) == B115200
);
829 *b
= ((t
->c_cflag
& B230400
) == B230400
);
836 *b
= ((t
->c_cflag
& B460800
) == B460800
);
843 *b
= ((t
->c_cflag
& B500000
) == B500000
);
850 *b
= ((t
->c_cflag
& B576000
) == B576000
);
857 *b
= ((t
->c_cflag
& B921600
) == B921600
);
863 #if defined(B1000000)
864 *b
= ((t
->c_cflag
& B1000000
) == B1000000
);
870 #if defined(B1152000)
871 *b
= ((t
->c_cflag
& B1152000
) == B1152000
);
877 #if defined(B1500000)
878 *b
= ((t
->c_cflag
& B1500000
) == B1500000
);
884 #if defined(B2000000)
885 *b
= ((t
->c_cflag
& B2000000
) == B2000000
);
891 #if defined(B2500000)
892 *b
= ((t
->c_cflag
& B2500000
) == B2500000
);
898 #if defined(B3000000)
899 *b
= ((t
->c_cflag
& B3000000
) == B3000000
);
905 #if defined(B3500000)
906 *b
= ((t
->c_cflag
& B3500000
) == B3500000
);
912 #if defined(B4000000)
913 *b
= ((t
->c_cflag
& B4000000
) == B4000000
);
920 *b
= ((t
->c_cflag
& __MAX_BAUD
) == __MAX_BAUD
);
927 *b
= ((t
->c_cflag
& CRTSCTS
) == CRTSCTS
);
934 *b
= ((t
->c_cflag
& CS5
) == CS5
);
941 *b
= ((t
->c_cflag
& CS6
) == CS6
);
948 *b
= ((t
->c_cflag
& CS7
) == CS7
);
955 *b
= ((t
->c_cflag
& CS8
) == CS8
);
962 *b
= ((t
->c_cflag
& CSTOPB
) == CSTOPB
);
969 *b
= ((t
->c_cflag
& CREAD
) == CREAD
);
976 *b
= ((t
->c_cflag
& PARENB
) == PARENB
);
983 *b
= ((t
->c_cflag
& PARODD
) == PARODD
);
990 *b
= ((t
->c_cflag
& HUPCL
) == HUPCL
);
997 *b
= ((t
->c_cflag
& CLOCAL
) == CLOCAL
);
1004 *b
= ((t
->c_lflag
& ISIG
) == ISIG
);
1011 *b
= ((t
->c_lflag
& ICANON
) == ICANON
);
1018 *b
= ((t
->c_lflag
& XCASE
) == XCASE
);
1025 *b
= ((t
->c_lflag
& ECHO
) == ECHO
);
1032 *b
= ((t
->c_lflag
& ECHOE
) == ECHOE
);
1039 *b
= ((t
->c_lflag
& ECHOK
) == ECHOK
);
1046 *b
= ((t
->c_lflag
& ECHONL
) == ECHONL
);
1053 *b
= ((t
->c_lflag
& NOFLSH
) == NOFLSH
);
1060 *b
= ((t
->c_lflag
& TOSTOP
) == TOSTOP
);
1066 #if defined(ECHOCTL)
1067 *b
= ((t
->c_lflag
& ECHOCTL
) == ECHOCTL
);
1073 #if defined(ECHOPRT)
1074 *b
= ((t
->c_lflag
& ECHOPRT
) == ECHOPRT
);
1081 *b
= ((t
->c_lflag
& ECHOKE
) == ECHOKE
);
1088 *b
= ((t
->c_lflag
& FLUSHO
) == FLUSHO
);
1095 *b
= ((t
->c_lflag
& PENDIN
) == PENDIN
);
1102 *b
= ((t
->c_lflag
& IEXTEN
) == IEXTEN
);
1111 /* SetFlag sets a flag value in t to b and returns true if this flag
1112 value is supported. */
1115 EXPORT (SetFlag
) (struct termios
*t
, Flag f
, bool b
)
1122 return doSetUnset (&t
->c_iflag
, IGNBRK
, b
);
1128 return doSetUnset (&t
->c_iflag
, BRKINT
, b
);
1134 return doSetUnset (&t
->c_iflag
, IGNPAR
, b
);
1140 return doSetUnset (&t
->c_iflag
, PARMRK
, b
);
1146 return doSetUnset (&t
->c_iflag
, INPCK
, b
);
1152 return doSetUnset (&t
->c_iflag
, ISTRIP
, b
);
1158 return doSetUnset (&t
->c_iflag
, INLCR
, b
);
1164 return doSetUnset (&t
->c_iflag
, IGNCR
, b
);
1170 return doSetUnset (&t
->c_iflag
, ICRNL
, b
);
1176 return doSetUnset (&t
->c_iflag
, IUCLC
, b
);
1182 return doSetUnset (&t
->c_iflag
, IXON
, b
);
1188 return doSetUnset (&t
->c_iflag
, IXANY
, b
);
1194 return doSetUnset (&t
->c_iflag
, IXOFF
, b
);
1199 #if defined(IMAXBEL)
1200 return doSetUnset (&t
->c_iflag
, IMAXBEL
, b
);
1206 return doSetUnset (&t
->c_oflag
, OPOST
, b
);
1212 return doSetUnset (&t
->c_oflag
, OLCUC
, b
);
1218 return doSetUnset (&t
->c_oflag
, ONLCR
, b
);
1224 return doSetUnset (&t
->c_oflag
, OCRNL
, b
);
1230 return doSetUnset (&t
->c_oflag
, ONOCR
, b
);
1236 return doSetUnset (&t
->c_oflag
, ONLRET
, b
);
1242 return doSetUnset (&t
->c_oflag
, OFILL
, b
);
1248 return doSetUnset (&t
->c_oflag
, OFDEL
, b
);
1254 return doSetUnset (&t
->c_oflag
, NL0
, b
);
1260 return doSetUnset (&t
->c_oflag
, NL1
, b
);
1266 return doSetUnset (&t
->c_oflag
, CR0
, b
);
1272 return doSetUnset (&t
->c_oflag
, CR1
, b
);
1278 return doSetUnset (&t
->c_oflag
, CR2
, b
);
1284 return doSetUnset (&t
->c_oflag
, CR3
, b
);
1290 return doSetUnset (&t
->c_oflag
, TAB0
, b
);
1296 return doSetUnset (&t
->c_oflag
, TAB1
, b
);
1302 return doSetUnset (&t
->c_oflag
, TAB2
, b
);
1308 return doSetUnset (&t
->c_oflag
, TAB3
, b
);
1314 return doSetUnset (&t
->c_oflag
, BS0
, b
);
1320 return doSetUnset (&t
->c_oflag
, BS1
, b
);
1326 return doSetUnset (&t
->c_oflag
, FF0
, b
);
1332 return doSetUnset (&t
->c_oflag
, FF1
, b
);
1338 return doSetUnset (&t
->c_oflag
, VT0
, b
);
1344 return doSetUnset (&t
->c_oflag
, VT1
, b
);
1350 return doSetUnset (&t
->c_cflag
, B0
, b
);
1356 return doSetUnset (&t
->c_cflag
, B50
, b
);
1362 return doSetUnset (&t
->c_cflag
, B75
, b
);
1368 return doSetUnset (&t
->c_cflag
, B110
, b
);
1374 return doSetUnset (&t
->c_cflag
, B134
, b
);
1380 return doSetUnset (&t
->c_cflag
, B150
, b
);
1386 return doSetUnset (&t
->c_cflag
, B200
, b
);
1392 return doSetUnset (&t
->c_cflag
, B300
, b
);
1398 return doSetUnset (&t
->c_cflag
, B600
, b
);
1404 return doSetUnset (&t
->c_cflag
, B1200
, b
);
1410 return doSetUnset (&t
->c_cflag
, B1800
, b
);
1416 return doSetUnset (&t
->c_cflag
, B2400
, b
);
1422 return doSetUnset (&t
->c_cflag
, B4800
, b
);
1428 return doSetUnset (&t
->c_cflag
, B9600
, b
);
1434 return doSetUnset (&t
->c_cflag
, B19200
, b
);
1440 return doSetUnset (&t
->c_cflag
, B38400
, b
);
1446 return doSetUnset (&t
->c_cflag
, B57600
, b
);
1451 #if defined(B115200)
1452 return doSetUnset (&t
->c_cflag
, B115200
, b
);
1457 #if defined(B230400)
1458 return doSetUnset (&t
->c_cflag
, B230400
, b
);
1463 #if defined(B460800)
1464 return doSetUnset (&t
->c_cflag
, B460800
, b
);
1469 #if defined(B500000)
1470 return doSetUnset (&t
->c_cflag
, B500000
, b
);
1475 #if defined(B576000)
1476 return doSetUnset (&t
->c_cflag
, B576000
, b
);
1481 #if defined(B921600)
1482 return doSetUnset (&t
->c_cflag
, B921600
, b
);
1487 #if defined(B1000000)
1488 return doSetUnset (&t
->c_cflag
, B1000000
, b
);
1493 #if defined(B1152000)
1494 return doSetUnset (&t
->c_cflag
, B1152000
, b
);
1499 #if defined(B1500000)
1500 return doSetUnset (&t
->c_cflag
, B1500000
, b
);
1505 #if defined(B2000000)
1506 return doSetUnset (&t
->c_cflag
, B2000000
, b
);
1511 #if defined(B2500000)
1512 return doSetUnset (&t
->c_cflag
, B2500000
, b
);
1517 #if defined(B3000000)
1518 return doSetUnset (&t
->c_cflag
, B3000000
, b
);
1523 #if defined(B3500000)
1524 return doSetUnset (&t
->c_cflag
, B3500000
, b
);
1529 #if defined(B4000000)
1530 return doSetUnset (&t
->c_cflag
, B4000000
, b
);
1535 #if defined(__MAX_BAUD)
1536 return doSetUnset (&t
->c_cflag
, __MAX_BAUD
, b
);
1541 #if defined(CRTSCTS)
1542 return doSetUnset (&t
->c_cflag
, CRTSCTS
, b
);
1548 return doSetUnset (&t
->c_cflag
, CS5
, b
);
1554 return doSetUnset (&t
->c_cflag
, CS6
, b
);
1560 return doSetUnset (&t
->c_cflag
, CS7
, b
);
1566 return doSetUnset (&t
->c_cflag
, CS8
, b
);
1572 return doSetUnset (&t
->c_cflag
, CSTOPB
, b
);
1578 return doSetUnset (&t
->c_cflag
, CREAD
, b
);
1584 return doSetUnset (&t
->c_cflag
, PARENB
, b
);
1590 return doSetUnset (&t
->c_cflag
, PARODD
, b
);
1596 return doSetUnset (&t
->c_cflag
, HUPCL
, b
);
1602 return doSetUnset (&t
->c_cflag
, CLOCAL
, b
);
1608 return doSetUnset (&t
->c_lflag
, ISIG
, b
);
1614 return doSetUnset (&t
->c_lflag
, ICANON
, b
);
1620 return doSetUnset (&t
->c_lflag
, XCASE
, b
);
1626 return doSetUnset (&t
->c_lflag
, ECHO
, b
);
1632 return doSetUnset (&t
->c_lflag
, ECHOE
, b
);
1638 return doSetUnset (&t
->c_lflag
, ECHOK
, b
);
1644 return doSetUnset (&t
->c_lflag
, ECHONL
, b
);
1650 return doSetUnset (&t
->c_lflag
, NOFLSH
, b
);
1656 return doSetUnset (&t
->c_lflag
, TOSTOP
, b
);
1661 #if defined(ECHOCTL)
1662 return doSetUnset (&t
->c_lflag
, ECHOCTL
, b
);
1667 #if defined(ECHOPRT)
1668 return doSetUnset (&t
->c_lflag
, ECHOPRT
, b
);
1674 return doSetUnset (&t
->c_lflag
, ECHOKE
, b
);
1680 return doSetUnset (&t
->c_lflag
, FLUSHO
, b
);
1686 return doSetUnset (&t
->c_lflag
, PENDIN
, b
);
1692 return doSetUnset (&t
->c_lflag
, IEXTEN
, b
);
1700 /* GetChar sets a CHAR, ch, value from, t, and returns TRUE if
1701 this value is supported. */
1704 EXPORT (GetChar
) (struct termios
*t
, ControlChar c
, char *ch
)
1711 *ch
= t
->c_cc
[VINTR
];
1718 *ch
= t
->c_cc
[VQUIT
];
1725 *ch
= t
->c_cc
[VERASE
];
1732 *ch
= t
->c_cc
[VKILL
];
1739 *ch
= t
->c_cc
[VEOF
];
1746 *ch
= t
->c_cc
[VTIME
];
1753 *ch
= t
->c_cc
[VMIN
];
1760 *ch
= t
->c_cc
[VSWTC
];
1767 *ch
= t
->c_cc
[VSTART
];
1774 *ch
= t
->c_cc
[VSTOP
];
1781 *ch
= t
->c_cc
[VSUSP
];
1788 *ch
= t
->c_cc
[VEOL
];
1794 #if defined(VREPRINT)
1795 *ch
= t
->c_cc
[VREPRINT
];
1801 #if defined(VDISCARD)
1802 *ch
= t
->c_cc
[VDISCARD
];
1808 #if defined(VWERASE)
1809 *ch
= t
->c_cc
[VWERASE
];
1816 *ch
= t
->c_cc
[VLNEXT
];
1823 *ch
= t
->c_cc
[VEOL2
];
1833 /* SetChar sets a CHAR value in, t, and returns TRUE if, c,
1837 EXPORT (SetChar
) (struct termios
*t
, ControlChar c
, char ch
)
1844 t
->c_cc
[VINTR
] = ch
;
1851 t
->c_cc
[VQUIT
] = ch
;
1858 t
->c_cc
[VERASE
] = ch
;
1865 t
->c_cc
[VKILL
] = ch
;
1879 t
->c_cc
[VTIME
] = ch
;
1893 t
->c_cc
[VSWTC
] = ch
;
1900 t
->c_cc
[VSTART
] = ch
;
1907 t
->c_cc
[VSTOP
] = ch
;
1914 t
->c_cc
[VSUSP
] = ch
;
1927 #if defined(VREPRINT)
1928 t
->c_cc
[VREPRINT
] = ch
;
1934 #if defined(VDISCARD)
1935 t
->c_cc
[VDISCARD
] = ch
;
1941 #if defined(VWERASE)
1942 t
->c_cc
[VWERASE
] = ch
;
1949 t
->c_cc
[VLNEXT
] = ch
;
1956 t
->c_cc
[VEOL2
] = ch
;
1968 M2EXPORT(init
) (int, char *argv
[], char *env
[])
1973 M2EXPORT(fini
) (int, char *argv
[], char *env
[])
1978 M2EXPORT(dep
) (void)
1982 extern "C" void __attribute__((__constructor__
))
1983 M2EXPORT(ctor
) (void)
1985 m2pim_M2RTS_RegisterModule ("termios", M2LIBNAME
,
1986 M2EXPORT(init
), M2EXPORT(fini
), M2EXPORT(dep
));