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  a776a603369e644f031eee771bf388ab0edb3b91 (commit)
      from  b4e8076826838934bf518b8d0dbc86c37b8af6e8 (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=a776a603369e644f031eee771bf388ab0edb3b91


commit a776a603369e644f031eee771bf388ab0edb3b91
Author: Mats Erik Andersson <[email protected]>
Date:   Fri May 16 22:30:29 2014 +0200

    ftp: Size multipliers for hash increments.

diff --git a/ChangeLog b/ChangeLog
index 03ec4f1..f3a0470 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-05-16  Mats Erik Andersson  <[email protected]>
+
+       ftp: Size multipliers for hash increments.
+
+       * ftp/cmds.c (sethash): New variable P.  Detect and
+       apply multipliers when setting the increment size for
+       hash markers, i.e., allow commands like "hash 32m".
+
 2014-04-29  Mats Erik Andersson  <[email protected]>
 
        hostname: Degenerate cases.
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index b2b48a8..aff02e9 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -1572,7 +1572,9 @@ subtree, then making certain that @command{ftp} uses 
binary mode.
 @item hash [@var{size}]
 Toggle hash-sign (@samp{#}) printing for each data block transferred.
 The size of a data block can optionally be specified.  If not given,
-it defaults to 1024 bytes.
+it defaults to 1024 bytes.  The size can be written with multipliers
+'k', 'K', 'm', 'M', and 'g', 'G', to specify kilobytes, megabytes,
+or gigabytes.
 
 @item help [@var{command}]
 @itemx ? [@var{command}]
diff --git a/ftp/cmds.c b/ftp/cmds.c
index ece6ef5..471cd86 100644
--- a/ftp/cmds.c
+++ b/ftp/cmds.c
@@ -1198,12 +1198,39 @@ settrace (int argc _GL_UNUSED_PARAMETER, char **argv 
_GL_UNUSED_PARAMETER)
 
 /*
  * Toggle hash mark printing during transfers.
+ *
+ * Parse multipliers 'k', 'K', 'm', 'M', and
+ * 'g', 'G' to simplify the size step.
  */
 void
 sethash (int argc _GL_UNUSED_PARAMETER, char **argv)
 {
+  char *p = argv[1];
+
+  /* P is NULL when no argument was passed with `hash'.  */
+  while (p && isdigit (*p))
+    p++;
+
   if (argv[1] != NULL)
     sscanf (argv[1], "%d", &hashbytes);
+
+  /* Apply a multiplier only if a numerical part exixts.  */
+  if (argv[1] && isdigit (*argv[1]))
+    {
+      switch (*p)
+       {
+       case 'g':
+       case 'G':
+         hashbytes *= 1024;    /* Cascaded multiplication!  */
+       case 'm':
+       case 'M':
+         hashbytes *= 1024;
+       case 'k':
+       case 'K':
+         hashbytes *= 1024;
+       }
+    }
+
   if (hashbytes <= 0)
     hashbytes = 1024;
   hash = !hash;

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

Summary of changes:
 ChangeLog          |    8 ++++++++
 doc/inetutils.texi |    4 +++-
 ftp/cmds.c         |   27 +++++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 

_______________________________________________
Commit-inetutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/commit-inetutils

Reply via email to