--- lbbs/src/screen.c 2025/10/17 01:25:08 1.111 +++ lbbs/src/screen.c 2025/10/18 05:02:15 1.114 @@ -102,15 +102,32 @@ void clearscr() moveto(0, 0); } -int press_any_key() +inline int press_any_key() { + return press_any_key_ex(" \033[1;33m按任意键继续...\033[m", 60); +} + +int press_any_key_ex(const char *msg, int sec) +{ + int ch = 0; + int duration = 0; + time_t t_begin = time(NULL); + moveto(SCREEN_ROWS, 0); clrtoeol(); - prints(" \033[1;33m按任意键继续...\033[0;37m"); + prints(msg); iflush(); - return igetch_t(MIN(MAX_DELAY_TIME, 60)); + igetch_reset(); + + do + { + ch = igetch_t(sec - duration); + duration = (int)(time(NULL) - t_begin); + } while (!SYS_server_exit && ch == 0 && duration < 60); + + return ch; } void set_input_echo(int echo)