?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. /* Replacement termios.h for MinGW32.
  2.  
  3.    Copyright (C) 2008 CodeSourcery, Inc.
  4.  
  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 2 of the License, or
  8.    (at your option) any later version.
  9.  
  10.    This program is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.    GNU General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU General Public License
  16.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
  17.  
  18. #ifndef MINGW_TERMIOS_H
  19. #define MINGW_TERMIOS_H
  20.  
  21. typedef unsigned char cc_t;
  22. typedef unsigned int tcflag_t;
  23.  
  24. #define NCCS 18
  25.  
  26. struct termios
  27. {
  28.   tcflag_t c_iflag;
  29.   tcflag_t c_oflag;
  30.   tcflag_t c_cflag;
  31.   tcflag_t c_lflag;
  32.   cc_t c_cc[NCCS];
  33. };
  34.  
  35. #define VEOF 0
  36. #define VEOL 1
  37. #define VERASE 2
  38. #define VINTR 3
  39. #define VKILL 4
  40. #define VMIN 5
  41. #define VQUIT 6
  42. #define VSTART 7
  43. #define VSTOP 8
  44. #define VSUSP 9
  45. #define VTIME 10
  46. #define VEOL2 11
  47. #define VWERASE 12
  48. #define VREPRINT 13
  49. #define VLNEXT 15
  50. #define VDISCARD 16
  51.  
  52. #define _POSIX_VDISABLE '\0'
  53.  
  54. #define BRKINT 0x1
  55. #define ICRNL 0x2
  56. #define IGNBRK 0x4
  57. #define IGNCR 0x8
  58. #define IGNPAR 0x10
  59. #define INLCR 0x20
  60. #define INPCK 0x40
  61. #define ISTRIP 0x80
  62. #define IXANY 0x100
  63. #define IXOFF 0x200
  64. #define IXON 0x400
  65. #define PARMRK 0x800
  66.  
  67. #define OPOST 0x1
  68. #define ONLCR 0x2
  69. #define OCRNL 0x4
  70. #define ONOCR 0x8
  71. #define ONLRET 0x10
  72. #define OFILL 0x20
  73.  
  74. #define CSIZE 0x3
  75. #define CS5 0x0
  76. #define CS6 0x1
  77. #define CS7 0x2
  78. #define CS8 0x3
  79. #define CSTOPB 0x4
  80. #define CREAD 0x8
  81. #define PARENB 0x10
  82. #define PARODD 0x20
  83. #define HUPCL 0x40
  84. #define CLOCAL 0x80
  85.  
  86. #define ECHO 0x1
  87. #define ECHOE 0x2
  88. #define ECHOK 0x4
  89. #define ECHONL 0x8
  90. #define ICANON 0x10
  91. #define IEXTEN 0x20
  92. #define ISIG 0x40
  93. #define NOFLSH 0x80
  94. #define TOSTOP 0x100
  95. #define FLUSHO 0x200
  96.  
  97. #define TCSANOW 0
  98. #define TCSADRAIN 1
  99. #define TCSAFLUSH 2
  100.  
  101. #define TCIOFF 0
  102. #define TCION 1
  103. #define TCOOFF 2
  104. #define TCOON 3
  105.  
  106. int tcgetattr (int fd, struct termios *buf);
  107. int tcsetattr (int fd, int actions, const struct termios *buf);
  108. int tcdrain (int fd);
  109. int tcflow (int fd, int action);
  110.  
  111. /* We want to intercept TIOCGWINSZ, but not FIONREAD.  No need to forward
  112.    TIOCSWINSZ; readline only uses it to suspend if in the background.
  113.    Readline doesn't make any other ioctl calls on mingw.  */
  114.  
  115. //#include <winsock.h>
  116.  
  117. struct winsize
  118. {
  119.   unsigned short ws_row;
  120.   unsigned short ws_col;
  121. };
  122.  
  123. int mingw_getwinsize (struct winsize *window_size);
  124. #define TIOCGWINSZ 0x42424240
  125. #define TIOCSWINSZ 0x42424241
  126. #define ioctl(fd, op, arg)                              \
  127.   (((op) == TIOCGWINSZ) ? mingw_getwinsize (arg)        \
  128.    : ((op) == TIOCSWINSZ) ? -1                          \
  129.    : ioctlsocket (fd, op, arg))
  130.  
  131. #endif /* MINGW_TERMIOS_H */
  132.