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

Diff for /src/usr.bin/ssh/progressmeter.c between version 1.22.2.1 and 1.23

version 1.22.2.1, 2005/09/02 03:45:00 version 1.23, 2005/04/28 10:17:56
Line 41 
Line 41 
 static void format_size(char *, int, off_t);  static void format_size(char *, int, off_t);
 static void format_rate(char *, int, off_t);  static void format_rate(char *, int, off_t);
   
 /* window resizing */  
 static void sig_winch(int);  
 static void setscreensize(void);  
   
 /* updates the progressmeter to reflect the current state of the transfer */  /* updates the progressmeter to reflect the current state of the transfer */
 void refresh_progress_meter(void);  void refresh_progress_meter(void);
   
Line 60 
Line 56 
 static long stalled;            /* how long we have been stalled */  static long stalled;            /* how long we have been stalled */
 static int bytes_per_second;    /* current speed in bytes per second */  static int bytes_per_second;    /* current speed in bytes per second */
 static int win_size;            /* terminal window size */  static int win_size;            /* terminal window size */
 static volatile sig_atomic_t win_resized; /* for window resizing */  
   
 /* units for format_size */  /* units for format_size */
 static const char unit[] = " KMGT";  static const char unit[] = " KMGT";
Line 221 
Line 216 
   
         save_errno = errno;          save_errno = errno;
   
         if (win_resized) {  
                 setscreensize();  
                 win_resized = 0;  
         }  
         if (can_output())          if (can_output())
                 refresh_progress_meter();                  refresh_progress_meter();
   
Line 236 
Line 227 
 void  void
 start_progress_meter(char *f, off_t filesize, off_t *ctr)  start_progress_meter(char *f, off_t filesize, off_t *ctr)
 {  {
           struct winsize winsize;
   
         start = last_update = time(NULL);          start = last_update = time(NULL);
         file = f;          file = f;
         end_pos = filesize;          end_pos = filesize;
Line 244 
Line 237 
         stalled = 0;          stalled = 0;
         bytes_per_second = 0;          bytes_per_second = 0;
   
         setscreensize();          if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize) != -1 &&
               winsize.ws_col != 0) {
                   if (winsize.ws_col > MAX_WINSIZE)
                           win_size = MAX_WINSIZE;
                   else
                           win_size = winsize.ws_col;
           } else
                   win_size = DEFAULT_WINSIZE;
           win_size += 1;                                  /* trailing \0 */
   
         if (can_output())          if (can_output())
                 refresh_progress_meter();                  refresh_progress_meter();
   
         signal(SIGALRM, update_progress_meter);          signal(SIGALRM, update_progress_meter);
         signal(SIGWINCH, sig_winch);  
         alarm(UPDATE_INTERVAL);          alarm(UPDATE_INTERVAL);
 }  }
   
Line 266 
Line 267 
                 refresh_progress_meter();                  refresh_progress_meter();
   
         atomicio(vwrite, STDOUT_FILENO, "\n", 1);          atomicio(vwrite, STDOUT_FILENO, "\n", 1);
 }  
   
 static void  
 sig_winch(int sig)  
 {  
         win_resized = 1;  
 }  
   
 static void  
 setscreensize(void)  
 {  
         struct winsize winsize;  
   
         if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize) != -1 &&  
             winsize.ws_col != 0) {  
                 if (winsize.ws_col > MAX_WINSIZE)  
                         win_size = MAX_WINSIZE;  
                 else  
                         win_size = winsize.ws_col;  
         } else  
                 win_size = DEFAULT_WINSIZE;  
         win_size += 1;                                  /* trailing \0 */  
 }  }

Legend:
Removed from v.1.22.2.1  
changed lines
  Added in v.1.23