diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ndiscvt/inf.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/usr.sbin/ndiscvt/inf.c b/usr.sbin/ndiscvt/inf.c index f0cacee5dcc0..100fd903545c 100644 --- a/usr.sbin/ndiscvt/inf.c +++ b/usr.sbin/ndiscvt/inf.c @@ -184,6 +184,7 @@ dump_deviceids() struct section *sec; struct assign *assign; char xpsec[256]; + int found = 0; /* Find manufacturer name */ manf = find_assign("Manufacturer", NULL); @@ -203,6 +204,8 @@ dump_deviceids() /* Emit start of device table */ fprintf (ofp, "#define NDIS_DEV_TABLE"); +retry: + /* * Now run through all the device names listed * in the manufacturer section and dump out the @@ -222,9 +225,17 @@ dump_deviceids() #endif /* Emit device description */ fprintf (ofp, "\t\\\n\t\"%s\" },", dev->vals[0]); + found++; } } + /* Someone tried to fool us. Shame on them. */ + if (!found) { + found++; + sec = find_section(manf->vals[0]); + goto retry; + } + /* Emit end of table */ fprintf(ofp, "\n\n"); @@ -407,7 +418,7 @@ dump_regvals(void) struct section *sec; struct assign *assign; char sname[256]; - int i, is_winxp = 0, is_winnt = 0, devidx = 0; + int found = 0, i, is_winxp = 0, is_winnt = 0, devidx = 0; /* Find signature to check for special case of WinNT. */ assign = find_assign("version", "signature"); @@ -433,8 +444,11 @@ dump_regvals(void) /* Emit start of block */ fprintf (ofp, "ndis_cfg ndis_regvals[] = {"); +retry: + TAILQ_FOREACH(assign, &ah, link) { if (assign->section == sec) { + found++; /* * Find all the AddReg sections. * Look for section names with .NT, unless @@ -464,6 +478,13 @@ dump_regvals(void) } } + if (!found) { + sec = find_section(manf->vals[0]); + is_winxp = 0; + found++; + goto retry; + } + fprintf(ofp, "\n\t{ NULL, NULL, { 0 }, 0 }\n};\n\n"); return; |