idlecheckpoint support in curses

This commit is contained in:
nhmall
2026-05-22 12:24:32 -04:00
parent 4c7f2dfaac
commit a1fad59f2d
2 changed files with 29 additions and 3 deletions
+1
View File
@@ -690,6 +690,7 @@ typedef unsigned char uchar;
* Currently has support in:
* WIN32CON
* Qt
* curses
*/
/* #define IDLECHECKPOINT */
+28 -3
View File
@@ -34,16 +34,41 @@ int
curses_getch(void)
{
int ch;
boolean timeoutset = FALSE;
if (iflags.debug_fuzzer)
if (iflags.debug_fuzzer) {
ch = randomkey();
else
} else if (iflags.idlecheckpoint) {
boolean done_a_checkpoint = FALSE;
done_a_checkpoint = FALSE;
timeout(IDLECHECKPOINT_WAIT_TIME * 1000);
timeoutset = TRUE;
while (1) {
ch = getch();
if (ch == ERR && !done_a_checkpoint) {
#ifdef INSURANCE
save_currentstate();
#endif /* INSURANCE */
done_a_checkpoint = TRUE;
timeout(-1);
timeoutset = FALSE;
} else {
if (timeoutset) {
timeout(-1);
timeoutset = FALSE;
}
break;
}
}
} else {
ch = getch();
}
return ch;
}
/* Read a character of input from the user */
int
curses_read_char(void)
{