termios.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #pragma lib "/$M/lib/ape/libap.a"
  2. /* input modes */
  3. #define BRKINT 0x001
  4. #define ICRNL 0x002
  5. #define IGNBRK 0x004
  6. #define IGNCR 0x008
  7. #define IGNPAR 0x010
  8. #define INLCR 0x020
  9. #define INPCK 0x040
  10. #define ISTRIP 0x080
  11. #define IXOFF 0x100
  12. #define IXON 0x200
  13. #define PARMRK 0x400
  14. /* output modes: ONLCR, TAB3 are an extension to POSIX! */
  15. #define OPOST 0000001
  16. #define OLCUC 0000002
  17. #define ONLCR 0000004
  18. #define OCRNL 0000010
  19. #define ONOCR 0000020
  20. #define ONLRET 0000040
  21. #define OFILL 0000100
  22. #define OFDEL 0000200
  23. #define NLDLY 0000400
  24. #define NL0 0
  25. #define NL1 0000400
  26. #define CRDLY 0003000
  27. #define CR0 0
  28. #define CR1 0001000
  29. #define CR2 0002000
  30. #define CR3 0003000
  31. #define TABDLY 0014000
  32. #define TAB0 0
  33. #define TAB1 0004000
  34. #define TAB2 0010000
  35. #define TAB3 0014000
  36. #define BSDLY 0020000
  37. #define BS0 0
  38. #define BS1 0020000
  39. #define VTDLY 0040000
  40. #define VT0 0
  41. #define VT1 0040000
  42. #define FFDLY 0100000
  43. #define FF0 0
  44. #define FF1 0100000
  45. /* control modes */
  46. #define CLOCAL 0x001
  47. #define CREAD 0x002
  48. #define CSIZE 0x01C
  49. #define CS5 0x004
  50. #define CS6 0x008
  51. #define CS7 0x00C
  52. #define CS8 0x010
  53. #define CSTOPB 0x020
  54. #define HUPCL 0x040
  55. #define PARENB 0x080
  56. #define PARODD 0x100
  57. /* local modes */
  58. #define ECHO 0x001
  59. #define ECHOE 0x002
  60. #define ECHOK 0x004
  61. #define ECHONL 0x008
  62. #define ICANON 0x010
  63. #define IEXTEN 0x020
  64. #define ISIG 0x040
  65. #define NOFLSH 0x080
  66. #define TOSTOP 0x100
  67. /* control characters */
  68. #define VEOF 0
  69. #define VEOL 1
  70. #define VERASE 2
  71. #define VINTR 3
  72. #define VKILL 4
  73. #define VMIN 5
  74. #define VQUIT 6
  75. #define VSUSP 7
  76. #define VTIME 8
  77. #define VSTART 9
  78. #define VSTOP 10
  79. #define NCCS 11
  80. /* baud rates */
  81. #define B0 0
  82. #define B50 1
  83. #define B75 2
  84. #define B110 3
  85. #define B134 4
  86. #define B150 5
  87. #define B200 6
  88. #define B300 7
  89. #define B600 8
  90. #define B1200 9
  91. #define B1800 10
  92. #define B2400 11
  93. #define B4800 12
  94. #define B9600 13
  95. #define B19200 14
  96. #define B38400 15
  97. /* optional actions for tcsetattr */
  98. #define TCSANOW 1
  99. #define TCSADRAIN 2
  100. #define TCSAFLUSH 3
  101. typedef unsigned long tcflag_t;
  102. typedef unsigned long speed_t;
  103. typedef unsigned char cc_t;
  104. struct termios {
  105. tcflag_t c_iflag; /* input modes */
  106. tcflag_t c_oflag; /* output modes */
  107. tcflag_t c_cflag; /* control modes */
  108. tcflag_t c_lflag; /* local modes */
  109. cc_t c_cc[NCCS]; /* control characters */
  110. };
  111. extern speed_t cfgetospeed(const struct termios *);
  112. extern int cfsetospeed(struct termios *, speed_t);
  113. extern speed_t cfgetispeed(const struct termios *);
  114. extern int cfsetispeed(struct termios *, speed_t);
  115. extern int tcgetattr(int, struct termios *);
  116. extern int tcsetattr(int, int, const struct termios *);
  117. #ifdef __TYPES_H
  118. extern pid_t tcgetpgrp(int);
  119. extern int tcsetpgrp(int, pid_t);
  120. #endif
  121. extern int tcdrain(int);
  122. extern int tcflush(int, int);
  123. extern int tcflow(int, int);