"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Shrink some formatted output fields down to size
To:
gameoftrees@openbsd.org
Date:
Sat, 12 Feb 2022 15:18:27 +0100

Download raw body.

Thread
shrink the width of formatted output fields to their expected size
 
Replace FMT_SCALED_STRSIZE with (FMT_SCALED_STRSIZE - 2) as field
width when formatting output for printing.  FMT_SCALED_STRSIZE
includes space for a nul byte and a minus sign.  Output values
are expected to be always positive here.

OK?
 
M  got/got.c
M  gotadmin/gotadmin.c

diff 3ac9931e932e961f71214c36d73a3d61a02ebccf f9ce4a8afeb29dc530d07ff27cb322c806e635da
blob - 23e3b35d2df3662ccdf58a8fd4544ed6490c1a3c
blob + 7d8663fbddd35a7c2dca7773ddeda8f1c7abffa4
--- got/got.c
+++ got/got.c
@@ -1029,7 +1029,7 @@ fetch_progress(void *arg, const char *message, off_t p
 	if (print_size || print_indexed || print_resolved)
 		printf("\r");
 	if (print_size)
-		printf("%*s fetched", FMT_SCALED_STRSIZE, scaled_size);
+		printf("%*s fetched", FMT_SCALED_STRSIZE - 2, scaled_size);
 	if (print_indexed)
 		printf("; indexing %d%%", p_indexed);
 	if (print_resolved)
@@ -7818,10 +7818,10 @@ send_progress(void *arg, off_t packfile_size, int ncom
 	if (print_deltify)
 		printf("; deltify: %d%%", p_deltify);
 	if (print_sent)
-		printf("; uploading pack: %*s %d%%", FMT_SCALED_STRSIZE,
+		printf("; uploading pack: %*s %d%%", FMT_SCALED_STRSIZE - 2,
 		    scaled_packsize, p_sent);
 	else if (print_written)
-		printf("; writing pack: %*s %d%%", FMT_SCALED_STRSIZE,
+		printf("; writing pack: %*s %d%%", FMT_SCALED_STRSIZE - 2,
 		    scaled_packsize, p_written);
 	if (print_searching || print_total || print_deltify ||
 	    print_written || print_sent) {
blob - 4a20c98ded30054a59e95d5cd5fc9f422d019da1
blob + 9bf9bdbfc8e7f58c5245c1b799e93299b67d828f
--- gotadmin/gotadmin.c
+++ gotadmin/gotadmin.c
@@ -458,7 +458,7 @@ pack_progress(void *arg, off_t packfile_size, int ncom
 	if (print_deltify)
 		printf("; deltify: %d%%", p_deltify);
 	if (print_written)
-		printf("; writing pack: %*s %d%%", FMT_SCALED_STRSIZE,
+		printf("; writing pack: %*s %d%%", FMT_SCALED_STRSIZE - 2,
 		    scaled_size, p_written);
 	if (print_searching || print_total || print_deltify ||
 	    print_written) {
@@ -512,7 +512,7 @@ pack_index_progress(void *arg, off_t packfile_size, in
 	if (print_size || print_indexed || print_resolved)
 		printf("\r");
 	if (print_size)
-		printf("%*s packed", FMT_SCALED_STRSIZE, scaled_size);
+		printf("%*s packed", FMT_SCALED_STRSIZE - 2, scaled_size);
 	if (print_indexed)
 		printf("; indexing %d%%", p_indexed);
 	if (print_resolved)

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de