430 |
|
|
431 |
|
WINDOW *window; |
432 |
|
|
433 |
– |
int stdin_fileno; |
434 |
– |
fd_set infds; |
435 |
– |
struct timeval timeout; |
436 |
– |
|
433 |
|
extern int errno; |
434 |
|
char ch; |
435 |
|
|
472 |
|
nonl(); |
473 |
|
cbreak(); |
474 |
|
noecho(); |
475 |
+ |
timeout(delay * 1000); |
476 |
|
window=newwin(0, 0, 0, 0); |
477 |
|
clear(); |
478 |
|
|
483 |
|
} |
484 |
|
|
485 |
|
display_headings(); |
489 |
– |
stdin_fileno=fileno(stdin); |
486 |
|
|
487 |
|
for(;;){ |
488 |
< |
|
489 |
< |
FD_ZERO(&infds); |
490 |
< |
FD_SET(stdin_fileno, &infds); |
491 |
< |
timeout.tv_sec = delay; |
496 |
< |
timeout.tv_usec = 0; |
497 |
< |
|
498 |
< |
if((select((stdin_fileno+1), &infds, NULL, NULL, &timeout)) == -1){ |
499 |
< |
if(errno!=EINTR){ |
500 |
< |
perror("select failed"); |
501 |
< |
exit(1); |
502 |
< |
} |
503 |
< |
} |
504 |
< |
|
505 |
< |
if(FD_ISSET(stdin_fileno, &infds)){ |
506 |
< |
ch=getch(); |
507 |
< |
if (ch == 'q'){ |
508 |
< |
endwin(); |
509 |
< |
return 0; |
510 |
< |
} |
488 |
> |
ch = getch(); |
489 |
> |
if (ch == 'q'){ |
490 |
> |
endwin(); |
491 |
> |
return 0; |
492 |
|
} |
493 |
|
|
494 |
|
get_stats(); |