[BACK]Return to top.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / top

Diff for /src/usr.bin/top/top.c between version 1.27 and 1.28

version 1.27, 2003/07/07 21:36:52 version 1.28, 2003/08/21 08:14:50
Line 38 
Line 38 
 #include <ctype.h>  #include <ctype.h>
 #include <signal.h>  #include <signal.h>
 #include <string.h>  #include <string.h>
   #include <poll.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <unistd.h>  #include <unistd.h>
   
Line 485 
Line 486 
 rundisplay(void)  rundisplay(void)
 {  {
         static char tempbuf1[50], tempbuf2[50];          static char tempbuf1[50], tempbuf2[50];
         struct timeval timeout;  
         fd_set readfds;  
         sigset_t mask;          sigset_t mask;
         char ch, *iptr;          char ch, *iptr;
         int change, i;          int change, i;
           struct pollfd pfd[1];
         uid_t uid;          uid_t uid;
         static char command_chars[] = "\f qh?en#sdkriIuSo";          static char command_chars[] = "\f qh?en#sdkriIuSo";
   
Line 503 
Line 503 
          * set up arguments for select with           * set up arguments for select with
          * timeout           * timeout
          */           */
         FD_ZERO(&readfds);          pfd[0].fd = STDIN_FILENO;
         FD_SET(STDIN_FILENO, &readfds);          pfd[0].events = POLLIN;
         timeout.tv_sec = (long) delay;  
         timeout.tv_usec = (long) ((delay - timeout.tv_sec) * 1000000);  
   
         if (leaveflag) {          if (leaveflag) {
                 end_screen();                  end_screen();
Line 562 
Line 560 
          * wait for either input or the end           * wait for either input or the end
          * of the delay period           * of the delay period
          */           */
         if (select(STDIN_FILENO + 1, &readfds, (fd_set *) NULL,          if (poll(pfd, 1, delay * 1000) > 0) {
             (fd_set *) NULL, &timeout) > 0) {  
                 char *errmsg;                  char *errmsg;
                 int newval;                  int newval;
   

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28