/[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.43 by sysadm, Fri Jun 13 10:51:46 2025 UTC Revision 1.46 by sysadm, Wed Jun 18 04:29:18 2025 UTC
# Line 176  int iflush(void) Line 176  int iflush(void)
176                                                  }                                                  }
177                                                  else                                                  else
178                                                  {                                                  {
179    #ifdef _DEBUG
180                                                          log_error("write(STDOUT) error (%d)\n", errno);                                                          log_error("write(STDOUT) error (%d)\n", errno);
181    #endif
182                                                          retry = 0;                                                          retry = 0;
183                                                          break;                                                          break;
184                                                  }                                                  }
# Line 333  int igetch(int timeout) Line 335  int igetch(int timeout)
335                                                  }                                                  }
336                                                  else                                                  else
337                                                  {                                                  {
338    #ifdef _DEBUG
339                                                          log_error("read(STDIN) error (%d)\n", errno);                                                          log_error("read(STDIN) error (%d)\n", errno);
340    #endif
341                                                          loop = 0;                                                          loop = 0;
342                                                          break;                                                          break;
343                                                  }                                                  }
# Line 353  int igetch(int timeout) Line 357  int igetch(int timeout)
357                  }                  }
358    
359                  // For debug                  // For debug
360                  // for (int j = pos; j < len; j++)  #ifdef _DEBUG
361                  // {                  for (int j = pos; j < len; j++)
362                  //      log_common("Debug: <--[%u]\n", (buf[j] + 256) % 256);                  {
363                  // }                          log_common("Debug: <--[%u]\n", (buf[j] + 256) % 256);
364                    }
365    #endif
366          }          }
367    
368          fcntl(STDIN_FILENO, F_SETFL, flags);          fcntl(STDIN_FILENO, F_SETFL, flags);
# Line 811  int igetch(int timeout) Line 817  int igetch(int timeout)
817          }          }
818    
819          // for debug          // for debug
820          // if (out != KEY_TIMEOUT && out != KEY_NULL)  #ifdef _DEBUG
821          // {          if (out != KEY_TIMEOUT && out != KEY_NULL)
822          //      log_common("Debug: -->[0x %x]\n", out);          {
823          // }                  log_common("Debug: -->[0x %x]\n", out);
824            }
825    #endif
826    
827          return out;          return out;
828  }  }
# Line 822  int igetch(int timeout) Line 830  int igetch(int timeout)
830  int igetch_t(int sec)  int igetch_t(int sec)
831  {  {
832          int ch;          int ch;
833          time_t t_begin = time(0);          time_t t_begin = time(NULL);
834    
835          do          do
836          {          {
837                  ch = igetch(100);                  ch = igetch(100);
838          } while (!SYS_server_exit && ch == KEY_TIMEOUT && (time(0) - t_begin < sec));          } while (!SYS_server_exit && ch == KEY_TIMEOUT && (time(NULL) - t_begin < sec));
839    
840          return ch;          return ch;
841  }  }


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

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