api: shorten function checks (and put each into a different scope)
[libc-test] / src / api / termios.c
1 #include <termios.h>
2 #define T(t) (t*)0;
3 #define F(t,n) {t *y = &x.n;}
4 #define C(n) switch(n){case n:;}
5 static void f()
6 {
7 T(cc_t)
8 T(speed_t)
9 T(tcflag_t)
10 T(pid_t)
11 {
12 struct termios x;
13 F(tcflag_t,c_iflag)
14 F(tcflag_t,c_oflag)
15 F(tcflag_t,c_cflag)
16 F(tcflag_t,c_lflag)
17 F(cc_t,c_cc[NCCS])
18 }
19 C(NCCS)
20 C(VEOF)
21 C(VEOL)
22 C(VERASE)
23 C(VINTR)
24 C(VKILL)
25 C(VMIN)
26 C(VQUIT)
27 C(VSTART)
28 C(VSTOP)
29 C(VSUSP)
30 C(VTIME)
31 C(BRKINT)
32 C(ICRNL)
33 C(IGNBRK)
34 C(IGNCR)
35 C(IGNPAR)
36 C(INLCR)
37 C(INPCK)
38 C(ISTRIP)
39 C(IXANY)
40 C(IXOFF)
41 C(IXON)
42 C(PARMRK)
43 C(OPOST)
44 #ifdef _XOPEN_SOURCE
45 C(ONLCR)
46 C(OCRNL)
47 C(ONOCR)
48 C(ONLRET)
49 C(OFDEL)
50 C(OFILL)
51 C(NLDLY)
52 C(NL0)
53 C(NL1)
54 C(CRDLY)
55 C(CR0)
56 C(CR1)
57 C(CR2)
58 C(CR3)
59 C(TABDLY)
60 C(TAB0)
61 C(TAB1)
62 C(TAB2)
63 C(TAB3)
64 C(BSDLY)
65 C(BS0)
66 C(BS1)
67 C(VTDLY)
68 C(VT0)
69 C(VT1)
70 C(FFDLY)
71 C(FF0)
72 C(FF1)
73 #endif
74 C(B0)
75 C(B50)
76 C(B75)
77 C(B110)
78 C(B134)
79 C(B150)
80 C(B200)
81 C(B300)
82 C(B600)
83 C(B1200)
84 C(B1800)
85 C(B2400)
86 C(B4800)
87 C(B9600)
88 C(B19200)
89 C(B38400)
90 C(CSIZE)
91 C(CS5)
92 C(CS6)
93 C(CS7)
94 C(CS8)
95 C(CSTOPB)
96 C(CREAD)
97 C(PARENB)
98 C(PARODD)
99 C(HUPCL)
100 C(CLOCAL)
101 C(ECHO)
102 C(ECHOE)
103 C(ECHOK)
104 C(ECHONL)
105 C(ICANON)
106 C(IEXTEN)
107 C(ISIG)
108 C(NOFLSH)
109 C(TOSTOP)
110 C(TCSANOW)
111 C(TCSADRAIN)
112 C(TCSAFLUSH)
113 C(TCIFLUSH)
114 C(TCIOFLUSH)
115 C(TCOFLUSH)
116 C(TCIOFF)
117 C(TCION)
118 C(TCOOFF)
119 C(TCOON)
120 {speed_t(*p)(const struct termios*) = cfgetispeed;}
121 {speed_t(*p)(const struct termios*) = cfgetospeed;}
122 {int(*p)(struct termios*,speed_t) = cfsetispeed;}
123 {int(*p)(struct termios*,speed_t) = cfsetospeed;}
124 {int(*p)(int) = tcdrain;}
125 {int(*p)(int,int) = tcflow;}
126 {int(*p)(int,int) = tcflush;}
127 {int(*p)(int,struct termios*) = tcgetattr;}
128 {pid_t(*p)(int) = tcgetsid;}
129 {int(*p)(int,int) = tcsendbreak;}
130 {int(*p)(int,int,const struct termios*) = tcsetattr;}
131 }