summaryrefslogtreecommitdiffstats
path: root/usr.bin/ftp
diff options
context:
space:
mode:
authorscrappy <scrappy@FreeBSD.org>1996-05-26 21:12:50 +0000
committerscrappy <scrappy@FreeBSD.org>1996-05-26 21:12:50 +0000
commit0ec1a91c8d3cc9df49cfd7c2a8fc7b4cf518b0c4 (patch)
tree5b246b82d664cd909e3ac7db7058983d0597e6b3 /usr.bin/ftp
parent6c6210f90be7cbdb15ad15336666874713144a4d (diff)
downloadFreeBSD-src-0ec1a91c8d3cc9df49cfd7c2a8fc7b4cf518b0c4.zip
FreeBSD-src-0ec1a91c8d3cc9df49cfd7c2a8fc7b4cf518b0c4.tar.gz
Changed printf for reporting transfer stats from using %.2g to %.2f to
get rid of "scientific notation" reporting (PR#bin/329) Added a switch so that if bytes/sec > 1Meg/sec, report in Meg/sec instead of Kbytes/sec
Diffstat (limited to 'usr.bin/ftp')
-rw-r--r--usr.bin/ftp/ftp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c
index 137e8c2..a98bb96 100644
--- a/usr.bin/ftp/ftp.c
+++ b/usr.bin/ftp/ftp.c
@@ -1189,8 +1189,12 @@ ptransfer(direction, bytes, t0, t1)
s = td.tv_sec + (td.tv_usec / 1000000.);
#define nz(x) ((x) == 0 ? 1 : (x))
bs = bytes / nz(s);
- printf("%ld bytes %s in %.2g seconds (%.2g Kbytes/s)\n",
- bytes, direction, s, bs / 1024.);
+ if(bs > ( 1024 * 1024 ))
+ printf("%ld bytes %s in %.2f seconds (%.2f Meg/s)\n",
+ bytes, direction, s, bs / (1024. * 1024.));
+ else
+ printf("%ld bytes %s in %.2f seconds (%.2f Kbytes/s)\n",
+ bytes, direction, s, bs / 1024.);
}
}
OpenPOWER on IntegriCloud