From c7ec9d5377827015a106ebfc1f7153665d4a548a Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 20 Sep 1995 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1995-09-20 --- pc/dat.h | 6 ++++++ pc/main.c | 19 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/pc/dat.h b/pc/dat.h index 8adb080616f651b8b95dba49d99cfa6302848ab1..71a274c0e8100996c36e04dc4992ca33f328e349 100644 --- a/pc/dat.h +++ b/pc/dat.h @@ -182,6 +182,9 @@ struct PCArch /* * a parsed plan9.ini line */ +#define ISAOPTLEN 16 +#define NISAOPT 8 + struct ISAConf { char type[NAMELEN]; ulong port; @@ -191,6 +194,9 @@ struct ISAConf { ulong size; ulong freq; uchar ea[6]; + + int nopt; + char opt[NISAOPT][ISAOPTLEN]; }; /* diff --git a/pc/main.c b/pc/main.c index d14f2033b6ee517fee2a0b3e58eb27ba379aa8ee..f1c259a2697178a6e4721054e6cfe0129b533ab9 100644 --- a/pc/main.c +++ b/pc/main.c @@ -728,13 +728,14 @@ parseether(uchar *to, char *from) int isaconfig(char *class, int ctlrno, ISAConf *isa) { - char cc[NAMELEN], *p, *q; + char cc[NAMELEN], *p, *q, *r; int n; sprint(cc, "%s%d", class, ctlrno); for(n = 0; n < nconf; n++){ if(strncmp(confname[n], cc, NAMELEN)) continue; + isa->nopt = 0; p = confval[n]; while(*p){ while(*p == ' ' || *p == '\t') @@ -762,8 +763,20 @@ isaconfig(char *class, int ctlrno, ISAConf *isa) isa->size = strtoul(p+5, &p, 0); else if(strncmp(p, "freq=", 5) == 0) isa->freq = strtoul(p+5, &p, 0); - else if(strncmp(p, "ea=", 3) == 0) - parseether(isa->ea, p+3); + else if(strncmp(p, "ea=", 3) == 0){ + if(parseether(isa->ea, p+3) == -1) + memset(isa->ea, 0, 6); + } + else if(isa->nopt < NISAOPT){ + r = isa->opt[isa->nopt]; + while(*p && *p != ' ' && *p != '\t'){ + *r++ = *p++; + if(r-isa->opt[isa->nopt] >= ISAOPTLEN-1) + break; + } + *r = '\0'; + isa->nopt++; + } while(*p && *p != ' ' && *p != '\t') p++; }