From ccbd818cb490a62dc6a65e1cd1b2a728b85cd98f Mon Sep 17 00:00:00 2001 From: Craig Small Date: Mon, 25 Sep 2017 09:09:57 +1000 Subject: [PATCH] vmstat: Fix alignment for disk partition format The disk partition format translation hint, the actual text and the printf statements were all diagreeing with each other. This meant the disk partition output from vmstat was a mess. Now all the titles and values line up and everything is right-aligned which looks better than some half-hearted attempt at center-aligned for titles and right-aligned for values. Thanks to @goeran for the heads-up in #69 --- NEWS | 1 + vmstat.c | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index f5ef2adc..2e7c7da0 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,7 @@ procps-ng-NEXT * top: address a wishlist man page NLS suggestion Debian #865689 * top: fix potential distortion in 'Mem' graph display issue #64 * watch: define HOST_NAME_MAX where not defined Debian #830734 + * vmstat: Fix alignment for disk partition format issue #69 procps-ng-3.3.12 ---------------- diff --git a/vmstat.c b/vmstat.c index 98a51531..00cca5e8 100644 --- a/vmstat.c +++ b/vmstat.c @@ -506,23 +506,19 @@ static void new_format(void) static void diskpartition_header(const char *partition_name) { - printf("%-10s %10s %10s %10s %10s\n", + printf("%-10s %10s %16s %10s %16s\n", partition_name, /* Translation Hint: Translating folloging disk partition * header fields that follow (marked with max x chars) might * not work, unless manual page is translated as well. */ - /* Translation Hint: max 10 chars. The word is - * expected to be centralized, use spaces at the end - * to do that. */ - _("reads "), /* Translation Hint: max 10 chars */ + _("reads"), + /* Translation Hint: max 16 chars */ _("read sectors"), - /* Translation Hint: max 10 chars. The word is - * expected to be centralized, use spaces at the end - * to do that. */ - _("writes "), /* Translation Hint: max 10 chars */ + _("writes"), + /* Translation Hint: max 16 chars */ _("requested writes")); } @@ -532,7 +528,7 @@ static void diskpartition_format(const char *partition_name) struct diskstats_info *disk_stat; struct diskstats_stack *stack; struct diskstats_result *got; - const char format[] = "%20lu %10lu %10lu %10lu\n"; + const char format[] = "%21u %16llu %10u %16llu\n"; int i; if (procps_diskstats_new(&disk_stat) < 0)