/[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.41 by sysadm, Mon Jun 9 15:39:05 2025 UTC Revision 1.45 by sysadm, Tue Jun 17 13:25:49 2025 UTC
# Line 91  int outc(char c) Line 91  int outc(char c)
91          return ret;          return ret;
92  }  }
93    
94  int iflush()  int iflush(void)
95  {  {
96          int flags;          int flags;
97          struct epoll_event ev, events[MAX_EVENTS];          struct epoll_event ev, events[MAX_EVENTS];
# Line 353  int igetch(int timeout) Line 353  int igetch(int timeout)
353                  }                  }
354    
355                  // For debug                  // For debug
356                  // for (int j = pos; j < len; j++)  #ifdef _DEBUG
357                  // {                  for (int j = pos; j < len; j++)
358                  //      log_common("Debug: <--[%u]\n", (buf[j] + 256) % 256);                  {
359                  // }                          log_common("Debug: <--[%u]\n", (buf[j] + 256) % 256);
360                    }
361    #endif
362          }          }
363    
364          fcntl(STDIN_FILENO, F_SETFL, flags);          fcntl(STDIN_FILENO, F_SETFL, flags);
# Line 534  int igetch(int timeout) Line 536  int igetch(int timeout)
536                                  case 49:                                  case 49:
537                                          out = KEY_HOME;                                          out = KEY_HOME;
538                                          break;                                          break;
539                                    case 50:
540                                            out = KEY_INS;
541                                            break;
542                                  case 51:                                  case 51:
543                                          out = KEY_DEL;                                          out = KEY_DEL;
544                                          break;                                          break;
# Line 808  int igetch(int timeout) Line 813  int igetch(int timeout)
813          }          }
814    
815          // for debug          // for debug
816          // if (out != KEY_TIMEOUT && out != KEY_NULL)  #ifdef _DEBUG
817          // {          if (out != KEY_TIMEOUT && out != KEY_NULL)
818          //      log_common("Debug: -->[0x %x]\n", out);          {
819          // }                  log_common("Debug: -->[0x %x]\n", out);
820            }
821    #endif
822    
823          return out;          return out;
824  }  }
# Line 819  int igetch(int timeout) Line 826  int igetch(int timeout)
826  int igetch_t(int sec)  int igetch_t(int sec)
827  {  {
828          int ch;          int ch;
829          time_t t_begin = time(0);          time_t t_begin = time(NULL);
830    
831          do          do
832          {          {
833                  ch = igetch(100);                  ch = igetch(100);
834          } while (!SYS_server_exit && ch == KEY_TIMEOUT && (time(0) - t_begin < sec));          } while (!SYS_server_exit && ch == KEY_TIMEOUT && (time(NULL) - t_begin < sec));
835    
836          return ch;          return ch;
837  }  }


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

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