}
#endif /* THREADED_CLIENT */
-static void do_keepalive(void)
+/* I changed this from static to not because I need to call it from
+ screen.c, either that or make something in screen.c not static.
+ Fix it how you like. Why all the staticness? stu */
+
+void do_keepalive(void)
{
time_t now;
int inkey(void)
{ /* get a character from the keyboard, with */
int a; /* the watchdog timer in effect if necessary */
+#ifndef HAVE_CURSES_H /* avoid compiler warning */
fd_set rfds;
struct timeval tv;
- time_t start_time, now;
+#endif
+ time_t start_time;
scr_flush();
lines_printed = 0;
time(&start_time);
do {
-
+#ifdef HAVE_CURSES_H /* IO, maybe you wanna move this to screen.c */
+ a = scr_blockread();
+#else
/* This loop waits for keyboard input. If the keepalive
* timer expires, it sends a keepalive to the server if
* necessary and then waits again.
tv.tv_sec = S_KEEPALIVE;
tv.tv_usec = 0;
- time(&now);
select(1, &rfds, NULL, NULL, &tv);
} while (!FD_ISSET(0, &rfds));
-
-
-
/* At this point, there's input, so fetch it.
* (There's a hole in the bucket...)
*/
a = scr_getc();
+#endif
+
+
if (a == 127)
a = 8;
if (a > 126)
extern void check_screen_dims(void);
#endif
+void do_keepalive(void);
+
/*
* status_line() is a convenience function for writing a "typical"
int scr_getc(void)
{
#ifdef HAVE_CURSES_H
+ /* This looks scary, the program will hang if mainwindow is null */
if (mainwindow)
return wgetch(mainwindow);
#endif
return getchar();
}
-
+int scr_blockread(void)
+ {
+ int a;
+ wtimeout(mainwindow, S_KEEPALIVE);
+ while (1)
+ {
+ do_keepalive();
+ a = wgetch(mainwindow); /* will block for food */
+ if (a != ERR)
+ break;
+ /* a = scr_getc(); */
+ }
+ return a;
+ }
/*
* scr_putc() outputs a single character