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
This commit is contained in:
parent
04835608dd
commit
cae3f1438f
20
vmstat.c
20
vmstat.c
@ -425,22 +425,18 @@ static void new_format(void)
|
|||||||
|
|
||||||
static void diskpartition_header(const char *partition_name)
|
static void diskpartition_header(const char *partition_name)
|
||||||
{
|
{
|
||||||
printf("%-10s %10s %10s %10s %10s\n",
|
printf("%-10s %10s %16s %10s %16s\n",
|
||||||
partition_name,
|
partition_name,
|
||||||
/* Translation Hint: Translating folloging disk partition
|
/* Translation Hint: Translating folloging disk partition
|
||||||
* header fields that follow (marked with max x chars) might
|
* header fields that follow (marked with max x chars) might
|
||||||
* not work, unless manual page is translated as well. */
|
* not work, unless manual page is translated as well. */
|
||||||
/* Translation Hint: max 10 chars. The word is
|
/* Translation Hint: max 10 chars. */
|
||||||
* expected to be centralized, use spaces at the end
|
_("reads"),
|
||||||
* to do that. */
|
/* Translation Hint: max 16 chars. */
|
||||||
_("reads "),
|
|
||||||
/* Translation Hint: max 10 chars */
|
|
||||||
_("read sectors"),
|
_("read sectors"),
|
||||||
/* Translation Hint: max 10 chars. The word is
|
/* Translation Hint: max 10 chars. */
|
||||||
* expected to be centralized, use spaces at the end
|
_("writes"),
|
||||||
* to do that. */
|
/* Translation Hint: max 16 chars */
|
||||||
_("writes "),
|
|
||||||
/* Translation Hint: max 10 chars */
|
|
||||||
_("requested writes"));
|
_("requested writes"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,7 +446,7 @@ static int diskpartition_format(const char *partition_name)
|
|||||||
struct disk_stat *disks;
|
struct disk_stat *disks;
|
||||||
struct partition_stat *partitions, *current_partition = NULL;
|
struct partition_stat *partitions, *current_partition = NULL;
|
||||||
unsigned long ndisks, j, k, npartitions;
|
unsigned long ndisks, j, k, npartitions;
|
||||||
const char format[] = "%20u %10llu %10u %10llu\n";
|
const char format[] = "%21u %16llu %10u %16llu\n";
|
||||||
|
|
||||||
fDiskstat = fopen("/proc/diskstats", "rb");
|
fDiskstat = fopen("/proc/diskstats", "rb");
|
||||||
if (!fDiskstat)
|
if (!fDiskstat)
|
||||||
|
Loading…
Reference in New Issue
Block a user