Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/mpc/conf.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname mpc/conf.c 2000/0516
## diff -e /dev/null /n/emeliedump/2000/0516/sys/src/9/mpc/conf.c
0a
#include	"u.h"
#include	"../port/lib.h"
#include	"mem.h"
#include	"dat.h"
#include	"fns.h"
#include	"io.h"
#include	"init.h"

char*
getconf(char *name)
{
	char **p;
	int n;

	n = strlen(name);

	for(p = conf; *p; p++) {
		if(strncmp(*p, name, n) == 0 && (*p)[n] == '=')
			return *p+n+1;
	}
	return 0;
}

int
isaconfig(char *class, int ctlrno, ISAConf *isa)
{
	char cc[NAMELEN], *p, *q, *r;

	strcpy(cc, class);
	p = cc + strlen(cc);
	*p++ = ctlrno + '0';
	*p = 0;

	p = getconf(cc);
	if(p == 0)
		return 0;

	while(*p){
		while(*p == ' ' || *p == '\t')
			p++;
		if(*p == '\0')
			break;
		if(strncmp(p, "type=", 5) == 0){
			p += 5;
			for(q = isa->type; q < &isa->type[NAMELEN-1]; q++){
				if(*p == '\0' || *p == ' ' || *p == '\t')
					break;
				*q = *p++;
			}
			*q = '\0';
		}
		else if(strncmp(p, "port=", 5) == 0)
			isa->port = strtoul(p+5, &p, 0);
		else if(strncmp(p, "irq=", 4) == 0)
			isa->irq = strtoul(p+4, &p, 0);
		else if(strncmp(p, "mem=", 4) == 0)
			isa->mem = strtoul(p+4, &p, 0);
		else if(strncmp(p, "size=", 5) == 0)
			isa->size = strtoul(p+5, &p, 0);
		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++;
	}
	return 1;
}
.
## diffname mpc/conf.c 2001/0527 # deleted
## diff -e /n/emeliedump/2000/0516/sys/src/9/mpc/conf.c /n/emeliedump/2001/0527/sys/src/9/mpc/conf.c
1,74d

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.