summaryrefslogtreecommitdiffstats
path: root/usr.bin/fetch
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1997-02-10 18:49:42 +0000
committerwollman <wollman@FreeBSD.org>1997-02-10 18:49:42 +0000
commite189308068abbb9de44dae32a984cdf77a749d97 (patch)
tree9359a0f6b88b613cda767f724373444c8ec5fda2 /usr.bin/fetch
parent7c4a46a3a0d231d6f26abeb0dec447ec8fa3a45c (diff)
downloadFreeBSD-src-e189308068abbb9de44dae32a984cdf77a749d97.zip
FreeBSD-src-e189308068abbb9de44dae32a984cdf77a749d97.tar.gz
Fix PR#2700: report correct transmission speed, and restart transfers
from the restart point, not the end of the file (blush!). Submitted by: John-Mark Gurney <jmg@nike.efn.org>
Diffstat (limited to 'usr.bin/fetch')
-rw-r--r--usr.bin/fetch/ftp.c4
-rw-r--r--usr.bin/fetch/main.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/fetch/ftp.c b/usr.bin/fetch/ftp.c
index 0960b81..1b8e0fe 100644
--- a/usr.bin/fetch/ftp.c
+++ b/usr.bin/fetch/ftp.c
@@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ftp.c,v 1.1 1997/01/30 21:43:40 wollman Exp $
+ * $Id: ftp.c,v 1.2 1997/02/05 19:59:12 wollman Exp $
*/
#include <sys/types.h>
@@ -327,7 +327,7 @@ ftp_retrieve(struct fetch_state *fs)
}
if (fs->fs_restart) {
if (stab.st_size != 0 && stab.st_size < size)
- seekloc = wehave = size;
+ seekloc = wehave = stab.st_size;
}
}
diff --git a/usr.bin/fetch/main.c b/usr.bin/fetch/main.c
index 1b899a2..2aa7b9e 100644
--- a/usr.bin/fetch/main.c
+++ b/usr.bin/fetch/main.c
@@ -73,7 +73,7 @@ main(int argc, char *const *argv)
fs.fs_verbose = 1;
change_to_dir = file_to_get = hostname = 0;
- while ((c = getopt(argc, argv, "ac:D:f:h:HilLmMnNo:pPqrT:vV:")) != -1) {
+ while ((c = getopt(argc, argv, "ac:D:f:h:HilLmMnNo:pPqRrT:vV:")) != -1) {
switch (c) {
case 'D': case 'H': case 'I': case 'N': case 'L': case 'V':
break; /* ncftp compatibility */
@@ -286,6 +286,7 @@ void
display(struct fetch_state *fs, off_t size, ssize_t n)
{
static off_t bytes;
+ static off_t bytestart;
static int pr, init = 0;
static struct timeval t0, t_start;
static char *s;
@@ -309,7 +310,7 @@ display(struct fetch_state *fs, off_t size, ssize_t n)
sprintf (s, "Receiving %s", fs->fs_outputfile);
printf ("%s", s);
fflush (stdout);
- bytes = n;
+ bytestart = bytes = n;
return;
}
gettimeofday(&t, &tz);
@@ -318,6 +319,7 @@ display(struct fetch_state *fs, off_t size, ssize_t n)
printf ("\r%s: 100%%", s);
else
printf ("\r%s: %qd Kbytes", s, (quad_t)bytes/1024);
+ bytes -= bytestart;
d = t.tv_sec + t.tv_usec/1.e6 - t_start.tv_sec - t_start.tv_usec/1.e6;
printf ("\n%qd bytes transfered in %.1f seconds", (quad_t)bytes, d);
d = bytes/d;
OpenPOWER on IntegriCloud