[Top][All Lists]

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

bug#32903: [PATCH] Display uncompressed size when testing

From: Stephen Kitt
Subject: bug#32903: [PATCH] Display uncompressed size when testing
Date: Mon, 24 Dec 2018 10:21:58 +0100

On Sun, 4 Nov 2018 21:54:59 +0200, Sergey Ponomarev <address@hidden> wrote:
> From user point of view it would be better not to enclose the size
> into brackets: it will be easier to parse the output by other tools.

Good point, here’s an updated patch (I hesitated between "xxx bytes OK" and
"OK xxx bytes" but went with the latter in the end).



    Display uncompressed size when testing
    Alongside the OK message, print the real size in bytes; this provides
    a way to view the stored file's size when it's larger than 4GiB.
    Signed-off-by: Stephen Kitt <address@hidden>

diff --git a/gzip.c b/gzip.c
index e6a7761..a162154 100644
--- a/gzip.c
+++ b/gzip.c
@@ -62,6 +62,7 @@ static char const *const license_msg[] = {
 #include <stddef.h>
 #include <sys/stat.h>
 #include <errno.h>
+#include <inttypes.h>
 #include "tailor.h"
 #include "gzip.h"
@@ -807,7 +808,7 @@ local void treat_stdin()
     if (verbose) {
         if (test) {
-            fprintf(stderr, " OK\n");
+            fprintf(stderr, " OK %jd bytes\n", (intmax_t) bytes_out);
         } else if (!decompress) {
             display_ratio(bytes_in-(bytes_out-header_bytes), bytes_in, stderr);
@@ -1060,7 +1061,7 @@ local void treat_file(iname)
     /* Display statistics */
     if(verbose) {
         if (test) {
-            fprintf(stderr, " OK");
+            fprintf(stderr, " OK %jd bytes", (int_max_t) bytes_out);
         } else if (decompress) {
             display_ratio(bytes_out-(bytes_in-header_bytes), bytes_out,stderr);
         } else {

Attachment: pgp823DbQXWbL.pgp
Description: OpenPGP digital signature

reply via email to

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