Mercurial > hg > toybox
changeset 1293:5f59ec6e38ff draft
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.
author | Isaac Dunham <ibid.ag@gmail.com> |
---|---|
date | Tue, 20 May 2014 21:19:17 -0500 |
parents | 09ec8205e2fa |
children | 88abd5b68a17 |
files | toys/pending/lspci.c |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/toys/pending/lspci.c Mon May 19 19:34:55 2014 -0500 +++ b/toys/pending/lspci.c Tue May 20 21:19:17 2014 -0500 @@ -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 @@ 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 @@ 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");