commit - 079f6d8d0b8dfca058af11f2b0fd370ab9f6a2bd
commit + 806d289f4efb3cecee525fdfa9fa65380b8a0009
blob - 6ef5e42402e1dc2cb7c73ffa663a1b99d0d09239
blob + c4d4f3ac561c1a39de78a71d7b1753caff8b745f
--- diskinfo.c
+++ diskinfo.c
}
static void
-print_partition(const char *devname, const struct disklabel *dl, int i, int human)
+print_partition(const char *devname, const struct disklabel *dl, int i, int last,
+ int human)
{
const struct partition *pp = &dl->d_partitions[i];
char sbuf[FMT_SCALED_STRSIZE];
int j;
if (DL_GETPSIZE(pp)) {
- printf("\n|-- %s%c\t", devname, DL_PARTNUM2NAME(i));
+ printf("\n%c-- %s%c\t", last ? '`' : '|', devname,
+ DL_PARTNUM2NAME(i));
+
if (human) {
if(fmt_scaled(DL_GETPSIZE(pp) * dl->d_secsize, sbuf) == -1)
err(1, "%s: fmt_scaled()", __func__);
struct dk_inquiry di;
struct disklabel dl;
int dev;
- int i;
+ int i, last_i;
/* Only root is allowed to do this */
dev = opendev(devname, O_RDONLY, OPENDEV_PART, NULL);
dl.d_uid[4], dl.d_uid[5], dl.d_uid[6], dl.d_uid[7]);
printf(" [%s %s]", di.vendor, di.product);
+ last_i = -1;
for (i = 0; i < dl.d_npartitions; i++)
- print_partition(devname, &dl, i, human);
+ if (DL_GETPSIZE(&dl.d_partitions[i]))
+ last_i = i;
+
+ for (i = 0; i < dl.d_npartitions; i++)
+ print_partition(devname, &dl, i, i == last_i, human);
printf("\n\n");
}