From: Andrew Deason Date: Thu, 1 Jul 2010 16:22:13 +0000 (-0500) Subject: fs: Correct human-readable output alignment X-Git-Tag: openafs-devel-1_5_75~30 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=c29f03efab46fac2f89f69cad66b114f42398ba6;p=packages%2Fo%2Fopenafs.git fs: Correct human-readable output alignment 'fs lq' output separates its space values by whitespace, but 'fs df' does not, which was causing the human-readable output for 'fs' to not be properly aligned with the output headers. Modify HumanPrintSpace to take up exactly 10 characters (9 for the value, 1 for the exponent), and have the callers print out an extra space if appropriate. Change-Id: Ied81e73e1e84df34e63fdf0c80ad86341bea0cd4 Reviewed-on: http://gerrit.openafs.org/2311 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/venus/fs.c b/src/venus/fs.c index 4e726b057..519d0357c 100644 --- a/src/venus/fs.c +++ b/src/venus/fs.c @@ -659,7 +659,7 @@ HumanPrintSpace(afs_int32 int_space) exponent++; space /= 1024; } - printf(" %8.1f%c", space, power_letter[exponent]); + printf("%9.1f%c", space, power_letter[exponent]); } static int @@ -672,7 +672,9 @@ QuickPrintStatus(VolumeStatus * status, char *name, int human) if (status->MaxQuota != 0) { if (human) { + printf(" "); HumanPrintSpace(status->MaxQuota); + printf(" "); HumanPrintSpace(status->BlocksInUse); } else @@ -680,11 +682,11 @@ QuickPrintStatus(VolumeStatus * status, char *name, int human) QuotaUsed = ((((double)status->BlocksInUse) / status->MaxQuota) * 100.0); } else { - printf(" no limit"); + printf(" no limit "); if (human) HumanPrintSpace(status->BlocksInUse); else - printf(" %10d", status->BlocksInUse); + printf("%10d", status->BlocksInUse); } if (QuotaUsed > 90.0) { printf("%5.0f%%<<", QuotaUsed);