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

Diff for /src/usr.bin/ssh/scp.c between version 1.10 and 1.11

version 1.10, 1999/10/04 01:59:56 version 1.11, 1999/10/05 10:58:37
Line 54 
Line 54 
   
 #define _PATH_CP "cp"  #define _PATH_CP "cp"
   
 /* For progressmeter() function. */  /* For progressmeter() -- number of seconds before xfer considered "stalled" */
 #define STALLTIME       5  #define STALLTIME       5
   
 static struct timeval start;  /* Visual statistics about files as they are transferred. */
 unsigned long statbytes = 0;  
 unsigned long totalbytes = 0;  
 void progressmeter(int);  void progressmeter(int);
   
   /* Returns width of the terminal (for progress meter calculations). */
 int getttywidth(void);  int getttywidth(void);
   
   /* Time a transfer started. */
   static struct timeval start;
   
   /* Number of bytes of current file transferred so far. */
   volatile unsigned long statbytes;
   
   /* Total size of current file. */
   unsigned long totalbytes = 0;
   
   /* Name of current file being transferred. */
   char *curfile;
   
 /* This is set to non-zero to enable verbose mode. */  /* This is set to non-zero to enable verbose mode. */
 int verbose = 0;  int verbose = 0;
   
Line 465 
Line 477 
   
         for (indx = 0; indx < argc; ++indx) {          for (indx = 0; indx < argc; ++indx) {
                 name = argv[indx];                  name = argv[indx];
                   statbytes = 0;
                 if ((fd = open(name, O_RDONLY, 0)) < 0)                  if ((fd = open(name, O_RDONLY, 0)) < 0)
                         goto syserr;                          goto syserr;
                 if (fstat(fd, &stb) < 0) {                  if (fstat(fd, &stb) < 0) {
Line 488 
Line 501 
                         last = name;                          last = name;
                 else                  else
                         ++last;                          ++last;
                   curfile = last;
                 if (pflag) {                  if (pflag) {
                         /*                          /*
                          * Make it compatible with possible future                           * Make it compatible with possible future
Line 1102 
Line 1116 
 {  {
         static const char prefixes[] = " KMGTP";          static const char prefixes[] = " KMGTP";
         static struct timeval lastupdate;          static struct timeval lastupdate;
         static off_t lastsize = 0;          static off_t lastsize;
         struct timeval now, td, wait;          struct timeval now, td, wait;
         off_t cursize, abbrevsize;          off_t cursize, abbrevsize;
         double elapsed;          double elapsed;
Line 1112 
Line 1126 
         if (flag == -1) {          if (flag == -1) {
                 (void)gettimeofday(&start, (struct timezone *)0);                  (void)gettimeofday(&start, (struct timezone *)0);
                 lastupdate = start;                  lastupdate = start;
                   lastsize = 0;
         }          }
         (void)gettimeofday(&now, (struct timezone *)0);          (void)gettimeofday(&now, (struct timezone *)0);
         cursize = statbytes;          cursize = statbytes;
         ratio = cursize * 100 / totalbytes;          ratio = cursize * 100 / totalbytes;
         ratio = MAX(ratio, 0);          ratio = MAX(ratio, 0);
         ratio = MIN(ratio, 100);          ratio = MIN(ratio, 100);
         snprintf(buf, sizeof(buf), "\r%3d%% ", ratio);          snprintf(buf, sizeof(buf), "\r%-20.20s %3d%% ", curfile, ratio);
   
         barlength = getttywidth() - 30;          barlength = getttywidth() - 51;
         if (barlength > 0) {          if (barlength > 0) {
                 i = barlength * ratio / 100;                  i = barlength * ratio / 100;
                 snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),                  snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11