aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-05-24 22:40:41 -0500
committerRob Landley <rob@landley.net>2014-05-24 22:40:41 -0500
commit67ba22986d84b8d793d9bb39d6d7545204924124 (patch)
treeffe5c24428737bc67df233eda00874cf660e3efd /toys
parentf9c3fc8475722679029cd653d98965fb2767f20c (diff)
downloadtoybox-67ba22986d84b8d793d9bb39d6d7545204924124.tar.gz
Bugfix from Isaac Dunham (new pci database has # comments in it) and some minor cleanups I had in my tree already.
Diffstat (limited to 'toys')
-rw-r--r--toys/pending/lspci.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/toys/pending/lspci.c b/toys/pending/lspci.c
index c61f5820..aef40d8b 100644
--- a/toys/pending/lspci.c
+++ b/toys/pending/lspci.c
@@ -20,10 +20,11 @@ config LSPCI_TEXT
depends on LSPCI
default n
help
- usage: lspci [-n] [-i /usr/share/misc/pci.ids ]
+ usage: lspci [-n] [-i FILE ]
-n Numeric output (repeat for readable and numeric)
- -i Path to PCI ID database
+ -i PCI ID database (default /usr/share/misc/pci.ids)
+
*/
#define FOR_lspci
@@ -44,6 +45,7 @@ char *id_check_match(char *id, char *buf)
if (id[i] == buf[i]) i++;
else return 0;
}
+
return buf + i + 2;
}
@@ -67,7 +69,8 @@ int find_in_db(char *vendid, char *devid, FILE *fil, char *vname, char *devname)
strncpy(vname, vtext, strlen(vtext) - 1);
}
while (!*devname) {
- if (!fgets(buf, 255, fil) || *buf != '\t') return 1;
+ if (!fgets(buf, 255, fil) || (*buf != '\t' && *buf != '#')) return 1;
+ if (*buf == '#') continue;
if ((dtext = id_check_match(devid, buf + 1)))
strncpy(devname, dtext, strlen(dtext) - 1);
}
@@ -139,7 +142,7 @@ int do_lspci(struct dirtree *new)
void lspci_main(void)
{
- if (CFG_LSPCI_TEXT && (TT.numeric != 1)) {
+ if (CFG_LSPCI_TEXT && TT.numeric != 1) {
TT.db = fopen(TT.ids ? TT.ids : "/usr/share/misc/pci.ids", "r");
if (errno) {
TT.numeric = 1;