/[LeafOK_CVS]/lbbs/src/io.c
ViewVC logotype

Diff of /lbbs/src/io.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.25 by sysadm, Sat May 10 15:23:42 2025 UTC Revision 1.26 by sysadm, Sun May 11 04:09:08 2025 UTC
# Line 73  int igetch(int clear_buf) Line 73  int igetch(int clear_buf)
73          int in_ascii = 0;          int in_ascii = 0;
74          int in_control = 0;          int in_control = 0;
75          int i = 0;          int i = 0;
76            int flags;
77    
78          if (clear_buf)          if (clear_buf)
79          {          {
# Line 90  int igetch(int clear_buf) Line 91  int igetch(int clear_buf)
91                  timeout.tv_sec = 0;                  timeout.tv_sec = 0;
92                  timeout.tv_usec = 100 * 1000; // 0.1 second                  timeout.tv_usec = 100 * 1000; // 0.1 second
93    
94                  ret = select(FD_SETSIZE, &testfds, NULL, NULL, &timeout);                  ret = select(STDIN_FILENO + 1, &testfds, NULL, NULL, &timeout);
95    
96                  if (ret < 0)                  if (ret < 0)
97                  {                  {
# Line 108  int igetch(int clear_buf) Line 109  int igetch(int clear_buf)
109    
110                  if (FD_ISSET(STDIN_FILENO, &testfds))                  if (FD_ISSET(STDIN_FILENO, &testfds))
111                  {                  {
112                            flags = fcntl(STDIN_FILENO, F_GETFL, 0);
113                            fcntl(socket_server, F_SETFL, flags | O_NONBLOCK);
114    
115                          len = read(STDIN_FILENO, buf, sizeof(buf));                          len = read(STDIN_FILENO, buf, sizeof(buf));
116                            if (len < 0)
117                            {
118                                    if (errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR)
119                                    {
120                                            log_error("Read socket error (%d)\n", errno);
121                                    }
122                            }
123    
124                          pos = 0;                          pos = 0;
125    
126                            fcntl(STDIN_FILENO, F_SETFL, flags);
127    
128                          break;                          break;
129                  }                  }
130    


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1