source: npl/system/netkit-ftp/patches/08-netkit-ftp-0.17-longint.patch @ 7c410f9

Last change on this file since 7c410f9 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 4.3 KB
  • netkit-ftp-0.17/ftp/ftp.c

    old new  
    139139static char *gunique(char *);
    140140static void proxtrans(const char *cmd, char *local, char *remote);
    141141static int initconn(void);
    142 static void ptransfer(const char *direction, long bytes,
     142static void ptransfer(const char *direction, long long bytes,
    143143                      const struct timeval *t0,
    144144                      const struct timeval *t1);
    145145static void tvsub(struct timeval *tdiff,
     
    579579        int (*volatile closefunc)(FILE *);
    580580        void (*volatile oldintr)(int);
    581581        void (*volatile oldintp)(int);
    582         volatile long bytes = 0, hashbytes = HASHBYTES;
     582        volatile long long bytes = 0, hashbytes = HASHBYTES;
    583583        char buf[BUFSIZ], *bufp;
    584584        const char *volatile lmode;
    585585
     
    713713                                if ((d = write(fileno(dout), bufp, c)) <= 0)
    714714                                        break;
    715715                        if (hash) {
    716                                 while (bytes >= hashbytes) {
    717                                         (void) putchar('#');
    718                                         hashbytes += HASHBYTES;
    719                                 }
    720                                 (void) fflush(stdout);
    721                         }
     716                                while (bytes >= hashbytes) {        /* <-- 'long long' signed overflow is  */
     717                                        (void) putchar('#');        /* possible. In this case, we can      */
     718                                        hashbytes += HASHBYTES;     /* 'cycle' there for very long time.   */
     719                                }                                   /* Search 'hasbytes' in file down,     */
     720                                (void) fflush(stdout);              /* there are similar parts.            */
     721                        }                                           /*           <praszyk@redhat.com>      */
    722722                        if (tick && (bytes >= hashbytes)) {
    723                                 printf("\rBytes transferred: %ld", bytes);
     723                                printf("\rBytes transferred: %lld", bytes);
    724724                                (void) fflush(stdout);
    725725                                while (bytes >= hashbytes)
    726726                                        hashbytes += TICKBYTES;
     
    733733                        (void) fflush(stdout);
    734734                }
    735735                if (tick) {
    736                         (void) printf("\rBytes transferred: %ld\n", bytes);
     736                        (void) printf("\rBytes transferred: %lld\n", bytes);
    737737                        (void) fflush(stdout);
    738738                }
    739739                if (c < 0)
     
    755755                                        hashbytes += HASHBYTES;
    756756                                }
    757757                                if (tick && (bytes >= hashbytes)) {
    758                                         (void) printf("\rBytes transferred: %ld",
     758                                        (void) printf("\rBytes transferred: %lld",
    759759                                                bytes);
    760760                                        (void) fflush(stdout);
    761761                                        while (bytes >= hashbytes)
     
    780780                        (void) fflush(stdout);
    781781                }
    782782                if (tick) {
    783                         (void) printf("\rBytes transferred: %ld\n", bytes);
     783                        (void) printf("\rBytes transferred: %lld\n", bytes);
    784784                        (void) fflush(stdout);
    785785                }
    786786                if (ferror(fin))
     
    853853        void (*volatile oldintp)(int);
    854854        void (*volatile oldintr)(int);
    855855        volatile int is_retr, tcrflag, bare_lfs = 0;
    856         static unsigned bufsize;
     856        static unsigned bufsize=0;
    857857        static char *buf;
    858         volatile long bytes = 0, hashbytes = HASHBYTES;
     858        volatile long long bytes = 0, hashbytes = HASHBYTES;
    859859        register int c, d;
    860860        struct timeval start, stop;
    861861        struct stat st;
     
    10311031                                (void) fflush(stdout);
    10321032                        }
    10331033                        if (tick && (bytes >= hashbytes) && is_retr) {
    1034                                 (void) printf("\rBytes transferred: %ld",
     1034                                (void) printf("\rBytes transferred: %lld",
    10351035                                        bytes);
    10361036                                (void) fflush(stdout);
    10371037                                while (bytes >= hashbytes)
     
    10451045                        (void) fflush(stdout);
    10461046                }
    10471047                if (tick && is_retr) {
    1048                         (void) printf("\rBytes transferred: %ld\n", bytes);
     1048                        (void) printf("\rBytes transferred: %lld\n", bytes);
    10491049                        (void) fflush(stdout);
    10501050                }
    10511051                if (c < 0) {
     
    10951095                                        hashbytes += HASHBYTES;
    10961096                                }
    10971097                                if (tick && (bytes >= hashbytes) && is_retr) {
    1098                                         printf("\rBytes transferred: %ld",
     1098                                        printf("\rBytes transferred: %lld",
    10991099                                                bytes);
    11001100                                        fflush(stdout);
    11011101                                        while (bytes >= hashbytes)
     
    11261126                        (void) fflush(stdout);
    11271127                }
    11281128                if (tick && is_retr) {
    1129                         (void) printf("\rBytes transferred: %ld\n", bytes);
     1129                        (void) printf("\rBytes transferred: %lld\n", bytes);
    11301130                        (void) fflush(stdout);
    11311131                }
    11321132                if (bare_lfs) {
     
    15401540}
    15411541
    15421542static void
    1543 ptransfer(const char *direction, long bytes,
     1543ptransfer(const char *direction, long long bytes,
    15441544          const struct timeval *t0,
    15451545          const struct timeval *t1)
    15461546{
     
    15521552                s = td.tv_sec + (td.tv_usec / 1000000.);
    15531553#define nz(x)   ((x) == 0 ? 1 : (x))
    15541554                bs = bytes / nz(s);
    1555                 printf("%ld bytes %s in %.3g secs (%.2g Kbytes/sec)\n",
     1555                printf("%lld bytes %s in %.3g secs (%.2g Kbytes/sec)\n",
    15561556                    bytes, direction, s, bs / 1024.0);
    15571557        }
    15581558}
Note: See TracBrowser for help on using the repository browser.