When asked to print bytes (-b option) do that and put 16 on a line.

This commit is contained in:
Søren Schmidt 2002-02-26 10:40:42 +00:00
parent ed57cfc480
commit ca8ad94279
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91299

View File

@ -460,7 +460,7 @@ readone(int fd, struct pcisel *sel, long reg, int width)
if (ioctl(fd, PCIOCREAD, &pi) < 0)
err(1, "ioctl(PCIOCREAD)");
printf("0x%08x", pi.pi_data);
printf("%0*x", width*2, pi.pi_data);
}
static void
@ -486,9 +486,10 @@ readit(const char *name, const char *reg, int width)
sel = getsel(name);
for (i = 1, r = rstart; r <= rend; i++, r += width) {
readone(fd, &sel, r, width);
putchar(i % 4 ? ' ' : '\n');
if (i && !(i % 8)) putchar(' ');
putchar(i % (16/width) ? ' ' : '\n');
}
if (i % 4 != 1)
if (i % (16/width) != 1)
putchar('\n');
close(fd);
}