[c5c522c] | 1 | --- netkit-ftp-0.17/ftp/ftp.c.rasold 2005-08-22 14:22:50.000000000 +0200 |
---|
| 2 | +++ netkit-ftp-0.17/ftp/ftp.c 2005-08-22 14:23:02.000000000 +0200 |
---|
| 3 | @@ -139,7 +139,7 @@ |
---|
| 4 | static char *gunique(char *); |
---|
| 5 | static void proxtrans(const char *cmd, char *local, char *remote); |
---|
| 6 | static int initconn(void); |
---|
| 7 | -static void ptransfer(const char *direction, long bytes, |
---|
| 8 | +static void ptransfer(const char *direction, long long bytes, |
---|
| 9 | const struct timeval *t0, |
---|
| 10 | const struct timeval *t1); |
---|
| 11 | static void tvsub(struct timeval *tdiff, |
---|
| 12 | @@ -579,7 +579,7 @@ |
---|
| 13 | int (*volatile closefunc)(FILE *); |
---|
| 14 | void (*volatile oldintr)(int); |
---|
| 15 | void (*volatile oldintp)(int); |
---|
| 16 | - volatile long bytes = 0, hashbytes = HASHBYTES; |
---|
| 17 | + volatile long long bytes = 0, hashbytes = HASHBYTES; |
---|
| 18 | char buf[BUFSIZ], *bufp; |
---|
| 19 | const char *volatile lmode; |
---|
| 20 | |
---|
| 21 | @@ -713,14 +713,14 @@ |
---|
| 22 | if ((d = write(fileno(dout), bufp, c)) <= 0) |
---|
| 23 | break; |
---|
| 24 | if (hash) { |
---|
| 25 | - while (bytes >= hashbytes) { |
---|
| 26 | - (void) putchar('#'); |
---|
| 27 | - hashbytes += HASHBYTES; |
---|
| 28 | - } |
---|
| 29 | - (void) fflush(stdout); |
---|
| 30 | - } |
---|
| 31 | + while (bytes >= hashbytes) { /* <-- 'long long' signed overflow is */ |
---|
| 32 | + (void) putchar('#'); /* possible. In this case, we can */ |
---|
| 33 | + hashbytes += HASHBYTES; /* 'cycle' there for very long time. */ |
---|
| 34 | + } /* Search 'hasbytes' in file down, */ |
---|
| 35 | + (void) fflush(stdout); /* there are similar parts. */ |
---|
| 36 | + } /* <praszyk@redhat.com> */ |
---|
| 37 | if (tick && (bytes >= hashbytes)) { |
---|
| 38 | - printf("\rBytes transferred: %ld", bytes); |
---|
| 39 | + printf("\rBytes transferred: %lld", bytes); |
---|
| 40 | (void) fflush(stdout); |
---|
| 41 | while (bytes >= hashbytes) |
---|
| 42 | hashbytes += TICKBYTES; |
---|
| 43 | @@ -733,7 +733,7 @@ |
---|
| 44 | (void) fflush(stdout); |
---|
| 45 | } |
---|
| 46 | if (tick) { |
---|
| 47 | - (void) printf("\rBytes transferred: %ld\n", bytes); |
---|
| 48 | + (void) printf("\rBytes transferred: %lld\n", bytes); |
---|
| 49 | (void) fflush(stdout); |
---|
| 50 | } |
---|
| 51 | if (c < 0) |
---|
| 52 | @@ -755,7 +755,7 @@ |
---|
| 53 | hashbytes += HASHBYTES; |
---|
| 54 | } |
---|
| 55 | if (tick && (bytes >= hashbytes)) { |
---|
| 56 | - (void) printf("\rBytes transferred: %ld", |
---|
| 57 | + (void) printf("\rBytes transferred: %lld", |
---|
| 58 | bytes); |
---|
| 59 | (void) fflush(stdout); |
---|
| 60 | while (bytes >= hashbytes) |
---|
| 61 | @@ -780,7 +780,7 @@ |
---|
| 62 | (void) fflush(stdout); |
---|
| 63 | } |
---|
| 64 | if (tick) { |
---|
| 65 | - (void) printf("\rBytes transferred: %ld\n", bytes); |
---|
| 66 | + (void) printf("\rBytes transferred: %lld\n", bytes); |
---|
| 67 | (void) fflush(stdout); |
---|
| 68 | } |
---|
| 69 | if (ferror(fin)) |
---|
| 70 | @@ -853,9 +853,9 @@ |
---|
| 71 | void (*volatile oldintp)(int); |
---|
| 72 | void (*volatile oldintr)(int); |
---|
| 73 | volatile int is_retr, tcrflag, bare_lfs = 0; |
---|
| 74 | - static unsigned bufsize; |
---|
| 75 | + static unsigned bufsize=0; |
---|
| 76 | static char *buf; |
---|
| 77 | - volatile long bytes = 0, hashbytes = HASHBYTES; |
---|
| 78 | + volatile long long bytes = 0, hashbytes = HASHBYTES; |
---|
| 79 | register int c, d; |
---|
| 80 | struct timeval start, stop; |
---|
| 81 | struct stat st; |
---|
| 82 | @@ -1031,7 +1031,7 @@ |
---|
| 83 | (void) fflush(stdout); |
---|
| 84 | } |
---|
| 85 | if (tick && (bytes >= hashbytes) && is_retr) { |
---|
| 86 | - (void) printf("\rBytes transferred: %ld", |
---|
| 87 | + (void) printf("\rBytes transferred: %lld", |
---|
| 88 | bytes); |
---|
| 89 | (void) fflush(stdout); |
---|
| 90 | while (bytes >= hashbytes) |
---|
| 91 | @@ -1045,7 +1045,7 @@ |
---|
| 92 | (void) fflush(stdout); |
---|
| 93 | } |
---|
| 94 | if (tick && is_retr) { |
---|
| 95 | - (void) printf("\rBytes transferred: %ld\n", bytes); |
---|
| 96 | + (void) printf("\rBytes transferred: %lld\n", bytes); |
---|
| 97 | (void) fflush(stdout); |
---|
| 98 | } |
---|
| 99 | if (c < 0) { |
---|
| 100 | @@ -1095,7 +1095,7 @@ |
---|
| 101 | hashbytes += HASHBYTES; |
---|
| 102 | } |
---|
| 103 | if (tick && (bytes >= hashbytes) && is_retr) { |
---|
| 104 | - printf("\rBytes transferred: %ld", |
---|
| 105 | + printf("\rBytes transferred: %lld", |
---|
| 106 | bytes); |
---|
| 107 | fflush(stdout); |
---|
| 108 | while (bytes >= hashbytes) |
---|
| 109 | @@ -1126,7 +1126,7 @@ |
---|
| 110 | (void) fflush(stdout); |
---|
| 111 | } |
---|
| 112 | if (tick && is_retr) { |
---|
| 113 | - (void) printf("\rBytes transferred: %ld\n", bytes); |
---|
| 114 | + (void) printf("\rBytes transferred: %lld\n", bytes); |
---|
| 115 | (void) fflush(stdout); |
---|
| 116 | } |
---|
| 117 | if (bare_lfs) { |
---|
| 118 | @@ -1540,7 +1540,7 @@ |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | static void |
---|
| 122 | -ptransfer(const char *direction, long bytes, |
---|
| 123 | +ptransfer(const char *direction, long long bytes, |
---|
| 124 | const struct timeval *t0, |
---|
| 125 | const struct timeval *t1) |
---|
| 126 | { |
---|
| 127 | @@ -1552,7 +1552,7 @@ |
---|
| 128 | s = td.tv_sec + (td.tv_usec / 1000000.); |
---|
| 129 | #define nz(x) ((x) == 0 ? 1 : (x)) |
---|
| 130 | bs = bytes / nz(s); |
---|
| 131 | - printf("%ld bytes %s in %.3g secs (%.2g Kbytes/sec)\n", |
---|
| 132 | + printf("%lld bytes %s in %.3g secs (%.2g Kbytes/sec)\n", |
---|
| 133 | bytes, direction, s, bs / 1024.0); |
---|
| 134 | } |
---|
| 135 | } |
---|