ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/saidar/saidar.c
(Generate patch)

Comparing projects/libstatgrab/src/saidar/saidar.c (file contents):
Revision 1.13 by tdb, Wed Oct 22 13:07:22 2003 UTC vs.
Revision 1.16 by ats, Fri Nov 7 18:28:05 2003 UTC

# Line 430 | Line 430 | int main(int argc, char **argv){
430  
431          WINDOW *window;
432  
433        int stdin_fileno;
434        fd_set infds;
435        struct timeval timeout;
436
433          extern int errno;
438        char ch;
434  
435          int delay=2;
436   #ifdef ALLBSD
# Line 449 | Line 444 | int main(int argc, char **argv){
444          }
445   #endif
446                  
447 <        while ((c = getopt(argc, argv, "vhd:")) != EOF){
447 >        while ((c = getopt(argc, argv, "vhd:")) != -1){
448                  switch (c){
449                          case 'd':
450                                  delay = atoi(optarg);
# Line 476 | Line 471 | int main(int argc, char **argv){
471          nonl();
472          cbreak();
473          noecho();
474 +        timeout(delay * 1000);
475          window=newwin(0, 0, 0, 0);
476          clear();
477  
# Line 486 | Line 482 | int main(int argc, char **argv){
482          }
483  
484          display_headings();
489        stdin_fileno=fileno(stdin);
485  
486          for(;;){
487 <
488 <                FD_ZERO(&infds);
489 <                FD_SET(stdin_fileno, &infds);
490 <                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 <                        }
487 >                int ch = getch();
488 >                if (ch == 'q'){
489 >                        endwin();
490 >                        return 0;
491                  }
492  
493                  get_stats();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines