| 1 |
/* |
| 2 |
* Copyright (c) 2002-2016, the original author or authors. |
| 3 |
* |
| 4 |
* This software is distributable under the BSD license. See the terms of the |
| 5 |
* BSD license in the documentation provided with this software. |
| 6 |
* |
| 7 |
* http://www.opensource.org/licenses/bsd-license.php |
| 8 |
*/ |
| 9 |
package org.jline.terminal.impl.jna.osx; |
| 10 |
|
| 11 |
import java.util.Arrays; |
| 12 |
import java.util.EnumMap; |
| 13 |
import java.util.EnumSet; |
| 14 |
import java.util.List; |
| 15 |
|
| 16 |
import com.sun.jna.LastErrorException; |
| 17 |
import com.sun.jna.NativeLong; |
| 18 |
import com.sun.jna.Structure; |
| 19 |
import org.jline.terminal.Attributes; |
| 20 |
import org.jline.terminal.Attributes.ControlChar; |
| 21 |
import org.jline.terminal.Attributes.ControlFlag; |
| 22 |
import org.jline.terminal.Attributes.InputFlag; |
| 23 |
import org.jline.terminal.Attributes.LocalFlag; |
| 24 |
import org.jline.terminal.Attributes.OutputFlag; |
| 25 |
import org.jline.terminal.Size; |
| 26 |
|
| 27 |
public interface CLibrary extends com.sun.jna.Library { |
| 28 |
|
| 29 |
void tcgetattr(int fd, termios termios) throws LastErrorException; |
| 30 |
|
| 31 |
void tcsetattr(int fd, int cmd, termios termios) throws LastErrorException; |
| 32 |
|
| 33 |
void ioctl(int fd, NativeLong cmd, winsize data) throws LastErrorException; |
| 34 |
|
| 35 |
void ttyname_r(int fd, byte[] buf, int len) throws LastErrorException; |
| 36 |
|
| 37 |
void openpty(int[] master, int[] slave, byte[] name, termios t, winsize s) throws LastErrorException; |
| 38 |
|
| 39 |
class winsize extends Structure { |
| 40 |
public short ws_row; |
| 41 |
public short ws_col; |
| 42 |
public short ws_xpixel; |
| 43 |
public short ws_ypixel; |
| 44 |
|
| 45 |
public winsize() { |
| 46 |
} |
| 47 |
|
| 48 |
public winsize(Size ws) { |
| 49 |
ws_row = (short) ws.getRows(); |
| 50 |
ws_col = (short) ws.getColumns(); |
| 51 |
} |
| 52 |
|
| 53 |
public Size toSize() { |
| 54 |
return new Size(ws_col, ws_row); |
| 55 |
} |
| 56 |
|
| 57 |
@Override |
| 58 |
protected List<String> getFieldOrder() { |
| 59 |
return Arrays.asList(// |
| 60 |
"ws_row",// |
| 61 |
"ws_col",// |
| 62 |
"ws_xpixel",// |
| 63 |
"ws_ypixel"// |
| 64 |
); |
| 65 |
} |
| 66 |
|
| 67 |
} |
| 68 |
|
| 69 |
class termios extends Structure { |
| 70 |
|
| 71 |
public NativeLong c_iflag; |
| 72 |
public NativeLong c_oflag; |
| 73 |
public NativeLong c_cflag; |
| 74 |
public NativeLong c_lflag; |
| 75 |
public byte[] c_cc = new byte[20]; |
| 76 |
public NativeLong c_ispeed; |
| 77 |
public NativeLong c_ospeed; |
| 78 |
|
| 79 |
@Override |
| 80 |
protected List<String> getFieldOrder() { |
| 81 |
return Arrays.asList(// |
| 82 |
"c_iflag",// |
| 83 |
"c_oflag",// |
| 84 |
"c_cflag",// |
| 85 |
"c_lflag",// |
| 86 |
"c_cc",// |
| 87 |
"c_ispeed",// |
| 88 |
"c_ospeed"// |
| 89 |
); |
| 90 |
} |
| 91 |
|
| 92 |
public termios() { |
| 93 |
} |
| 94 |
|
| 95 |
public termios(Attributes t) { |
| 96 |
// Input flags |
| 97 |
setFlag(t.getInputFlag(InputFlag.IGNBRK), IGNBRK, c_iflag); |
| 98 |
setFlag(t.getInputFlag(InputFlag.BRKINT), BRKINT, c_iflag); |
| 99 |
setFlag(t.getInputFlag(InputFlag.IGNPAR), IGNPAR, c_iflag); |
| 100 |
setFlag(t.getInputFlag(InputFlag.PARMRK), PARMRK, c_iflag); |
| 101 |
setFlag(t.getInputFlag(InputFlag.INPCK), INPCK, c_iflag); |
| 102 |
setFlag(t.getInputFlag(InputFlag.ISTRIP), ISTRIP, c_iflag); |
| 103 |
setFlag(t.getInputFlag(InputFlag.INLCR), INLCR, c_iflag); |
| 104 |
setFlag(t.getInputFlag(InputFlag.IGNCR), IGNCR, c_iflag); |
| 105 |
setFlag(t.getInputFlag(InputFlag.ICRNL), ICRNL, c_iflag); |
| 106 |
setFlag(t.getInputFlag(InputFlag.IXON), IXON, c_iflag); |
| 107 |
setFlag(t.getInputFlag(InputFlag.IXOFF), IXOFF, c_iflag); |
| 108 |
setFlag(t.getInputFlag(InputFlag.IXANY), IXANY, c_iflag); |
| 109 |
setFlag(t.getInputFlag(InputFlag.IMAXBEL), IMAXBEL, c_iflag); |
| 110 |
setFlag(t.getInputFlag(InputFlag.IUTF8), IUTF8, c_iflag); |
| 111 |
// Output flags |
| 112 |
setFlag(t.getOutputFlag(OutputFlag.OPOST), OPOST, c_oflag); |
| 113 |
setFlag(t.getOutputFlag(OutputFlag.ONLCR), ONLCR, c_oflag); |
| 114 |
setFlag(t.getOutputFlag(OutputFlag.OXTABS), OXTABS, c_oflag); |
| 115 |
setFlag(t.getOutputFlag(OutputFlag.ONOEOT), ONOEOT, c_oflag); |
| 116 |
setFlag(t.getOutputFlag(OutputFlag.OCRNL), OCRNL, c_oflag); |
| 117 |
setFlag(t.getOutputFlag(OutputFlag.ONOCR), ONOCR, c_oflag); |
| 118 |
setFlag(t.getOutputFlag(OutputFlag.ONLRET), ONLRET, c_oflag); |
| 119 |
setFlag(t.getOutputFlag(OutputFlag.OFILL), OFILL, c_oflag); |
| 120 |
setFlag(t.getOutputFlag(OutputFlag.NLDLY), NLDLY, c_oflag); |
| 121 |
setFlag(t.getOutputFlag(OutputFlag.TABDLY), TABDLY, c_oflag); |
| 122 |
setFlag(t.getOutputFlag(OutputFlag.CRDLY), CRDLY, c_oflag); |
| 123 |
setFlag(t.getOutputFlag(OutputFlag.FFDLY), FFDLY, c_oflag); |
| 124 |
setFlag(t.getOutputFlag(OutputFlag.BSDLY), BSDLY, c_oflag); |
| 125 |
setFlag(t.getOutputFlag(OutputFlag.VTDLY), VTDLY, c_oflag); |
| 126 |
setFlag(t.getOutputFlag(OutputFlag.OFDEL), OFDEL, c_oflag); |
| 127 |
// Control flags |
| 128 |
setFlag(t.getControlFlag(ControlFlag.CIGNORE), CIGNORE, c_cflag); |
| 129 |
setFlag(t.getControlFlag(ControlFlag.CS5), CS5, c_cflag); |
| 130 |
setFlag(t.getControlFlag(ControlFlag.CS6), CS6, c_cflag); |
| 131 |
setFlag(t.getControlFlag(ControlFlag.CS7), CS7, c_cflag); |
| 132 |
setFlag(t.getControlFlag(ControlFlag.CS8), CS8, c_cflag); |
| 133 |
setFlag(t.getControlFlag(ControlFlag.CSTOPB), CSTOPB, c_cflag); |
| 134 |
setFlag(t.getControlFlag(ControlFlag.CREAD), CREAD, c_cflag); |
| 135 |
setFlag(t.getControlFlag(ControlFlag.PARENB), PARENB, c_cflag); |
| 136 |
setFlag(t.getControlFlag(ControlFlag.PARODD), PARODD, c_cflag); |
| 137 |
setFlag(t.getControlFlag(ControlFlag.HUPCL), HUPCL, c_cflag); |
| 138 |
setFlag(t.getControlFlag(ControlFlag.CLOCAL), CLOCAL, c_cflag); |
| 139 |
setFlag(t.getControlFlag(ControlFlag.CCTS_OFLOW), CCTS_OFLOW, c_cflag); |
| 140 |
setFlag(t.getControlFlag(ControlFlag.CRTS_IFLOW), CRTS_IFLOW, c_cflag); |
| 141 |
setFlag(t.getControlFlag(ControlFlag.CDTR_IFLOW), CDTR_IFLOW, c_cflag); |
| 142 |
setFlag(t.getControlFlag(ControlFlag.CDSR_OFLOW), CDSR_OFLOW, c_cflag); |
| 143 |
setFlag(t.getControlFlag(ControlFlag.CCAR_OFLOW), CCAR_OFLOW, c_cflag); |
| 144 |
// Local flags |
| 145 |
setFlag(t.getLocalFlag(LocalFlag.ECHOKE), ECHOKE, c_lflag); |
| 146 |
setFlag(t.getLocalFlag(LocalFlag.ECHOE), ECHOE, c_lflag); |
| 147 |
setFlag(t.getLocalFlag(LocalFlag.ECHOK), ECHOK, c_lflag); |
| 148 |
setFlag(t.getLocalFlag(LocalFlag.ECHO), ECHO, c_lflag); |
| 149 |
setFlag(t.getLocalFlag(LocalFlag.ECHONL), ECHONL, c_lflag); |
| 150 |
setFlag(t.getLocalFlag(LocalFlag.ECHOPRT), ECHOPRT, c_lflag); |
| 151 |
setFlag(t.getLocalFlag(LocalFlag.ECHOCTL), ECHOCTL, c_lflag); |
| 152 |
setFlag(t.getLocalFlag(LocalFlag.ISIG), ISIG, c_lflag); |
| 153 |
setFlag(t.getLocalFlag(LocalFlag.ICANON), ICANON, c_lflag); |
| 154 |
setFlag(t.getLocalFlag(LocalFlag.ALTWERASE), ALTWERASE, c_lflag); |
| 155 |
setFlag(t.getLocalFlag(LocalFlag.IEXTEN), IEXTEN, c_lflag); |
| 156 |
setFlag(t.getLocalFlag(LocalFlag.EXTPROC), EXTPROC, c_lflag); |
| 157 |
setFlag(t.getLocalFlag(LocalFlag.TOSTOP), TOSTOP, c_lflag); |
| 158 |
setFlag(t.getLocalFlag(LocalFlag.FLUSHO), FLUSHO, c_lflag); |
| 159 |
setFlag(t.getLocalFlag(LocalFlag.NOKERNINFO), NOKERNINFO, c_lflag); |
| 160 |
setFlag(t.getLocalFlag(LocalFlag.PENDIN), PENDIN, c_lflag); |
| 161 |
setFlag(t.getLocalFlag(LocalFlag.NOFLSH), NOFLSH, c_lflag); |
| 162 |
// Control chars |
| 163 |
c_cc[VEOF] = (byte) t.getControlChar(ControlChar.VEOF); |
| 164 |
c_cc[VEOL] = (byte) t.getControlChar(ControlChar.VEOL); |
| 165 |
c_cc[VEOL2] = (byte) t.getControlChar(ControlChar.VEOL2); |
| 166 |
c_cc[VERASE] = (byte) t.getControlChar(ControlChar.VERASE); |
| 167 |
c_cc[VWERASE] = (byte) t.getControlChar(ControlChar.VWERASE); |
| 168 |
c_cc[VKILL] = (byte) t.getControlChar(ControlChar.VKILL); |
| 169 |
c_cc[VREPRINT] = (byte) t.getControlChar(ControlChar.VREPRINT); |
| 170 |
c_cc[VINTR] = (byte) t.getControlChar(ControlChar.VINTR); |
| 171 |
c_cc[VQUIT] = (byte) t.getControlChar(ControlChar.VQUIT); |
| 172 |
c_cc[VSUSP] = (byte) t.getControlChar(ControlChar.VSUSP); |
| 173 |
c_cc[VDSUSP] = (byte) t.getControlChar(ControlChar.VDSUSP); |
| 174 |
c_cc[VSTART] = (byte) t.getControlChar(ControlChar.VSTART); |
| 175 |
c_cc[VSTOP] = (byte) t.getControlChar(ControlChar.VSTOP); |
| 176 |
c_cc[VLNEXT] = (byte) t.getControlChar(ControlChar.VLNEXT); |
| 177 |
c_cc[VDISCARD] = (byte) t.getControlChar(ControlChar.VDISCARD); |
| 178 |
c_cc[VMIN] = (byte) t.getControlChar(ControlChar.VMIN); |
| 179 |
c_cc[VTIME] = (byte) t.getControlChar(ControlChar.VTIME); |
| 180 |
c_cc[VSTATUS] = (byte) t.getControlChar(ControlChar.VSTATUS); |
| 181 |
} |
| 182 |
|
| 183 |
private void setFlag(boolean flag, long value, NativeLong org) { |
| 184 |
org.setValue(flag ? org.longValue() | value : org.longValue()); |
| 185 |
} |
| 186 |
|
| 187 |
public Attributes toAttributes() { |
| 188 |
Attributes attr = new Attributes(); |
| 189 |
// Input flags |
| 190 |
EnumSet<InputFlag> iflag = attr.getInputFlags(); |
| 191 |
addFlag(c_iflag.longValue(), iflag, InputFlag.IGNBRK, IGNBRK); |
| 192 |
addFlag(c_iflag.longValue(), iflag, InputFlag.IGNBRK, IGNBRK); |
| 193 |
addFlag(c_iflag.longValue(), iflag, InputFlag.BRKINT, BRKINT); |
| 194 |
addFlag(c_iflag.longValue(), iflag, InputFlag.IGNPAR, IGNPAR); |
| 195 |
addFlag(c_iflag.longValue(), iflag, InputFlag.PARMRK, PARMRK); |
| 196 |
addFlag(c_iflag.longValue(), iflag, InputFlag.INPCK, INPCK); |
| 197 |
addFlag(c_iflag.longValue(), iflag, InputFlag.ISTRIP, ISTRIP); |
| 198 |
addFlag(c_iflag.longValue(), iflag, InputFlag.INLCR, INLCR); |
| 199 |
addFlag(c_iflag.longValue(), iflag, InputFlag.IGNCR, IGNCR); |
| 200 |
addFlag(c_iflag.longValue(), iflag, InputFlag.ICRNL, ICRNL); |
| 201 |
addFlag(c_iflag.longValue(), iflag, InputFlag.IXON, IXON); |
| 202 |
addFlag(c_iflag.longValue(), iflag, InputFlag.IXOFF, IXOFF); |
| 203 |
addFlag(c_iflag.longValue(), iflag, InputFlag.IXANY, IXANY); |
| 204 |
addFlag(c_iflag.longValue(), iflag, InputFlag.IMAXBEL, IMAXBEL); |
| 205 |
addFlag(c_iflag.longValue(), iflag, InputFlag.IUTF8, IUTF8); |
| 206 |
// Output flags |
| 207 |
EnumSet<OutputFlag> oflag = attr.getOutputFlags(); |
| 208 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.OPOST, OPOST); |
| 209 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.ONLCR, ONLCR); |
| 210 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.OXTABS, OXTABS); |
| 211 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.ONOEOT, ONOEOT); |
| 212 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.OCRNL, OCRNL); |
| 213 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.ONOCR, ONOCR); |
| 214 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.ONLRET, ONLRET); |
| 215 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.OFILL, OFILL); |
| 216 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.NLDLY, NLDLY); |
| 217 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.TABDLY, TABDLY); |
| 218 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.CRDLY, CRDLY); |
| 219 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.FFDLY, FFDLY); |
| 220 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.BSDLY, BSDLY); |
| 221 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.VTDLY, VTDLY); |
| 222 |
addFlag(c_oflag.longValue(), oflag, OutputFlag.OFDEL, OFDEL); |
| 223 |
// Control flags |
| 224 |
EnumSet<ControlFlag> cflag = attr.getControlFlags(); |
| 225 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.CIGNORE, CIGNORE); |
| 226 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.CS5, CS5); |
| 227 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.CS6, CS6); |
| 228 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.CS7, CS7); |
| 229 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.CS8, CS8); |
| 230 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.CSTOPB, CSTOPB); |
| 231 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.CREAD, CREAD); |
| 232 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.PARENB, PARENB); |
| 233 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.PARODD, PARODD); |
| 234 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.HUPCL, HUPCL); |
| 235 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.CLOCAL, CLOCAL); |
| 236 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.CCTS_OFLOW, CCTS_OFLOW); |
| 237 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.CRTS_IFLOW, CRTS_IFLOW); |
| 238 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.CDSR_OFLOW, CDSR_OFLOW); |
| 239 |
addFlag(c_cflag.longValue(), cflag, ControlFlag.CCAR_OFLOW, CCAR_OFLOW); |
| 240 |
// Local flags |
| 241 |
EnumSet<LocalFlag> lflag = attr.getLocalFlags(); |
| 242 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.ECHOKE, ECHOKE); |
| 243 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.ECHOE, ECHOE); |
| 244 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.ECHOK, ECHOK); |
| 245 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.ECHO, ECHO); |
| 246 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.ECHONL, ECHONL); |
| 247 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.ECHOPRT, ECHOPRT); |
| 248 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.ECHOCTL, ECHOCTL); |
| 249 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.ISIG, ISIG); |
| 250 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.ICANON, ICANON); |
| 251 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.ALTWERASE, ALTWERASE); |
| 252 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.IEXTEN, IEXTEN); |
| 253 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.EXTPROC, EXTPROC); |
| 254 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.TOSTOP, TOSTOP); |
| 255 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.FLUSHO, FLUSHO); |
| 256 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.NOKERNINFO, NOKERNINFO); |
| 257 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.PENDIN, PENDIN); |
| 258 |
addFlag(c_lflag.longValue(), lflag, LocalFlag.NOFLSH, NOFLSH); |
| 259 |
// Control chars |
| 260 |
EnumMap<ControlChar, Integer> cc = attr.getControlChars(); |
| 261 |
cc.put(ControlChar.VEOF, (int) c_cc[VEOF]); |
| 262 |
cc.put(ControlChar.VEOL, (int) c_cc[VEOL]); |
| 263 |
cc.put(ControlChar.VEOL2, (int) c_cc[VEOL2]); |
| 264 |
cc.put(ControlChar.VERASE, (int) c_cc[VERASE]); |
| 265 |
cc.put(ControlChar.VWERASE, (int) c_cc[VWERASE]); |
| 266 |
cc.put(ControlChar.VKILL, (int) c_cc[VKILL]); |
| 267 |
cc.put(ControlChar.VREPRINT, (int) c_cc[VREPRINT]); |
| 268 |
cc.put(ControlChar.VINTR, (int) c_cc[VINTR]); |
| 269 |
cc.put(ControlChar.VQUIT, (int) c_cc[VQUIT]); |
| 270 |
cc.put(ControlChar.VSUSP, (int) c_cc[VSUSP]); |
| 271 |
cc.put(ControlChar.VDSUSP, (int) c_cc[VDSUSP]); |
| 272 |
cc.put(ControlChar.VSTART, (int) c_cc[VSTART]); |
| 273 |
cc.put(ControlChar.VSTOP, (int) c_cc[VSTOP]); |
| 274 |
cc.put(ControlChar.VLNEXT, (int) c_cc[VLNEXT]); |
| 275 |
cc.put(ControlChar.VDISCARD, (int) c_cc[VDISCARD]); |
| 276 |
cc.put(ControlChar.VMIN, (int) c_cc[VMIN]); |
| 277 |
cc.put(ControlChar.VTIME, (int) c_cc[VTIME]); |
| 278 |
cc.put(ControlChar.VSTATUS, (int) c_cc[VSTATUS]); |
| 279 |
// Return |
| 280 |
return attr; |
| 281 |
} |
| 282 |
|
| 283 |
private <T extends Enum<T>> void addFlag(long value, EnumSet<T> flags, T flag, int v) { |
| 284 |
if ((value & v) != 0) { |
| 285 |
flags.add(flag); |
| 286 |
} |
| 287 |
} |
| 288 |
} |
| 289 |
|
| 290 |
// CONSTANTS |
| 291 |
|
| 292 |
long TIOCGWINSZ = 0x40087468L; |
| 293 |
long TIOCSWINSZ = 0x80087467L; |
| 294 |
|
| 295 |
int TCSANOW = 0x00000000; |
| 296 |
|
| 297 |
int VEOF = 0; |
| 298 |
int VEOL = 1; |
| 299 |
int VEOL2 = 2; |
| 300 |
int VERASE = 3; |
| 301 |
int VWERASE = 4; |
| 302 |
int VKILL = 5; |
| 303 |
int VREPRINT = 6; |
| 304 |
int VINTR = 8; |
| 305 |
int VQUIT = 9; |
| 306 |
int VSUSP = 10; |
| 307 |
int VDSUSP = 11; |
| 308 |
int VSTART = 12; |
| 309 |
int VSTOP = 13; |
| 310 |
int VLNEXT = 14; |
| 311 |
int VDISCARD = 15; |
| 312 |
int VMIN = 16; |
| 313 |
int VTIME = 17; |
| 314 |
int VSTATUS = 18; |
| 315 |
|
| 316 |
int IGNBRK = 0x00000001; |
| 317 |
int BRKINT = 0x00000002; |
| 318 |
int IGNPAR = 0x00000004; |
| 319 |
int PARMRK = 0x00000008; |
| 320 |
int INPCK = 0x00000010; |
| 321 |
int ISTRIP = 0x00000020; |
| 322 |
int INLCR = 0x00000040; |
| 323 |
int IGNCR = 0x00000080; |
| 324 |
int ICRNL = 0x00000100; |
| 325 |
int IXON = 0x00000200; |
| 326 |
int IXOFF = 0x00000400; |
| 327 |
int IXANY = 0x00000800; |
| 328 |
int IMAXBEL = 0x00002000; |
| 329 |
int IUTF8 = 0x00004000; |
| 330 |
|
| 331 |
int OPOST = 0x00000001; |
| 332 |
int ONLCR = 0x00000002; |
| 333 |
int OXTABS = 0x00000004; |
| 334 |
int ONOEOT = 0x00000008; |
| 335 |
int OCRNL = 0x00000010; |
| 336 |
int ONOCR = 0x00000020; |
| 337 |
int ONLRET = 0x00000040; |
| 338 |
int OFILL = 0x00000080; |
| 339 |
int NLDLY = 0x00000300; |
| 340 |
int TABDLY = 0x00000c04; |
| 341 |
int CRDLY = 0x00003000; |
| 342 |
int FFDLY = 0x00004000; |
| 343 |
int BSDLY = 0x00008000; |
| 344 |
int VTDLY = 0x00010000; |
| 345 |
int OFDEL = 0x00020000; |
| 346 |
|
| 347 |
int CIGNORE = 0x00000001; |
| 348 |
int CS5 = 0x00000000; |
| 349 |
int CS6 = 0x00000100; |
| 350 |
int CS7 = 0x00000200; |
| 351 |
int CS8 = 0x00000300; |
| 352 |
int CSTOPB = 0x00000400; |
| 353 |
int CREAD = 0x00000800; |
| 354 |
int PARENB = 0x00001000; |
| 355 |
int PARODD = 0x00002000; |
| 356 |
int HUPCL = 0x00004000; |
| 357 |
int CLOCAL = 0x00008000; |
| 358 |
int CCTS_OFLOW = 0x00010000; |
| 359 |
int CRTS_IFLOW = 0x00020000; |
| 360 |
int CDTR_IFLOW = 0x00040000; |
| 361 |
int CDSR_OFLOW = 0x00080000; |
| 362 |
int CCAR_OFLOW = 0x00100000; |
| 363 |
|
| 364 |
int ECHOKE = 0x00000001; |
| 365 |
int ECHOE = 0x00000002; |
| 366 |
int ECHOK = 0x00000004; |
| 367 |
int ECHO = 0x00000008; |
| 368 |
int ECHONL = 0x00000010; |
| 369 |
int ECHOPRT = 0x00000020; |
| 370 |
int ECHOCTL = 0x00000040; |
| 371 |
int ISIG = 0x00000080; |
| 372 |
int ICANON = 0x00000100; |
| 373 |
int ALTWERASE = 0x00000200; |
| 374 |
int IEXTEN = 0x00000400; |
| 375 |
int EXTPROC = 0x00000800; |
| 376 |
int TOSTOP = 0x00400000; |
| 377 |
int FLUSHO = 0x00800000; |
| 378 |
int NOKERNINFO = 0x02000000; |
| 379 |
int PENDIN = 0x20000000; |
| 380 |
int NOFLSH = 0x80000000; |
| 381 |
|
| 382 |
} |