X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fnames.c;h=01f141781dd0ba6ef6c5d2b9af0a829b6be4a5ef;hb=087e22e7bfdfc3eb0664ac9cca571c3858d838c9;hp=704013f410c8fb9f5c9549192f68b6901debe6f4;hpb=a239ade69720d1fc329a30fed63fd6237c41fd22;p=pciutils.git diff --git a/lib/names.c b/lib/names.c index 704013f..01f1417 100644 --- a/lib/names.c +++ b/lib/names.c @@ -1,9 +1,7 @@ /* - * $Id: names.c,v 1.6 2000/04/29 12:56:23 mj Exp $ - * * The PCI Library -- ID to Name Translation * - * Copyright (c) 1997--2000 Martin Mares + * Copyright (c) 1997--2002 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -98,19 +96,10 @@ parse_name_list(struct pci_access *a) lino++; q = p; while (*p && *p != '\n') - { - if (*p == '#') - { - *p++ = 0; - while (*p && *p != '\n') - p++; - break; - } - p++; - } + p++; if (*p == '\n') *p++ = 0; - if (!*q) + if (!*q || *q == '#') continue; r = p; while (r > q && r[-1] == ' ') @@ -284,7 +273,7 @@ pci_lookup_name(struct pci_access *a, char *buf, int size, int flags, u32 arg1, if (n = nl_lookup(a, num, NL_VENDOR, arg3, 0, 0, 0)) return n->name; else - res = snprintf(buf, size, "%04x", arg1); + res = snprintf(buf, size, "%04x", arg3); break; case PCI_LOOKUP_DEVICE | PCI_LOOKUP_SUBSYSTEM: if (n = nl_lookup(a, num, NL_SUBSYSTEM, arg1, arg2, arg3, arg4)) @@ -292,7 +281,7 @@ pci_lookup_name(struct pci_access *a, char *buf, int size, int flags, u32 arg1, else if (arg1 == arg3 && arg2 == arg4 && (n = nl_lookup(a, num, NL_DEVICE, arg1, arg2, 0, 0))) return n->name; else - res = snprintf(buf, size, "%04x", arg2); + res = snprintf(buf, size, "%04x", arg4); break; case PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE | PCI_LOOKUP_SUBSYSTEM: if (!num)