aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zpool/zpool_main.c
diff options
context:
space:
mode:
authorLow-power <[email protected]>2023-04-19 02:34:41 +0800
committerGitHub <[email protected]>2023-04-18 11:34:41 -0700
commitf9e1c63f8c32141bb18c0270d565e3bfc1bbd233 (patch)
tree1cbf71feab60278f56dc4c2b686d6df4a7cb123c /cmd/zpool/zpool_main.c
parentaccfdeb948dab87a9576084a582f5bfeda0bd2f2 (diff)
Values printed by zpool-iostat(8) should be right-aligned
This inappropriate left-alignment was introduced in 7bb7b1f. Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Signed-off-by: WHR <[email protected]> Closes #14751
Diffstat (limited to 'cmd/zpool/zpool_main.c')
-rw-r--r--cmd/zpool/zpool_main.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index 20f9cd679..27e805943 100644
--- a/cmd/zpool/zpool_main.c
+++ b/cmd/zpool/zpool_main.c
@@ -4272,13 +4272,17 @@ print_iostat_header(iostat_cbdata_t *cb)
* by order of magnitude. Uses column_size to add padding.
*/
static void
-print_stat_color(char *statbuf, unsigned int column_size)
+print_stat_color(const char *statbuf, unsigned int column_size)
{
fputs(" ", stdout);
+ size_t len = strlen(statbuf);
+ while (len < column_size) {
+ fputc(' ', stdout);
+ column_size--;
+ }
if (*statbuf == '0') {
color_start(ANSI_GRAY);
fputc('0', stdout);
- column_size--;
} else {
for (; *statbuf; statbuf++) {
if (*statbuf == 'K') color_start(ANSI_GREEN);
@@ -4293,8 +4297,6 @@ print_stat_color(char *statbuf, unsigned int column_size)
}
}
color_end();
- for (; column_size > 0; column_size--)
- fputc(' ', stdout);
}
/*