lspci: Support 3+ digit register offsets When dumping registers with -xxxx, addresses will be larger than 2 hex digits (256), which means we truncate the column/address. This can confuse attempts at post-processing this output.
diff --git a/toys/other/lsusb.c b/toys/other/lsusb.c index 3abbe47..001acb1 100644 --- a/toys/other/lsusb.c +++ b/toys/other/lsusb.c
@@ -241,7 +241,7 @@ snprintf(toybuf, sizeof(toybuf), "/sys/bus/pci/devices/%s/config", new->name); fp = xfopen(toybuf, "r"); while ((b = fgetc(fp)) != EOF) { - if ((col % 16) == 0) printf("%02x: ", col & 0xf0); + if ((col % 16) == 0) printf("%02x: ", col & ~0xf); printf("%02x ", (b & 0xff)); if ((++col % 16) == 0) xputc('\n'); if (col == max) break;