| 56 |
return retval; |
return retval; |
| 57 |
} |
} |
| 58 |
|
|
| 59 |
int igetch() |
int igetch(int clear_buf) |
| 60 |
{ |
{ |
| 61 |
static char buf[256]; |
static char buf[256]; |
| 62 |
unsigned char c, tmp[256]; |
unsigned char c, tmp[256]; |
| 65 |
fd_set testfds; |
fd_set testfds; |
| 66 |
struct timeval timeout; |
struct timeval timeout; |
| 67 |
|
|
| 68 |
|
if (clear_buf) |
| 69 |
|
{ |
| 70 |
|
pos = 0; |
| 71 |
|
len = 0; |
| 72 |
|
|
| 73 |
|
return 0; |
| 74 |
|
} |
| 75 |
|
|
| 76 |
// Stop on system exit |
// Stop on system exit |
| 77 |
if (SYS_exit) |
if (SYS_exit) |
| 78 |
return KEY_NULL; |
return KEY_NULL; |
| 235 |
|
|
| 236 |
do |
do |
| 237 |
{ |
{ |
| 238 |
ch = igetch(); |
ch = igetch(0); |
| 239 |
} while ((ch == KEY_TIMEOUT || ch == 0xa || ch == 0x0) && (time(0) - t_begin < sec)); |
} while ((ch == KEY_TIMEOUT || ch == 0xa) && (time(0) - t_begin < sec)); |
| 240 |
|
|
| 241 |
return ch; |
return ch; |
| 242 |
} |
} |