svn commit: r344240 - head/stand/common
Ian Lepore
ian at FreeBSD.org
Sun Feb 17 23:46:13 UTC 2019
Author: ian
Date: Sun Feb 17 23:46:11 2019
New Revision: 344240
URL: https://svnweb.freebsd.org/changeset/base/344240
Log:
Make lsdev -v output line up in neat columns by using a fixed width for
the size field and a tab between the partition type and the size.
Changes this
disk devices:
disk0 (MMC)
disk0s1: DOS/Windows 49MB
disk0s2: FreeBSD 14GB
disk0s2a: FreeBSD UFS 14GB
disk0s2b: Unknown 2048KB
disk0s2d: FreeBSD UFS 2040KB
to this
disk devices:
disk0 (MMC)
disk0s1: DOS/Windows 49MB
disk0s2: FreeBSD 14GB
disk0s2a: FreeBSD UFS 14GB
disk0s2b: Unknown 2048KB
disk0s2d: FreeBSD UFS 2040KB
Modified:
head/stand/common/disk.c
Modified: head/stand/common/disk.c
==============================================================================
--- head/stand/common/disk.c Sun Feb 17 23:38:17 2019 (r344239)
+++ head/stand/common/disk.c Sun Feb 17 23:46:11 2019 (r344240)
@@ -75,7 +75,7 @@ display_size(uint64_t size, u_int sectorsize)
size /= 1024;
unit = 'M';
}
- sprintf(buf, "%ld%cB", (long)size, unit);
+ sprintf(buf, "%4ld%cB", (long)size, unit);
return (buf);
}
@@ -119,12 +119,9 @@ ptable_print(void *arg, const char *pname, const struc
od = (struct open_disk *)pa->dev->dd.d_opendata;
sectsize = od->sectorsize;
partsize = part->end - part->start + 1;
- sprintf(line, " %s%s: %s", pa->prefix, pname,
- parttype2str(part->type));
- if (pa->verbose)
- sprintf(line, "%-*s%s", PWIDTH, line,
- display_size(partsize, sectsize));
- strcat(line, "\n");
+ sprintf(line, " %s%s: %s\t%s\n", pa->prefix, pname,
+ parttype2str(part->type),
+ pa->verbose ? display_size(partsize, sectsize) : "");
if (pager_output(line))
return 1;
res = 0;
More information about the svn-src-all
mailing list