diff options
author | Isaac Dunham <ibid.ag@gmail.com> | 2014-05-20 21:19:17 -0500 |
---|---|---|
committer | Isaac Dunham <ibid.ag@gmail.com> | 2014-05-20 21:19:17 -0500 |
commit | b06b0fe32361f7fc5b3fb98bf5f2c2791be757e8 (patch) | |
tree | 9ffdaa27479f75efd0af175c2009535bcd182335 /toys/pending/lspci.c | |
parent | 098ff070fdafc1b3f5ec037a8b17365a176ec184 (diff) | |
download | toybox-b06b0fe32361f7fc5b3fb98bf5f2c2791be757e8.tar.gz |
lspci text output: add -i, allow -n when disabled
-i is how standard lspci handles changing the PCI ID database.
lspci -n should be a no-op when text is disabled.
Diffstat (limited to 'toys/pending/lspci.c')
-rw-r--r-- | toys/pending/lspci.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/toys/pending/lspci.c b/toys/pending/lspci.c index b557e459..c61f5820 100644 --- a/toys/pending/lspci.c +++ b/toys/pending/lspci.c @@ -1,7 +1,7 @@ /* * lspci - written by Isaac Dunham -USE_LSPCI(NEWTOY(lspci, "emk"USE_LSPCI_TEXT("n@"), TOYFLAG_USR|TOYFLAG_BIN)) +USE_LSPCI(NEWTOY(lspci, "emkn"USE_LSPCI_TEXT("@i:"), TOYFLAG_USR|TOYFLAG_BIN)) config LSPCI bool "lspci" @@ -20,15 +20,17 @@ config LSPCI_TEXT depends on LSPCI default n help - usage: lspci [-n] + usage: lspci [-n] [-i /usr/share/misc/pci.ids ] -n Numeric output (repeat for readable and numeric) + -i Path to PCI ID database */ #define FOR_lspci #include "toys.h" GLOBALS( + char *ids; long numeric; FILE *db; @@ -138,7 +140,7 @@ int do_lspci(struct dirtree *new) void lspci_main(void) { if (CFG_LSPCI_TEXT && (TT.numeric != 1)) { - TT.db = fopen("/usr/share/misc/pci.ids", "r"); + TT.db = fopen(TT.ids ? TT.ids : "/usr/share/misc/pci.ids", "r"); if (errno) { TT.numeric = 1; error_msg("could not open PCI ID db"); |