~kris/9p

9hist

c7ec9d5377827015a106ebfc1f7153665d4a548a — David du Colombier 31 years ago 107c304
Plan 9 from Bell Labs 1995-09-20
2 files changed, 22 insertions(+), 3 deletions(-)

M pc/dat.h
M pc/main.c
M pc/dat.h => pc/dat.h +6 -0
@@ 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];
};

/*

M pc/main.c => pc/main.c +16 -3
@@ 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++;
		}