commit-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_2-32-ge5e91c


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_2-32-ge5e91cd
Date: Thu, 31 Jul 2014 22:36:45 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  e5e91cdb14b3dbb0dfd02c7f2f60b2b0abc4ff1e (commit)
      from  d129f72ed5de3557b27152965a4a0b6d597ba653 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=e5e91cdb14b3dbb0dfd02c7f2f60b2b0abc4ff1e


commit e5e91cdb14b3dbb0dfd02c7f2f60b2b0abc4ff1e
Author: Mats Erik Andersson <address@hidden>
Date:   Fri Aug 1 00:26:08 2014 +0200

    ftp: Friendlier printing of transfer speed.

diff --git a/ChangeLog b/ChangeLog
index d293e10..fe50b73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-08-01  Mats Erik Andersson  <address@hidden>
+
+       * ftp/ftp.c (ptransfer): Change BS to be of type float.
+       Improve readability by having speed estimates printed
+       as `Mbytes/s', `kbytes/s', or `bytes/s' as suitable.
+
 2014-07-30  Alfred M. Szmidt  <address@hidden>
 
        * telnetd/utility.c (nextitem, netclear, printoption, printsub)
diff --git a/ftp/ftp.c b/ftp/ftp.c
index d117974..66afeea 100644
--- a/ftp/ftp.c
+++ b/ftp/ftp.c
@@ -1583,8 +1583,7 @@ ptransfer (char *direction, long long int bytes,
           struct timeval *t0, struct timeval *t1)
 {
   struct timeval td;
-  float s;
-  long long bs;
+  float s, bs;
 
   if (verbose)
     {
@@ -1592,8 +1591,15 @@ ptransfer (char *direction, long long int bytes,
       s = td.tv_sec + (td.tv_usec / 1000000.);
 #define nz(x)  ((x) == 0 ? 1 : (x))
       bs = bytes / nz (s);
-      printf ("%lld bytes %s in %.3g seconds (%lld bytes/s)\n",
-             bytes, direction, s, bs);
+
+      printf ("%lld bytes %s in %.3g seconds", bytes, direction, s);
+
+      if (bs > 1048576.0)
+       printf (" (%.3g Mbytes/s)\n", bs / 1048576.0);
+      else if (bs > 1024.0)
+       printf (" (%.3g kbytes/s)\n", bs / 1024.0);
+      else
+       printf (" (%.3g bytes/s)\n", bs);
     }
 }
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog |    6 ++++++
 ftp/ftp.c |   14 ++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]