Debian Codegraph @

gcc/m2/mc-boot-ch/Gtermios.cc

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