Usermode/libc - Fix strchr and strrchr behavior
[tpg/acess2.git] / Usermode / Libraries / libposix.so_src / include_exp / termios.h
1 /*
2  * Acess2 POSIX Emulation
3  * - By John Hodge (thePowersGang)
4  *
5  * termios.h
6  * - Terminal Control
7  */
8 #ifndef _LIBPOSIX__TERMIOS_H_
9 #define _LIBPOSIX__TERMIOS_H_
10
11 typedef unsigned char   cc_t;
12 typedef unsigned long   speed_t;
13 typedef unsigned short  tcflag_t;
14
15 // c_iflag
16 #define IGNBRK  (1 << 0)
17 #define BRKINT  (1 << 1)
18 #define IGNPAR  (1 << 2)        // Ignore parity failures
19 #define PARMRK  (1 << 3)        // Mark parity failures with FFh 00h
20 #define INPCK   (1 << 4)        // Enable input parity checks
21 #define ISTRIP  (1 << 5)        // strip 8th bit
22 #define INLCR   (1 << 6)        // Translate input newline into CR
23 #define IGNCR   (1 << 7)        // Ignore input CR
24 #define ICRNL   (1 << 8)        // Translate input CR into NL
25 // (Linux) IUCLC        // Map upper to lower case
26 #define IXON    (1 <<10)        // Enable input XON/XOFF
27 #define IXANY   (1 <<11)        // Any character will restart input
28 #define IXOFF   IXON
29 // (Linux) IMAXBEL
30 // (Linux) IUTF8
31
32 // c_oflag
33 #define OPOST   (1 << 0)        // Output processing
34 // (Linux) OLCUC
35 #define ONLCR   (1 << 2)        // (XSI) NL->CR
36 #define OCRNL   (1 << 3)        // CR->NL
37 #define ONOCR   (1 << 4)        // Don't output CR at column 0
38 #define ONLRET  (1 << 5)        // Don't output CR
39 #define OFILL   (1 << 6)        // Send fill chars for a delay, instead of timing
40 // (Linux) OFDEL
41 #define NLDLY   (1 << 8)        // Newline delay mask (NL0/NL1)
42 #define NL0     (0 << 8)
43 #define NL1     (1 << 8)
44 #define NCDLY   (3 << 9)        // Carriage return delay mask (CR0-CR3)
45 #define CR0     (0 << 9)
46 #define CR1     (1 << 9)
47 #define CR2     (2 << 9)
48 #define CR3     (3 << 9)
49 #define TABDLY  (3 << 11)       // Horizontal tab delay mask
50 #define TAB0    (0 << 11)
51 #define TAB1    (1 << 11)
52 #define TAB2    (2 << 11)
53 #define TAB3    (3 << 11)
54 #define BSDLY   (1 << 13)       // Backspace delay
55 #define BS0     (0 << 13)
56 #define BS1     (1 << 13)
57 #define VTDLY   (1 << 14)       // Vertical tab delay
58 #define VT0     (0 << 14)
59 #define VT1     (1 << 14)
60 #define FFDLY   (1 << 15)       // Form feed delay
61 #define FF0     (0 << 15)
62 #define VFF1    (1 << 15)
63
64 // c_cflag
65 #define CBAUD   (037 << 0)      // Baud speed
66 #define B0      (0 << 0)
67 #define B50     (1 << 0)
68 #define B75     (2 << 0)
69 #define B110    (3 << 0)
70 #define B134    (4 << 0)
71 #define B150    (5 << 0)
72 #define B200    (6 << 0)
73 #define B300    (7 << 0)
74 #define B600    (8 << 0)
75 #define B1200   (9 << 0)
76 #define B1800   (10 << 0)
77 #define B2400   (11 << 0)
78 #define B4800   (12 << 0)
79 #define B9600   (13 << 0)
80 #define B19200  (14 << 0)
81 #define B38400  (15 << 0)
82 #define CSIZE   (3 << 5)        // Character size mask
83 #define CS5     (0 << 5)
84 #define CS6     (1 << 5)
85 #define CS7     (2 << 5)
86 #define CS8     (3 << 5)
87 #define CSTOPB  (1 << 7)        // 1/2 stop bits
88 #define CREAD   (1 << 8)        // Enable receiver
89 #define PARENB  (1 << 9)        // Enable parity generation / checking
90 #define PARODD  (1 << 10)       // Odd parity
91 #define HUPCL   (1 << 11)       // Hang up on close
92 #define CLOCAL  (1 << 12)       // Ignore modem control lines
93 // LOBLK
94 // CIBAUD
95 // CMSPAR
96 // CRTSCTS
97
98 // c_lflag
99 #define ISIG    (1 << 0)        // Generate signals for INTR, QUIT, SUSP and DSUSP
100 #define ICANON  (1 << 1)        // Input canonical mode
101 // XCASE
102 #define ECHO    (1 << 3)        // Echo input characters
103 #define ECHOE   (1 << 4)        // Enable ERASE and WERASE on echoed input [ICANON]
104 #define ECHOK   (1 << 5)        // Enable KILL char on echoed input [ICANON]
105 #define ECHONL  (1 << 6)        // Echo NL even if ECHO is unset [ICANON]
106 #define ECHOCTL (1 << 7)        // (non-POSIX) If ECHO set specials are echoed as val+0x40 (BS=^H)
107 // ECHOPRT
108 #define ECHOKE  (1 << 9)        // (non-POSIX) KILL implimented by sequential erase [ICANON]
109 // DEFECHO
110 // FLUSHO
111 #define NOFLSH  (1 << 11)       // Disable flush of IO when generating INT, QUIT and SUSP
112 #define TOSTOP  (1 << 12)       // ?
113 // PENDIN
114 #define IEXTEN  (1 << 14)
115
116 // - Indexes for c_cc
117 enum
118 {
119         VDISCARD,
120         VDSUSP,
121         VEOF,
122         VEOL,
123         VEOL2,
124         VERASE,
125         VINTR,
126         VKILL,
127         VLNEXT,
128         VMIN,
129         VQUIT,
130         // VREPRINT, // (non-POSIX)
131         VSTART,
132         // VSTATUS, // (non-POSIX)
133         VSTOP,
134         VSUSP,
135         // VSWITCH, // (non-POSIX)
136         VTIME,
137         VWERASE,
138         NCCS
139 };
140 #define _POSIX_VDISABLE 255
141
142 struct termios
143 {
144         tcflag_t        c_iflag;
145         tcflag_t        c_oflag;
146         tcflag_t        c_cflag;
147         tcflag_t        c_lflag;
148         cc_t    c_cc[NCCS];
149 };
150
151 extern speed_t  cfgetospeed(const struct termios *termios_p);
152
153 extern int tcgetattr(int fd, struct termios *termios_p);
154
155 #define TCSANOW         0x01
156 #define TCSADRAIN       0x02
157 #define TCSAFLUSH       0x04
158 extern int tcsetattr(int fd, int optional_actions, const struct termios *termios_p);
159
160 // ioctl() calls for terminals
161 enum
162 {
163         TIOCGWINSZ,
164         TIOCSWINSZ
165 };
166
167 struct winsize {
168         unsigned short ws_row;
169         unsigned short ws_col;
170         unsigned short ws_xpixel;   /* unused */
171         unsigned short ws_ypixel;   /* unused */
172 };
173
174
175 #endif
176

UCC git Repository :: git.ucc.asn.au