Debian Codegraph @

gcc/m2/gm2-libs-ch/termios.c

raw
1 /* termios.c provide access to termios.
2
3 Copyright (C) 2010-2025 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <[email protected]>.
5
6 This file is part of GNU Modula-2.
7
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)
11 any later version.
12
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.
17
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.
21
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/>. */
26
27 #include "config.h"
28 #include "system.h"
29
30 #include "gm2-libs-host.h"
31
32 #define _termios_C
33 #include "Gtermios.h"
34
35 #ifdef HAVE_TERMIOS_H
36 # include <termios.h>
37 #endif
38
39 #ifdef TERMIOS_NEEDS_XOPEN_SOURCE
40 #define _XOPEN_SOURCE
41 #endif
42
43 #if defined(__cplusplus)
44 #define EXTERN extern "C"
45 #else
46 #define EXTERN
47 #endif
48
49 #define EXPORT(X) termios##_##X
50
51 typedef enum {
52 vintr,
53 vquit,
54 verase,
55 vkill,
56 veof,
57 vtime,
58 vmin,
59 vswtc,
60 vstart,
61 vstop,
62 vsusp,
63 veol,
64 vreprint,
65 vdiscard,
66 vwerase,
67 vlnext,
68 veol2
69 } ControlChar;
70
71 typedef enum {
72 /* input flag bits. */
73 ignbrk,
74 ibrkint,
75 ignpar,
76 iparmrk,
77 inpck,
78 istrip,
79 inlcr,
80 igncr,
81 icrnl,
82 iuclc,
83 ixon,
84 ixany,
85 ixoff,
86 imaxbel,
87 /* output flag bits. */
88 opost,
89 olcuc,
90 onlcr,
91 ocrnl,
92 onocr,
93 onlret,
94 ofill,
95 ofdel,
96 onl0,
97 onl1,
98 ocr0,
99 ocr1,
100 ocr2,
101 ocr3,
102 otab0,
103 otab1,
104 otab2,
105 otab3,
106 obs0,
107 obs1,
108 off0,
109 off1,
110 ovt0,
111 ovt1,
112 /* baud rate. */
113 b0,
114 b50,
115 b75,
116 b110,
117 b135,
118 b150,
119 b200,
120 b300,
121 b600,
122 b1200,
123 b1800,
124 b2400,
125 b4800,
126 b9600,
127 b19200,
128 b38400,
129 b57600,
130 b115200,
131 b240400,
132 b460800,
133 b500000,
134 b576000,
135 b921600,
136 b1000000,
137 b1152000,
138 b1500000,
139 b2000000,
140 b2500000,
141 b3000000,
142 b3500000,
143 b4000000,
144 maxbaud,
145 crtscts,
146 /* character size. */
147 cs5,
148 cs6,
149 cs7,
150 cs8,
151 cstopb,
152 cread,
153 parenb,
154 parodd,
155 hupcl,
156 clocal,
157 /* local flags. */
158 lisig,
159 licanon,
160 lxcase,
161 lecho,
162 lechoe,
163 lechok,
164 lechonl,
165 lnoflsh,
166 ltopstop,
167 lechoctl,
168 lechoprt,
169 lechoke,
170 lflusho,
171 lpendin,
172 liexten
173 } Flag;
174
175 int
176 doSetUnset (tcflag_t *bitset, unsigned int mask, int value)
177 {
178 if (value)
179 (*bitset) |= mask;
180 else
181 (*bitset) &= (~mask);
182 return 1;
183 }
184
185
186 #ifdef __cplusplus
187 extern "C" {
188 #endif
189
190 /* InitTermios - new data structure. */
191
192 void *
193 EXPORT (InitTermios) (void)
194 {
195 struct termios *p = (struct termios *)malloc (sizeof (struct termios));
196
197 memset (p, 0, sizeof (struct termios));
198 return p;
199 }
200
201 /* KillTermios - delete data structure. */
202
203 void *
204 EXPORT (KillTermios) (termios_TERMIOS p)
205 {
206 free (p);
207 return NULL;
208 }
209
210 /* tcsnow return the value of TCSANOW. */
211
212 int
213 EXPORT (tcsnow) (void)
214 {
215 return TCSANOW;
216 }
217
218 /* tcsdrain return the value of TCSADRAIN. */
219
220 int
221 EXPORT (tcsdrain) (void)
222 {
223 return TCSADRAIN;
224 }
225
226 /* tcsflush return the value of TCSAFLUSH. */
227
228 int
229 EXPORT (tcsflush) (void)
230 {
231 return TCSAFLUSH;
232 }
233
234 /* cfgetospeed return output baud rate. */
235
236 int
237 EXPORT (cfgetospeed) (termios_TERMIOS _t)
238 {
239 struct termios *t = (termios *)_t;
240 return cfgetospeed (t);
241 }
242
243 /* cfgetispeed return input baud rate. */
244
245 int
246 EXPORT (cfgetispeed) (termios_TERMIOS _t)
247 {
248 struct termios *t = (termios *)_t;
249 return cfgetispeed (t);
250 }
251
252 /* cfsetospeed set output baud rate. */
253
254 int
255 EXPORT (cfsetospeed) (termios_TERMIOS _t, unsigned int b)
256 {
257 struct termios *t = (termios *)_t;
258 return cfsetospeed (t, b);
259 }
260
261 /* cfsetispeed set input baud rate. */
262
263 int
264 EXPORT (cfsetispeed) (termios_TERMIOS _t, unsigned int b)
265 {
266 struct termios *t = (termios *)_t;
267 return cfsetispeed (t, b);
268 }
269
270 /* cfsetspeed set input and output baud rate. */
271
272 int
273 EXPORT (cfsetspeed) (termios_TERMIOS _t, unsigned int b)
274 {
275 struct termios *t = (termios *)_t;
276 int val = cfsetispeed (t, b);
277 if (val == 0)
278 return cfsetospeed (t, b);
279 cfsetospeed (t, b);
280 return val;
281 }
282
283 /* tcgetattr get state of fd into t. */
284
285 int
286 EXPORT (tcgetattr) (int fd, termios_TERMIOS _t)
287 {
288 struct termios *t = (termios *)_t;
289 return tcgetattr (fd, t);
290 }
291
292 /* tcsetattr set state of fd to t using option. */
293
294 int
295 EXPORT (tcsetattr) (int fd, int option, termios_TERMIOS _t)
296 {
297 struct termios *t = (termios *)_t;
298 return tcsetattr (fd, option, t);
299 }
300
301 /* cfmakeraw sets the terminal to raw mode. */
302
303 void
304 EXPORT (cfmakeraw) (termios_TERMIOS _t)
305 {
306 #if defined(HAVE_CFMAKERAW)
307 struct termios *t = (termios *)_t;
308 cfmakeraw (t);
309 #endif
310 }
311
312 /* tcsendbreak send zero bits for duration. */
313
314 int
315 EXPORT (tcsendbreak) (int fd, int duration)
316 {
317 return tcsendbreak (fd, duration);
318 }
319
320 /* tcdrain waits for pending output to be written on fd. */
321
322 int
323 EXPORT (tcdrain) (int fd)
324 {
325 return tcdrain (fd);
326 }
327
328 /* tcflushi flush input. */
329
330 int
331 EXPORT (tcflushi) (int fd)
332 {
333 #if defined(TCIFLUSH)
334 return tcflush (fd, TCIFLUSH);
335 #else
336 return 1;
337 #endif
338 }
339
340 /* tcflusho flush output. */
341
342 int
343 EXPORT (tcflusho) (int fd)
344 {
345 #if defined(TCOFLUSH)
346 return tcflush (fd, TCOFLUSH);
347 #else
348 return 1;
349 #endif
350 }
351
352 /* tcflushio flush input and output. */
353
354 int
355 EXPORT (tcflushio) (int fd)
356 {
357 #if defined(TCIOFLUSH)
358 return tcflush (fd, TCIOFLUSH);
359 #else
360 return 1;
361 #endif
362 }
363
364 /* tcflowoni restart input on fd. */
365
366 int
367 EXPORT (tcflowoni) (int fd)
368 {
369 #if defined(TCION)
370 return tcflow (fd, TCION);
371 #else
372 return 1;
373 #endif
374 }
375
376 /* tcflowoffi stop input on fd. */
377
378 int
379 EXPORT (tcflowoffi) (int fd)
380 {
381 #if defined(TCIOFF)
382 return tcflow (fd, TCIOFF);
383 #else
384 return 1;
385 #endif
386 }
387
388 /* tcflowono restart output on fd. */
389
390 int
391 EXPORT (tcflowono) (int fd)
392 {
393 #if defined(TCOON)
394 return tcflow (fd, TCOON);
395 #else
396 return 1;
397 #endif
398 }
399
400 /* tcflowoffo stop output on fd. */
401
402 int
403 EXPORT (tcflowoffo) (int fd)
404 {
405 #if defined(TCOOFF)
406 return tcflow (fd, TCOOFF);
407 #else
408 return 1;
409 #endif
410 }
411
412 /* GetFlag sets a flag value from t in b and returns TRUE if
413 t supports f. */
414
415 bool
416 EXPORT (GetFlag) (termios_TERMIOS _t, termios_Flag _f, bool *b)
417 {
418 Flag f = (Flag) _f;
419 struct termios *t = (termios *)_t;
420 switch (f)
421 {
422
423 case ignbrk:
424 #if defined(IGNBRK)
425 *b = ((t->c_iflag & IGNBRK) == IGNBRK);
426 return true;
427 #else
428 return false;
429 #endif
430 case ibrkint:
431 #if defined(BRKINT)
432 *b = ((t->c_iflag & BRKINT) == BRKINT);
433 return true;
434 #else
435 return false;
436 #endif
437 case ignpar:
438 #if defined(IGNPAR)
439 *b = ((t->c_iflag & IGNPAR) == IGNPAR);
440 return true;
441 #else
442 return false;
443 #endif
444 case iparmrk:
445 #if defined(PARMRK)
446 *b = ((t->c_iflag & PARMRK) == PARMRK);
447 return true;
448 #else
449 return false;
450 #endif
451 case inpck:
452 #if defined(INPCK)
453 *b = ((t->c_iflag & INPCK) == INPCK);
454 return true;
455 #else
456 return false;
457 #endif
458 case istrip:
459 #if defined(ISTRIP)
460 *b = ((t->c_iflag & ISTRIP) == ISTRIP);
461 return true;
462 #else
463 return false;
464 #endif
465 case inlcr:
466 #if defined(INLCR)
467 *b = ((t->c_iflag & INLCR) == INLCR);
468 return true;
469 #else
470 return false;
471 #endif
472 case igncr:
473 #if defined(IGNCR)
474 *b = ((t->c_iflag & IGNCR) == IGNCR);
475 return true;
476 #else
477 return false;
478 #endif
479 case icrnl:
480 #if defined(ICRNL)
481 *b = ((t->c_iflag & ICRNL) == ICRNL);
482 return true;
483 #else
484 return false;
485 #endif
486 case iuclc:
487 #if defined(IUCLC)
488 *b = ((t->c_iflag & IUCLC) == IUCLC);
489 return true;
490 #else
491 return false;
492 #endif
493 case ixon:
494 #if defined(IXON)
495 *b = ((t->c_iflag & IXON) == IXON);
496 return true;
497 #else
498 return false;
499 #endif
500 case ixany:
501 #if defined(IXANY)
502 *b = ((t->c_iflag & IXANY) == IXANY);
503 return true;
504 #else
505 return false;
506 #endif
507 case ixoff:
508 #if defined(IXOFF)
509 *b = ((t->c_iflag & IXOFF) == IXOFF);
510 return true;
511 #else
512 return false;
513 #endif
514 case imaxbel:
515 #if defined(IMAXBEL)
516 *b = ((t->c_iflag & IMAXBEL) == IMAXBEL);
517 return true;
518 #else
519 return false;
520 #endif
521 case opost:
522 #if defined(OPOST)
523 *b = ((t->c_oflag & OPOST) == OPOST);
524 return true;
525 #else
526 return false;
527 #endif
528 case olcuc:
529 #if defined(OLCUC)
530 *b = ((t->c_oflag & OLCUC) == OLCUC);
531 return true;
532 #else
533 return false;
534 #endif
535 case onlcr:
536 #if defined(ONLCR)
537 *b = ((t->c_oflag & ONLCR) == ONLCR);
538 return true;
539 #else
540 return false;
541 #endif
542 case ocrnl:
543 #if defined(OCRNL)
544 *b = ((t->c_oflag & OCRNL) == OCRNL);
545 return true;
546 #else
547 return false;
548 #endif
549 case onocr:
550 #if defined(ONOCR)
551 *b = ((t->c_oflag & ONOCR) == ONOCR);
552 return true;
553 #else
554 return false;
555 #endif
556 case onlret:
557 #if defined(ONLRET)
558 *b = ((t->c_oflag & ONLRET) == ONLRET);
559 return true;
560 #else
561 return false;
562 #endif
563 case ofill:
564 #if defined(OFILL)
565 *b = ((t->c_oflag & OFILL) == OFILL);
566 return true;
567 #else
568 return false;
569 #endif
570 case ofdel:
571 #if defined(OFDEL)
572 *b = ((t->c_oflag & OFDEL) == OFDEL);
573 return true;
574 #else
575 return false;
576 #endif
577 case onl0:
578 #if defined(NL0)
579 *b = ((t->c_oflag & NL0) == NL0);
580 return true;
581 #else
582 return false;
583 #endif
584 case onl1:
585 #if defined(NL1)
586 *b = ((t->c_oflag & NL1) == NL1);
587 return true;
588 #else
589 return false;
590 #endif
591 case ocr0:
592 #if defined(CR0)
593 *b = ((t->c_oflag & CR0) == CR0);
594 return true;
595 #else
596 return false;
597 #endif
598 case ocr1:
599 #if defined(CR1)
600 *b = ((t->c_oflag & CR1) == CR1);
601 return true;
602 #else
603 return false;
604 #endif
605 case ocr2:
606 #if defined(CR2)
607 *b = ((t->c_oflag & CR2) == CR2);
608 return true;
609 #else
610 return false;
611 #endif
612 case ocr3:
613 #if defined(CR3)
614 *b = ((t->c_oflag & CR3) == CR3);
615 return true;
616 #else
617 return false;
618 #endif
619 case otab0:
620 #if defined(TAB0)
621 *b = ((t->c_oflag & TAB0) == TAB0);
622 return true;
623 #else
624 return false;
625 #endif
626 case otab1:
627 #if defined(TAB1)
628 *b = ((t->c_oflag & TAB1) == TAB1);
629 return true;
630 #else
631 return false;
632 #endif
633 case otab2:
634 #if defined(TAB2)
635 *b = ((t->c_oflag & TAB2) == TAB2);
636 return true;
637 #else
638 return false;
639 #endif
640 case otab3:
641 #if defined(TAB3)
642 *b = ((t->c_oflag & TAB3) == TAB3);
643 return true;
644 #else
645 return false;
646 #endif
647 case obs0:
648 #if defined(BS0)
649 *b = ((t->c_oflag & BS0) == BS0);
650 return true;
651 #else
652 return false;
653 #endif
654 case obs1:
655 #if defined(BS1)
656 *b = ((t->c_oflag & BS1) == BS1);
657 return true;
658 #else
659 return false;
660 #endif
661 case off0:
662 #if defined(FF0)
663 *b = ((t->c_oflag & FF0) == FF0);
664 return true;
665 #else
666 return false;
667 #endif
668 case off1:
669 #if defined(FF1)
670 *b = ((t->c_oflag & FF1) == FF1);
671 return true;
672 #else
673 return false;
674 #endif
675 case ovt0:
676 #if defined(VT0)
677 *b = ((t->c_oflag & VT0) == VT0);
678 return true;
679 #else
680 return false;
681 #endif
682 case ovt1:
683 #if defined(VT1)
684 *b = ((t->c_oflag & VT1) == VT1);
685 return true;
686 #else
687 return false;
688 #endif
689 case b0:
690 #if defined(B0)
691 *b = ((t->c_cflag & B0) == B0);
692 return true;
693 #else
694 return false;
695 #endif
696 case b50:
697 #if defined(B50)
698 *b = ((t->c_cflag & B50) == B50);
699 return true;
700 #else
701 return false;
702 #endif
703 case b75:
704 #if defined(B75)
705 *b = ((t->c_cflag & B75) == B75);
706 return true;
707 #else
708 return false;
709 #endif
710 case b110:
711 #if defined(B110)
712 *b = ((t->c_cflag & B110) == B110);
713 return true;
714 #else
715 return false;
716 #endif
717 case b135:
718 #if defined(B134)
719 *b = ((t->c_cflag & B134) == B134);
720 return true;
721 #else
722 return false;
723 #endif
724 case b150:
725 #if defined(B150)
726 *b = ((t->c_cflag & B150) == B150);
727 return true;
728 #else
729 return false;
730 #endif
731 case b200:
732 #if defined(B200)
733 *b = ((t->c_cflag & B200) == B200);
734 return true;
735 #else
736 return false;
737 #endif
738 case b300:
739 #if defined(B300)
740 *b = ((t->c_cflag & B300) == B300);
741 return true;
742 #else
743 return false;
744 #endif
745 case b600:
746 #if defined(B600)
747 *b = ((t->c_cflag & B600) == B600);
748 return true;
749 #else
750 return false;
751 #endif
752 case b1200:
753 #if defined(B1200)
754 *b = ((t->c_cflag & B1200) == B1200);
755 return true;
756 #else
757 return false;
758 #endif
759 case b1800:
760 #if defined(B1800)
761 *b = ((t->c_cflag & B1800) == B1800);
762 return true;
763 #else
764 return false;
765 #endif
766 case b2400:
767 #if defined(B2400)
768 *b = ((t->c_cflag & B2400) == B2400);
769 return true;
770 #else
771 return false;
772 #endif
773 case b4800:
774 #if defined(B4800)
775 *b = ((t->c_cflag & B4800) == B4800);
776 return true;
777 #else
778 return false;
779 #endif
780 case b9600:
781 #if defined(B9600)
782 *b = ((t->c_cflag & B9600) == B9600);
783 return true;
784 #else
785 return false;
786 #endif
787 case b19200:
788 #if defined(B19200)
789 *b = ((t->c_cflag & B19200) == B19200);
790 return true;
791 #else
792 return false;
793 #endif
794 case b38400:
795 #if defined(B38400)
796 *b = ((t->c_cflag & B38400) == B38400);
797 return true;
798 #else
799 return false;
800 #endif
801 case b57600:
802 #if defined(B57600)
803 *b = ((t->c_cflag & B57600) == B57600);
804 return true;
805 #else
806 return false;
807 #endif
808 case b115200:
809 #if defined(B115200)
810 *b = ((t->c_cflag & B115200) == B115200);
811 return true;
812 #else
813 return false;
814 #endif
815 case b240400:
816 #if defined(B230400)
817 *b = ((t->c_cflag & B230400) == B230400);
818 return true;
819 #else
820 return false;
821 #endif
822 case b460800:
823 #if defined(B460800)
824 *b = ((t->c_cflag & B460800) == B460800);
825 return true;
826 #else
827 return false;
828 #endif
829 case b500000:
830 #if defined(B500000)
831 *b = ((t->c_cflag & B500000) == B500000);
832 return true;
833 #else
834 return false;
835 #endif
836 case b576000:
837 #if defined(B576000)
838 *b = ((t->c_cflag & B576000) == B576000);
839 return true;
840 #else
841 return false;
842 #endif
843 case b921600:
844 #if defined(B921600)
845 *b = ((t->c_cflag & B921600) == B921600);
846 return true;
847 #else
848 return false;
849 #endif
850 case b1000000:
851 #if defined(B1000000)
852 *b = ((t->c_cflag & B1000000) == B1000000);
853 return true;
854 #else
855 return false;
856 #endif
857 case b1152000:
858 #if defined(B1152000)
859 *b = ((t->c_cflag & B1152000) == B1152000);
860 return true;
861 #else
862 return false;
863 #endif
864 case b1500000:
865 #if defined(B1500000)
866 *b = ((t->c_cflag & B1500000) == B1500000);
867 return true;
868 #else
869 return false;
870 #endif
871 case b2000000:
872 #if defined(B2000000)
873 *b = ((t->c_cflag & B2000000) == B2000000);
874 return true;
875 #else
876 return false;
877 #endif
878 case b2500000:
879 #if defined(B2500000)
880 *b = ((t->c_cflag & B2500000) == B2500000);
881 return true;
882 #else
883 return false;
884 #endif
885 case b3000000:
886 #if defined(B3000000)
887 *b = ((t->c_cflag & B3000000) == B3000000);
888 return true;
889 #else
890 return false;
891 #endif
892 case b3500000:
893 #if defined(B3500000)
894 *b = ((t->c_cflag & B3500000) == B3500000);
895 return true;
896 #else
897 return false;
898 #endif
899 case b4000000:
900 #if defined(B4000000)
901 *b = ((t->c_cflag & B4000000) == B4000000);
902 return true;
903 #else
904 return false;
905 #endif
906 case maxbaud:
907 #if defined(__MAX_BAUD)
908 *b = ((t->c_cflag & __MAX_BAUD) == __MAX_BAUD);
909 return true;
910 #else
911 return false;
912 #endif
913 case crtscts:
914 #if defined(CRTSCTS)
915 *b = ((t->c_cflag & CRTSCTS) == CRTSCTS);
916 return true;
917 #else
918 return false;
919 #endif
920 case cs5:
921 #if defined(CS5)
922 *b = ((t->c_cflag & CS5) == CS5);
923 return true;
924 #else
925 return false;
926 #endif
927 case cs6:
928 #if defined(CS6)
929 *b = ((t->c_cflag & CS6) == CS6);
930 return true;
931 #else
932 return false;
933 #endif
934 case cs7:
935 #if defined(CS7)
936 *b = ((t->c_cflag & CS7) == CS7);
937 return true;
938 #else
939 return false;
940 #endif
941 case cs8:
942 #if defined(CS8)
943 *b = ((t->c_cflag & CS8) == CS8);
944 return true;
945 #else
946 return false;
947 #endif
948 case cstopb:
949 #if defined(CSTOPB)
950 *b = ((t->c_cflag & CSTOPB) == CSTOPB);
951 return true;
952 #else
953 return false;
954 #endif
955 case cread:
956 #if defined(CREAD)
957 *b = ((t->c_cflag & CREAD) == CREAD);
958 return true;
959 #else
960 return false;
961 #endif
962 case parenb:
963 #if defined(PARENB)
964 *b = ((t->c_cflag & PARENB) == PARENB);
965 return true;
966 #else
967 return false;
968 #endif
969 case parodd:
970 #if defined(PARODD)
971 *b = ((t->c_cflag & PARODD) == PARODD);
972 return true;
973 #else
974 return false;
975 #endif
976 case hupcl:
977 #if defined(HUPCL)
978 *b = ((t->c_cflag & HUPCL) == HUPCL);
979 return true;
980 #else
981 return false;
982 #endif
983 case clocal:
984 #if defined(CLOCAL)
985 *b = ((t->c_cflag & CLOCAL) == CLOCAL);
986 return true;
987 #else
988 return false;
989 #endif
990 case lisig:
991 #if defined(ISIG)
992 *b = ((t->c_lflag & ISIG) == ISIG);
993 return true;
994 #else
995 return false;
996 #endif
997 case licanon:
998 #if defined(ICANON)
999 *b = ((t->c_lflag & ICANON) == ICANON);
1000 return true;
1001 #else
1002 return false;
1003 #endif
1004 case lxcase:
1005 #if defined(XCASE)
1006 *b = ((t->c_lflag & XCASE) == XCASE);
1007 return true;
1008 #else
1009 return false;
1010 #endif
1011 case lecho:
1012 #if defined(ECHO)
1013 *b = ((t->c_lflag & ECHO) == ECHO);
1014 return true;
1015 #else
1016 return false;
1017 #endif
1018 case lechoe:
1019 #if defined(ECHOE)
1020 *b = ((t->c_lflag & ECHOE) == ECHOE);
1021 return true;
1022 #else
1023 return false;
1024 #endif
1025 case lechok:
1026 #if defined(ECHOK)
1027 *b = ((t->c_lflag & ECHOK) == ECHOK);
1028 return true;
1029 #else
1030 return false;
1031 #endif
1032 case lechonl:
1033 #if defined(ECHONL)
1034 *b = ((t->c_lflag & ECHONL) == ECHONL);
1035 return true;
1036 #else
1037 return false;
1038 #endif
1039 case lnoflsh:
1040 #if defined(NOFLSH)
1041 *b = ((t->c_lflag & NOFLSH) == NOFLSH);
1042 return true;
1043 #else
1044 return false;
1045 #endif
1046 case ltopstop:
1047 #if defined(TOSTOP)
1048 *b = ((t->c_lflag & TOSTOP) == TOSTOP);
1049 return true;
1050 #else
1051 return false;
1052 #endif
1053 case lechoctl:
1054 #if defined(ECHOCTL)
1055 *b = ((t->c_lflag & ECHOCTL) == ECHOCTL);
1056 return true;
1057 #else
1058 return false;
1059 #endif
1060 case lechoprt:
1061 #if defined(ECHOPRT)
1062 *b = ((t->c_lflag & ECHOPRT) == ECHOPRT);
1063 return true;
1064 #else
1065 return false;
1066 #endif
1067 case lechoke:
1068 #if defined(ECHOKE)
1069 *b = ((t->c_lflag & ECHOKE) == ECHOKE);
1070 return true;
1071 #else
1072 return false;
1073 #endif
1074 case lflusho:
1075 #if defined(FLUSHO)
1076 *b = ((t->c_lflag & FLUSHO) == FLUSHO);
1077 return true;
1078 #else
1079 return false;
1080 #endif
1081 case lpendin:
1082 #if defined(PENDIN)
1083 *b = ((t->c_lflag & PENDIN) == PENDIN);
1084 return true;
1085 #else
1086 return false;
1087 #endif
1088 case liexten:
1089 #if defined(IEXTEN)
1090 *b = ((t->c_lflag & IEXTEN) == IEXTEN);
1091 return true;
1092 #else
1093 return false;
1094 #endif
1095 }
1096 return false;
1097 }
1098
1099 /* SetFlag sets a flag value in t to b and returns TRUE if this
1100 flag value is supported. */
1101
1102 bool
1103 EXPORT (SetFlag) (termios_TERMIOS _t, termios_Flag _f, bool b)
1104 {
1105 struct termios *t = (struct termios *) _t;
1106 Flag f = (Flag) _f;
1107
1108 switch (f)
1109 {
1110 case ignbrk:
1111 #if defined(IGNBRK)
1112 return doSetUnset (&t->c_iflag, IGNBRK, b);
1113 #else
1114 return false;
1115 #endif
1116 case ibrkint:
1117 #if defined(BRKINT)
1118 return doSetUnset (&t->c_iflag, BRKINT, b);
1119 #else
1120 return false;
1121 #endif
1122 case ignpar:
1123 #if defined(IGNPAR)
1124 return doSetUnset (&t->c_iflag, IGNPAR, b);
1125 #else
1126 return false;
1127 #endif
1128 case iparmrk:
1129 #if defined(PARMRK)
1130 return doSetUnset (&t->c_iflag, PARMRK, b);
1131 #else
1132 return false;
1133 #endif
1134 case inpck:
1135 #if defined(INPCK)
1136 return doSetUnset (&t->c_iflag, INPCK, b);
1137 #else
1138 return false;
1139 #endif
1140 case istrip:
1141 #if defined(ISTRIP)
1142 return doSetUnset (&t->c_iflag, ISTRIP, b);
1143 #else
1144 return false;
1145 #endif
1146 case inlcr:
1147 #if defined(INLCR)
1148 return doSetUnset (&t->c_iflag, INLCR, b);
1149 #else
1150 return false;
1151 #endif
1152 case igncr:
1153 #if defined(IGNCR)
1154 return doSetUnset (&t->c_iflag, IGNCR, b);
1155 #else
1156 return false;
1157 #endif
1158 case icrnl:
1159 #if defined(ICRNL)
1160 return doSetUnset (&t->c_iflag, ICRNL, b);
1161 #else
1162 return false;
1163 #endif
1164 case iuclc:
1165 #if defined(IUCLC)
1166 return doSetUnset (&t->c_iflag, IUCLC, b);
1167 #else
1168 return false;
1169 #endif
1170 case ixon:
1171 #if defined(IXON)
1172 return doSetUnset (&t->c_iflag, IXON, b);
1173 #else
1174 return false;
1175 #endif
1176 case ixany:
1177 #if defined(IXANY)
1178 return doSetUnset (&t->c_iflag, IXANY, b);
1179 #else
1180 return false;
1181 #endif
1182 case ixoff:
1183 #if defined(IXOFF)
1184 return doSetUnset (&t->c_iflag, IXOFF, b);
1185 #else
1186 return false;
1187 #endif
1188 case imaxbel:
1189 #if defined(IMAXBEL)
1190 return doSetUnset (&t->c_iflag, IMAXBEL, b);
1191 #else
1192 return false;
1193 #endif
1194 case opost:
1195 #if defined(OPOST)
1196 return doSetUnset (&t->c_oflag, OPOST, b);
1197 #else
1198 return false;
1199 #endif
1200 case olcuc:
1201 #if defined(OLCUC)
1202 return doSetUnset (&t->c_oflag, OLCUC, b);
1203 #else
1204 return false;
1205 #endif
1206 case onlcr:
1207 #if defined(ONLCR)
1208 return doSetUnset (&t->c_oflag, ONLCR, b);
1209 #else
1210 return false;
1211 #endif
1212 case ocrnl:
1213 #if defined(OCRNL)
1214 return doSetUnset (&t->c_oflag, OCRNL, b);
1215 #else
1216 return false;
1217 #endif
1218 case onocr:
1219 #if defined(ONOCR)
1220 return doSetUnset (&t->c_oflag, ONOCR, b);
1221 #else
1222 return false;
1223 #endif
1224 case onlret:
1225 #if defined(ONLRET)
1226 return doSetUnset (&t->c_oflag, ONLRET, b);
1227 #else
1228 return false;
1229 #endif
1230 case ofill:
1231 #if defined(OFILL)
1232 return doSetUnset (&t->c_oflag, OFILL, b);
1233 #else
1234 return false;
1235 #endif
1236 case ofdel:
1237 #if defined(OFDEL)
1238 return doSetUnset (&t->c_oflag, OFDEL, b);
1239 #else
1240 return false;
1241 #endif
1242 case onl0:
1243 #if defined(NL0)
1244 return doSetUnset (&t->c_oflag, NL0, b);
1245 #else
1246 return false;
1247 #endif
1248 case onl1:
1249 #if defined(NL1)
1250 return doSetUnset (&t->c_oflag, NL1, b);
1251 #else
1252 return false;
1253 #endif
1254 case ocr0:
1255 #if defined(CR0)
1256 return doSetUnset (&t->c_oflag, CR0, b);
1257 #else
1258 return false;
1259 #endif
1260 case ocr1:
1261 #if defined(CR1)
1262 return doSetUnset (&t->c_oflag, CR1, b);
1263 #else
1264 return false;
1265 #endif
1266 case ocr2:
1267 #if defined(CR2)
1268 return doSetUnset (&t->c_oflag, CR2, b);
1269 #else
1270 return false;
1271 #endif
1272 case ocr3:
1273 #if defined(CR3)
1274 return doSetUnset (&t->c_oflag, CR3, b);
1275 #else
1276 return false;
1277 #endif
1278 case otab0:
1279 #if defined(TAB0)
1280 return doSetUnset (&t->c_oflag, TAB0, b);
1281 #else
1282 return false;
1283 #endif
1284 case otab1:
1285 #if defined(TAB1)
1286 return doSetUnset (&t->c_oflag, TAB1, b);
1287 #else
1288 return false;
1289 #endif
1290 case otab2:
1291 #if defined(TAB2)
1292 return doSetUnset (&t->c_oflag, TAB2, b);
1293 #else
1294 return false;
1295 #endif
1296 case otab3:
1297 #if defined(TAB3)
1298 return doSetUnset (&t->c_oflag, TAB3, b);
1299 #else
1300 return false;
1301 #endif
1302 case obs0:
1303 #if defined(BS0)
1304 return doSetUnset (&t->c_oflag, BS0, b);
1305 #else
1306 return false;
1307 #endif
1308 case obs1:
1309 #if defined(BS1)
1310 return doSetUnset (&t->c_oflag, BS1, b);
1311 #else
1312 return false;
1313 #endif
1314 case off0:
1315 #if defined(FF0)
1316 return doSetUnset (&t->c_oflag, FF0, b);
1317 #else
1318 return false;
1319 #endif
1320 case off1:
1321 #if defined(FF1)
1322 return doSetUnset (&t->c_oflag, FF1, b);
1323 #else
1324 return false;
1325 #endif
1326 case ovt0:
1327 #if defined(VT0)
1328 return doSetUnset (&t->c_oflag, VT0, b);
1329 #else
1330 return false;
1331 #endif
1332 case ovt1:
1333 #if defined(VT1)
1334 return doSetUnset (&t->c_oflag, VT1, b);
1335 #else
1336 return false;
1337 #endif
1338 case b0:
1339 #if defined(B0)
1340 return doSetUnset (&t->c_cflag, B0, b);
1341 #else
1342 return false;
1343 #endif
1344 case b50:
1345 #if defined(B50)
1346 return doSetUnset (&t->c_cflag, B50, b);
1347 #else
1348 return false;
1349 #endif
1350 case b75:
1351 #if defined(B75)
1352 return doSetUnset (&t->c_cflag, B75, b);
1353 #else
1354 return false;
1355 #endif
1356 case b110:
1357 #if defined(B110)
1358 return doSetUnset (&t->c_cflag, B110, b);
1359 #else
1360 return false;
1361 #endif
1362 case b135:
1363 #if defined(B134)
1364 return doSetUnset (&t->c_cflag, B134, b);
1365 #else
1366 return false;
1367 #endif
1368 case b150:
1369 #if defined(B150)
1370 return doSetUnset (&t->c_cflag, B150, b);
1371 #else
1372 return false;
1373 #endif
1374 case b200:
1375 #if defined(B200)
1376 return doSetUnset (&t->c_cflag, B200, b);
1377 #else
1378 return false;
1379 #endif
1380 case b300:
1381 #if defined(B300)
1382 return doSetUnset (&t->c_cflag, B300, b);
1383 #else
1384 return false;
1385 #endif
1386 case b600:
1387 #if defined(B600)
1388 return doSetUnset (&t->c_cflag, B600, b);
1389 #else
1390 return false;
1391 #endif
1392 case b1200:
1393 #if defined(B1200)
1394 return doSetUnset (&t->c_cflag, B1200, b);
1395 #else
1396 return false;
1397 #endif
1398 case b1800:
1399 #if defined(B1800)
1400 return doSetUnset (&t->c_cflag, B1800, b);
1401 #else
1402 return false;
1403 #endif
1404 case b2400:
1405 #if defined(B2400)
1406 return doSetUnset (&t->c_cflag, B2400, b);
1407 #else
1408 return false;
1409 #endif
1410 case b4800:
1411 #if defined(B4800)
1412 return doSetUnset (&t->c_cflag, B4800, b);
1413 #else
1414 return false;
1415 #endif
1416 case b9600:
1417 #if defined(B9600)
1418 return doSetUnset (&t->c_cflag, B9600, b);
1419 #else
1420 return false;
1421 #endif
1422 case b19200:
1423 #if defined(B19200)
1424 return doSetUnset (&t->c_cflag, B19200, b);
1425 #else
1426 return false;
1427 #endif
1428 case b38400:
1429 #if defined(B38400)
1430 return doSetUnset (&t->c_cflag, B38400, b);
1431 #else
1432 return false;
1433 #endif
1434 case b57600:
1435 #if defined(B57600)
1436 return doSetUnset (&t->c_cflag, B57600, b);
1437 #else
1438 return false;
1439 #endif
1440 case b115200:
1441 #if defined(B115200)
1442 return doSetUnset (&t->c_cflag, B115200, b);
1443 #else
1444 return false;
1445 #endif
1446 case b240400:
1447 #if defined(B230400)
1448 return doSetUnset (&t->c_cflag, B230400, b);
1449 #else
1450 return false;
1451 #endif
1452 case b460800:
1453 #if defined(B460800)
1454 return doSetUnset (&t->c_cflag, B460800, b);
1455 #else
1456 return false;
1457 #endif
1458 case b500000:
1459 #if defined(B500000)
1460 return doSetUnset (&t->c_cflag, B500000, b);
1461 #else
1462 return false;
1463 #endif
1464 case b576000:
1465 #if defined(B576000)
1466 return doSetUnset (&t->c_cflag, B576000, b);
1467 #else
1468 return false;
1469 #endif
1470 case b921600:
1471 #if defined(B921600)
1472 return doSetUnset (&t->c_cflag, B921600, b);
1473 #else
1474 return false;
1475 #endif
1476 case b1000000:
1477 #if defined(B1000000)
1478 return doSetUnset (&t->c_cflag, B1000000, b);
1479 #else
1480 return false;
1481 #endif
1482 case b1152000:
1483 #if defined(B1152000)
1484 return doSetUnset (&t->c_cflag, B1152000, b);
1485 #else
1486 return false;
1487 #endif
1488 case b1500000:
1489 #if defined(B1500000)
1490 return doSetUnset (&t->c_cflag, B1500000, b);
1491 #else
1492 return false;
1493 #endif
1494 case b2000000:
1495 #if defined(B2000000)
1496 return doSetUnset (&t->c_cflag, B2000000, b);
1497 #else
1498 return false;
1499 #endif
1500 case b2500000:
1501 #if defined(B2500000)
1502 return doSetUnset (&t->c_cflag, B2500000, b);
1503 #else
1504 return false;
1505 #endif
1506 case b3000000:
1507 #if defined(B3000000)
1508 return doSetUnset (&t->c_cflag, B3000000, b);
1509 #else
1510 return false;
1511 #endif
1512 case b3500000:
1513 #if defined(B3500000)
1514 return doSetUnset (&t->c_cflag, B3500000, b);
1515 #else
1516 return false;
1517 #endif
1518 case b4000000:
1519 #if defined(B4000000)
1520 return doSetUnset (&t->c_cflag, B4000000, b);
1521 #else
1522 return false;
1523 #endif
1524 case maxbaud:
1525 #if defined(__MAX_BAUD)
1526 return doSetUnset (&t->c_cflag, __MAX_BAUD, b);
1527 #else
1528 return false;
1529 #endif
1530 case crtscts:
1531 #if defined(CRTSCTS)
1532 return doSetUnset (&t->c_cflag, CRTSCTS, b);
1533 #else
1534 return false;
1535 #endif
1536 case cs5:
1537 #if defined(CS5)
1538 return doSetUnset (&t->c_cflag, CS5, b);
1539 #else
1540 return false;
1541 #endif
1542 case cs6:
1543 #if defined(CS6)
1544 return doSetUnset (&t->c_cflag, CS6, b);
1545 #else
1546 return false;
1547 #endif
1548 case cs7:
1549 #if defined(CS7)
1550 return doSetUnset (&t->c_cflag, CS7, b);
1551 #else
1552 return false;
1553 #endif
1554 case cs8:
1555 #if defined(CS8)
1556 return doSetUnset (&t->c_cflag, CS8, b);
1557 #else
1558 return false;
1559 #endif
1560 case cstopb:
1561 #if defined(CSTOPB)
1562 return doSetUnset (&t->c_cflag, CSTOPB, b);
1563 #else
1564 return false;
1565 #endif
1566 case cread:
1567 #if defined(CREAD)
1568 return doSetUnset (&t->c_cflag, CREAD, b);
1569 #else
1570 return false;
1571 #endif
1572 case parenb:
1573 #if defined(PARENB)
1574 return doSetUnset (&t->c_cflag, PARENB, b);
1575 #else
1576 return false;
1577 #endif
1578 case parodd:
1579 #if defined(PARODD)
1580 return doSetUnset (&t->c_cflag, PARODD, b);
1581 #else
1582 return false;
1583 #endif
1584 case hupcl:
1585 #if defined(HUPCL)
1586 return doSetUnset (&t->c_cflag, HUPCL, b);
1587 #else
1588 return false;
1589 #endif
1590 case clocal:
1591 #if defined(CLOCAL)
1592 return doSetUnset (&t->c_cflag, CLOCAL, b);
1593 #else
1594 return false;
1595 #endif
1596 case lisig:
1597 #if defined(ISIG)
1598 return doSetUnset (&t->c_lflag, ISIG, b);
1599 #else
1600 return false;
1601 #endif
1602 case licanon:
1603 #if defined(ICANON)
1604 return doSetUnset (&t->c_lflag, ICANON, b);
1605 #else
1606 return false;
1607 #endif
1608 case lxcase:
1609 #if defined(XCASE)
1610 return doSetUnset (&t->c_lflag, XCASE, b);
1611 #else
1612 return false;
1613 #endif
1614 case lecho:
1615 #if defined(ECHO)
1616 return doSetUnset (&t->c_lflag, ECHO, b);
1617 #else
1618 return false;
1619 #endif
1620 case lechoe:
1621 #if defined(ECHOE)
1622 return doSetUnset (&t->c_lflag, ECHOE, b);
1623 #else
1624 return false;
1625 #endif
1626 case lechok:
1627 #if defined(ECHOK)
1628 return doSetUnset (&t->c_lflag, ECHOK, b);
1629 #else
1630 return false;
1631 #endif
1632 case lechonl:
1633 #if defined(ECHONL)
1634 return doSetUnset (&t->c_lflag, ECHONL, b);
1635 #else
1636 return false;
1637 #endif
1638 case lnoflsh:
1639 #if defined(NOFLSH)
1640 return doSetUnset (&t->c_lflag, NOFLSH, b);
1641 #else
1642 return false;
1643 #endif
1644 case ltopstop:
1645 #if defined(TOSTOP)
1646 return doSetUnset (&t->c_lflag, TOSTOP, b);
1647 #else
1648 return false;
1649 #endif
1650 case lechoctl:
1651 #if defined(ECHOCTL)
1652 return doSetUnset (&t->c_lflag, ECHOCTL, b);
1653 #else
1654 return false;
1655 #endif
1656 case lechoprt:
1657 #if defined(ECHOPRT)
1658 return doSetUnset (&t->c_lflag, ECHOPRT, b);
1659 #else
1660 return false;
1661 #endif
1662 case lechoke:
1663 #if defined(ECHOKE)
1664 return doSetUnset (&t->c_lflag, ECHOKE, b);
1665 #else
1666 return false;
1667 #endif
1668 case lflusho:
1669 #if defined(FLUSHO)
1670 return doSetUnset (&t->c_lflag, FLUSHO, b);
1671 #else
1672 return false;
1673 #endif
1674 case lpendin:
1675 #if defined(PENDIN)
1676 return doSetUnset (&t->c_lflag, PENDIN, b);
1677 #else
1678 return false;
1679 #endif
1680 case liexten:
1681 #if defined(IEXTEN)
1682 return doSetUnset (&t->c_lflag, IEXTEN, b);
1683 #else
1684 return false;
1685 #endif
1686 }
1687 return false;
1688 }
1689
1690 /* GetChar sets a CHAR ch value from t and returns true/false if this
1691 value is supported. */
1692
1693 bool
1694 EXPORT (GetChar) (termios_TERMIOS _t, termios_ControlChar _c, char *ch)
1695 {
1696 ControlChar c = (ControlChar) _c;
1697 struct termios *t = (termios *)_t;
1698 switch (c)
1699 {
1700
1701 case vintr:
1702 #if defined(VINTR)
1703 *ch = t->c_cc[VINTR];
1704 return true;
1705 #else
1706 return false;
1707 #endif
1708 case vquit:
1709 #if defined(VQUIT)
1710 *ch = t->c_cc[VQUIT];
1711 return true;
1712 #else
1713 return false;
1714 #endif
1715 case verase:
1716 #if defined(VERASE)
1717 *ch = t->c_cc[VERASE];
1718 return true;
1719 #else
1720 return false;
1721 #endif
1722 case vkill:
1723 #if defined(VKILL)
1724 *ch = t->c_cc[VKILL];
1725 return true;
1726 #else
1727 return false;
1728 #endif
1729 case veof:
1730 #if defined(VEOF)
1731 *ch = t->c_cc[VEOF];
1732 return true;
1733 #else
1734 return false;
1735 #endif
1736 case vtime:
1737 #if defined(VTIME)
1738 *ch = t->c_cc[VTIME];
1739 return true;
1740 #else
1741 return false;
1742 #endif
1743 case vmin:
1744 #if defined(VMIN)
1745 *ch = t->c_cc[VMIN];
1746 return true;
1747 #else
1748 return false;
1749 #endif
1750 case vswtc:
1751 #if defined(VSWTC)
1752 *ch = t->c_cc[VSWTC];
1753 return true;
1754 #else
1755 return false;
1756 #endif
1757 case vstart:
1758 #if defined(VSTART)
1759 *ch = t->c_cc[VSTART];
1760 return true;
1761 #else
1762 return false;
1763 #endif
1764 case vstop:
1765 #if defined(VSTOP)
1766 *ch = t->c_cc[VSTOP];
1767 return true;
1768 #else
1769 return false;
1770 #endif
1771 case vsusp:
1772 #if defined(VSUSP)
1773 *ch = t->c_cc[VSUSP];
1774 return true;
1775 #else
1776 return false;
1777 #endif
1778 case veol:
1779 #if defined(VEOL)
1780 *ch = t->c_cc[VEOL];
1781 return true;
1782 #else
1783 return false;
1784 #endif
1785 case vreprint:
1786 #if defined(VREPRINT)
1787 *ch = t->c_cc[VREPRINT];
1788 return true;
1789 #else
1790 return false;
1791 #endif
1792 case vdiscard:
1793 #if defined(VDISCARD)
1794 *ch = t->c_cc[VDISCARD];
1795 return true;
1796 #else
1797 return false;
1798 #endif
1799 case vwerase:
1800 #if defined(VWERASE)
1801 *ch = t->c_cc[VWERASE];
1802 return true;
1803 #else
1804 return false;
1805 #endif
1806 case vlnext:
1807 #if defined(VLNEXT)
1808 *ch = t->c_cc[VLNEXT];
1809 return true;
1810 #else
1811 return false;
1812 #endif
1813 case veol2:
1814 #if defined(VEOL2)
1815 *ch = t->c_cc[VEOL2];
1816 return true;
1817 #else
1818 return false;
1819 #endif
1820 default:
1821 return false;
1822 }
1823 }
1824
1825 /* SetChar sets a CHAR value in t and returns true/false if c is
1826 supported. */
1827
1828 bool
1829 EXPORT (SetChar) (termios_TERMIOS _t, termios_ControlChar _c, char ch)
1830 {
1831 ControlChar c = (ControlChar) _c;
1832 struct termios *t = (termios *)_t;
1833 switch (c)
1834 {
1835
1836 case vintr:
1837 #if defined(VINTR)
1838 t->c_cc[VINTR] = ch;
1839 return true;
1840 #else
1841 return false;
1842 #endif
1843 case vquit:
1844 #if defined(VQUIT)
1845 t->c_cc[VQUIT] = ch;
1846 return true;
1847 #else
1848 return false;
1849 #endif
1850 case verase:
1851 #if defined(VERASE)
1852 t->c_cc[VERASE] = ch;
1853 return true;
1854 #else
1855 return false;
1856 #endif
1857 case vkill:
1858 #if defined(VKILL)
1859 t->c_cc[VKILL] = ch;
1860 return true;
1861 #else
1862 return false;
1863 #endif
1864 case veof:
1865 #if defined(VEOF)
1866 t->c_cc[VEOF] = ch;
1867 return true;
1868 #else
1869 return false;
1870 #endif
1871 case vtime:
1872 #if defined(VTIME)
1873 t->c_cc[VTIME] = ch;
1874 return true;
1875 #else
1876 return false;
1877 #endif
1878 case vmin:
1879 #if defined(VMIN)
1880 t->c_cc[VMIN] = ch;
1881 return true;
1882 #else
1883 return false;
1884 #endif
1885 case vswtc:
1886 #if defined(VSWTC)
1887 t->c_cc[VSWTC] = ch;
1888 return true;
1889 #else
1890 return false;
1891 #endif
1892 case vstart:
1893 #if defined(VSTART)
1894 t->c_cc[VSTART] = ch;
1895 return true;
1896 #else
1897 return false;
1898 #endif
1899 case vstop:
1900 #if defined(VSTOP)
1901 t->c_cc[VSTOP] = ch;
1902 return true;
1903 #else
1904 return false;
1905 #endif
1906 case vsusp:
1907 #if defined(VSUSP)
1908 t->c_cc[VSUSP] = ch;
1909 return true;
1910 #else
1911 return false;
1912 #endif
1913 case veol:
1914 #if defined(VEOL)
1915 t->c_cc[VEOL] = ch;
1916 return true;
1917 #else
1918 return false;
1919 #endif
1920 case vreprint:
1921 #if defined(VREPRINT)
1922 t->c_cc[VREPRINT] = ch;
1923 return true;
1924 #else
1925 return false;
1926 #endif
1927 case vdiscard:
1928 #if defined(VDISCARD)
1929 t->c_cc[VDISCARD] = ch;
1930 return true;
1931 #else
1932 return false;
1933 #endif
1934 case vwerase:
1935 #if defined(VWERASE)
1936 t->c_cc[VWERASE] = ch;
1937 return true;
1938 #else
1939 return false;
1940 #endif
1941 case vlnext:
1942 #if defined(VLNEXT)
1943 t->c_cc[VLNEXT] = ch;
1944 return true;
1945 #else
1946 return false;
1947 #endif
1948 case veol2:
1949 #if defined(VEOL2)
1950 t->c_cc[VEOL2] = ch;
1951 return true;
1952 #else
1953 return false;
1954 #endif
1955 default:
1956 return false;
1957 }
1958 }
1959
1960 void
1961 _M2_termios_init (int argc, char *argv[], char *envp[])
1962 {
1963 }
1964
1965 void
1966 _M2_termios_fini (int argc, char *argv[], char *envp[])
1967 {
1968 }
1969
1970 #ifdef __cplusplus
1971 }
1972 #endif