termios.h 3.1 KB

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