Annotation of researchv10dc/sys/mkconf/main.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * make configuration files for unix v9
                      3:  */
                      4: 
                      5: #include <libc.h>
                      6: #include "mkconf.h"
                      7: 
                      8: Mdev *mlist;   /* master list of devices; no particular order */
                      9: Dev *dlist;    /* configured devices; clustered by type, sorted within by id */
                     10: Scb *llist;    /* scb offsets; sorted by offset */
                     11: 
                     12: char *tfile = "tab";
                     13: char *dfile = "devs";
                     14: char *lfile = "low";
                     15: char *oconf = "conf.c";
                     16: char *olow = "low.s";
                     17: 
                     18: #define        NCF     10
                     19: char *cfile[NCF] = {"conf"};
                     20: 
                     21: int errs;
                     22: 
                     23: main(argc, argv)
                     24: int argc;
                     25: char **argv;
                     26: {
                     27:        register char **p;
                     28: 
                     29:        p = cfile;
                     30:        while (--argc > 0) {
                     31:                if (**++argv != '-') {
                     32:                        if (p >= &cfile[NCF-1]) {
                     33:                                fprint(STDERR, "too many files\n");
                     34:                                exit(1);
                     35:                        }
                     36:                        *p++ = *argv;
                     37:                        continue;
                     38:                }
                     39:                if (argc == 1)
                     40:                        usage();
                     41:                if (strcmp(*argv, "-d") == 0) {
                     42:                        dfile = *++argv;
                     43:                        argc--;
                     44:                } else if (strcmp(*argv, "-t") == 0) {
                     45:                        tfile = *++argv;
                     46:                        argc--;
                     47:                } else if (strcmp(*argv, "-l") == 0) {
                     48:                        lfile = *++argv;
                     49:                        argc--;
                     50:                } else if (strcmp(*argv, "-c") == 0) {
                     51:                        oconf = *++argv;
                     52:                        argc--;
                     53:                } else if (strcmp(*argv, "-s") == 0) {
                     54:                        olow = *++argv;
                     55:                        argc--;
                     56:                } else
                     57:                        usage();
                     58:        }
                     59:        readdevs(dfile);
                     60:        readtab(tfile);
                     61:        readlow(lfile);
                     62:        for (p = cfile; *p; p++)
                     63:                readconf(*p);
                     64:        fixup();
                     65:        if (errs)
                     66:                exit(1);
                     67:        writconf(oconf);
                     68:        writlow(olow);
                     69:        exit(0);
                     70: }
                     71: 
                     72: usage()
                     73: {
                     74:        fprint(STDERR, "usage: mkconf [-d devices] [-l veclist] [-c conf.c] [-s low.s] conf\n");
                     75:        exit(1);
                     76: }

unix.superglobalmegacorp.com

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