File:  [Research Unix] / researchv10no / sys / mkconf / main.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

/*
 * make configuration files for unix v9
 */

#include <libc.h>
#include "mkconf.h"

Mdev *mlist;	/* master list of devices; no particular order */
Dev *dlist;	/* configured devices; clustered by type, sorted within by id */
Scb *llist;	/* scb offsets; sorted by offset */

char *tfile = "tab";
char *dfile = "devs";
char *lfile = "low";
char *oconf = "conf.c";
char *olow = "low.s";

#define	NCF	10
char *cfile[NCF] = {"conf"};

int errs;

main(argc, argv)
int argc;
char **argv;
{
	register char **p;

	p = cfile;
	while (--argc > 0) {
		if (**++argv != '-') {
			if (p >= &cfile[NCF-1]) {
				fprint(STDERR, "too many files\n");
				exit(1);
			}
			*p++ = *argv;
			continue;
		}
		if (argc == 1)
			usage();
		if (strcmp(*argv, "-d") == 0) {
			dfile = *++argv;
			argc--;
		} else if (strcmp(*argv, "-t") == 0) {
			tfile = *++argv;
			argc--;
		} else if (strcmp(*argv, "-l") == 0) {
			lfile = *++argv;
			argc--;
		} else if (strcmp(*argv, "-c") == 0) {
			oconf = *++argv;
			argc--;
		} else if (strcmp(*argv, "-s") == 0) {
			olow = *++argv;
			argc--;
		} else
			usage();
	}
	readdevs(dfile);
	readtab(tfile);
	readlow(lfile);
	for (p = cfile; *p; p++)
		readconf(*p);
	fixup();
	if (errs)
		exit(1);
	writconf(oconf);
	writlow(olow);
	exit(0);
}

usage()
{
	fprint(STDERR, "usage: mkconf [-d devices] [-l veclist] [-c conf.c] [-s low.s] conf\n");
	exit(1);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.