Fix the device name spacing.
The old logic padded the device name out but assumed the unit number was one digit long; this fails for things like SATA devices which (for me) begin at ad10. Assemble the full device name in a temporary buffer and then calcluate padding based on that string.
This commit is contained in:
parent
4028a36726
commit
ab8ac08e14
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182927
@ -667,6 +667,7 @@ static void
|
|||||||
phdr(void)
|
phdr(void)
|
||||||
{
|
{
|
||||||
int i, printed;
|
int i, printed;
|
||||||
|
char devbuf[256];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If xflag is set, we need a per-loop header, not a page header, so
|
* If xflag is set, we need a per-loop header, not a page header, so
|
||||||
@ -682,14 +683,13 @@ phdr(void)
|
|||||||
if ((dev_select[i].selected != 0)
|
if ((dev_select[i].selected != 0)
|
||||||
&& (dev_select[i].selected <= maxshowdevs)) {
|
&& (dev_select[i].selected <= maxshowdevs)) {
|
||||||
di = dev_select[i].position;
|
di = dev_select[i].position;
|
||||||
|
snprintf(devbuf, sizeof(devbuf), "%s%d",
|
||||||
|
cur.dinfo->devices[di].device_name,
|
||||||
|
cur.dinfo->devices[di].unit_number);
|
||||||
if (oflag > 0)
|
if (oflag > 0)
|
||||||
(void)printf("%12.6s%d ",
|
(void)printf("%13.6s ", devbuf);
|
||||||
cur.dinfo->devices[di].device_name,
|
|
||||||
cur.dinfo->devices[di].unit_number);
|
|
||||||
else
|
else
|
||||||
printf("%15.6s%d ",
|
printf("%16.6s ", devbuf);
|
||||||
cur.dinfo->devices[di].device_name,
|
|
||||||
cur.dinfo->devices[di].unit_number);
|
|
||||||
printed++;
|
printed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user