/*
- * $Id: names.c,v 1.1 1997/12/23 10:29:18 mj Exp $
+ * $Id: names.c,v 1.3 1998/01/27 11:50:10 mj Exp $
*
* Linux PCI Utilities -- Device ID to Name Translation
*
- * Copyright (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ * Copyright (c) 1997, 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
int show_numeric_ids;
+char *pci_ids = ETC_PCI_IDS;
+
static byte *name_list;
static int name_list_loaded;
static void
err_name_list(char *msg)
{
- fprintf(stderr, ETC_PCI_IDS ": %s: %m\n", msg);
+ fprintf(stderr, "%s: %s: %m\n", pci_ids, msg);
exit(1);
}
goto parserr;
if (nl_add(i, j, q))
{
- fprintf(stderr, ETC_PCI_IDS ", line %d: duplicate entry\n", lino);
+ fprintf(stderr, "%s, line %d: duplicate entry\n", pci_ids, lino);
exit(1);
}
}
return;
parserr:
- fprintf(stderr, ETC_PCI_IDS ", line %d: parse error\n", lino);
+ fprintf(stderr, "%s, line %d: parse error\n", pci_ids, lino);
exit(1);
}
int fd;
struct stat st;
- fd = open(ETC_PCI_IDS, O_RDONLY);
+ fd = open(pci_ids, O_RDONLY);
if (fd < 0)
{
show_numeric_ids = 1;
{
static char vendbuf[6];
+ if (!show_numeric_ids && !name_list_loaded)
+ load_name_list();
if (!show_numeric_ids)
{
struct nl_entry *e;
- if (!name_list_loaded)
- load_name_list();
e = nl_lookup(ID1_VENDOR, i);
if (e)
return e->name;
{
static char devbuf[6];
+ if (!show_numeric_ids && !name_list_loaded)
+ load_name_list();
if (!show_numeric_ids)
{
struct nl_entry *e;
- if (!name_list_loaded)
- load_name_list();
e = nl_lookup(v, i);
if (e)
return e->name;
{
static char fullbuf[256];
+ if (!show_numeric_ids && !name_list_loaded)
+ load_name_list();
if (!show_numeric_ids)
{
struct nl_entry *e, *e2;
- if (!name_list_loaded)
- load_name_list();
e = nl_lookup(ID1_VENDOR, v);
e2 = nl_lookup(v, i);
if (!e)
{
static char classbuf[80];
+ if (!show_numeric_ids && !name_list_loaded)
+ load_name_list();
if (!show_numeric_ids)
{
struct nl_entry *e;
- if (!name_list_loaded)
- load_name_list();
e = nl_lookup(ID1_SUBCLASS, c);
if (e)
return e->name;