summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ndiscvt
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2005-05-15 19:46:14 +0000
committerwpaul <wpaul@FreeBSD.org>2005-05-15 19:46:14 +0000
commitdd14237cdafb5e0124ab3277ac0ac8f9eaf03aa0 (patch)
treeeedea5ef8d843be22a788b1fa65344e95f66b8e6 /usr.sbin/ndiscvt
parentfb7687b6e1bed5547a42654c53abfa0c0be9c3d3 (diff)
downloadFreeBSD-src-dd14237cdafb5e0124ab3277ac0ac8f9eaf03aa0.zip
FreeBSD-src-dd14237cdafb5e0124ab3277ac0ac8f9eaf03aa0.tar.gz
Update ndiscvt to handle .INF files that specify multiple entries in
their [Manufacturer] sections.
Diffstat (limited to 'usr.sbin/ndiscvt')
-rw-r--r--usr.sbin/ndiscvt/inf.c64
1 files changed, 56 insertions, 8 deletions
diff --git a/usr.sbin/ndiscvt/inf.c b/usr.sbin/ndiscvt/inf.c
index e872d45..c3d965c 100644
--- a/usr.sbin/ndiscvt/inf.c
+++ b/usr.sbin/ndiscvt/inf.c
@@ -55,6 +55,9 @@ static struct assign_head ah;
static char *sstrdup (const char *);
static struct assign
*find_assign (const char *, const char *);
+static struct assign
+ *find_next_assign
+ (struct assign *);
static struct section
*find_section (const char *);
static void dump_deviceids_pci (void);
@@ -126,6 +129,24 @@ find_assign (const char *s, const char *k)
return(NULL);
}
+static struct assign *
+find_next_assign (struct assign *a)
+{
+ struct assign *assign;
+
+ TAILQ_FOREACH(assign, &ah, link) {
+ if (assign == a)
+ break;
+ }
+
+ assign = assign->link.tqe_next;
+
+ if (assign == NULL || assign->section != a->section)
+ return(NULL);
+
+ return (assign);
+}
+
static const char *
stringcvt(const char *s)
{
@@ -239,9 +260,14 @@ dump_deviceids_pci()
char xpsec[256];
int found = 0;
+ /* Emit start of PCI device table */
+ fprintf (ofp, "#define NDIS_PCI_DEV_TABLE");
+
/* Find manufacturer name */
manf = find_assign("Manufacturer", NULL);
+nextmanf:
+
/* Find manufacturer section */
if (manf->vals[1] != NULL &&
(strcasecmp(manf->vals[1], "NT.5.1") == 0 ||
@@ -268,13 +294,10 @@ dump_deviceids_pci()
}
if (found == 0)
- return;
+ goto done;
found = 0;
- /* Emit start of PCI device table */
- fprintf (ofp, "#define NDIS_PCI_DEV_TABLE");
-
retry:
/*
@@ -304,10 +327,18 @@ retry:
goto retry;
}
+ /* Handle Manufacturer sections with multiple entries. */
+ manf = find_next_assign(manf);
+
+ if (manf != NULL)
+ goto nextmanf;
+
+done:
/* Emit end of table */
fprintf(ofp, "\n\n");
+ return;
}
static void
@@ -322,6 +353,8 @@ dump_deviceids_pcmcia()
/* Find manufacturer name */
manf = find_assign("Manufacturer", NULL);
+nextmanf:
+
/* Find manufacturer section */
if (manf->vals[1] != NULL &&
(strcasecmp(manf->vals[1], "NT.5.1") == 0 ||
@@ -348,7 +381,7 @@ dump_deviceids_pcmcia()
}
if (found == 0)
- return;
+ goto done;
found = 0;
@@ -384,10 +417,18 @@ retry:
goto retry;
}
+ /* Handle Manufacturer sections with multiple entries. */
+ manf = find_next_assign(manf);
+
+ if (manf != NULL)
+ goto nextmanf;
+
+done:
/* Emit end of table */
fprintf(ofp, "\n\n");
+ return;
}
static void
@@ -573,9 +614,14 @@ dump_regvals(void)
if (strcasecmp(assign->vals[0], "$windows nt$") == 0)
is_winnt++;
+ /* Emit start of block */
+ fprintf (ofp, "ndis_cfg ndis_regvals[] = {");
+
/* Find manufacturer name */
manf = find_assign("Manufacturer", NULL);
+nextmanf:
+
/* Find manufacturer section */
if (manf->vals[1] != NULL &&
(strcasecmp(manf->vals[1], "NT.5.1") == 0 ||
@@ -590,9 +636,6 @@ dump_regvals(void)
} else
sec = find_section(manf->vals[0]);
- /* Emit start of block */
- fprintf (ofp, "ndis_cfg ndis_regvals[] = {");
-
retry:
TAILQ_FOREACH(assign, &ah, link) {
@@ -640,6 +683,11 @@ retry:
goto retry;
}
+ manf = find_next_assign(manf);
+
+ if (manf != NULL)
+ goto nextmanf;
+
fprintf(ofp, "\n\t{ NULL, NULL, { 0 }, 0 }\n};\n\n");
return;
OpenPOWER on IntegriCloud