Annotation of cci/usr/src/etc/config/main.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char sccsid[] = "@(#)main.c     1.10 (Berkeley) 8/11/83";
        !             3: #endif
        !             4: 
        !             5: #include <stdio.h>
        !             6: #include <ctype.h>
        !             7: #include "y.tab.h"
        !             8: #include "config.h"
        !             9: 
        !            10: /*
        !            11:  * Config builds a set of files for building a UNIX
        !            12:  * system given a description of the desired system.
        !            13:  */
        !            14: main(argc, argv)
        !            15:        int argc;
        !            16:        char **argv;
        !            17: {
        !            18: 
        !            19:        if (argc > 1 && eq("-p", argv[1])) {
        !            20:                fprintf(stderr,"The -p flag is not implemented\n");
        !            21:                /*
        !            22:                profiling++;
        !            23:                */
        !            24:                argc--, argv++;
        !            25:        }
        !            26:        if (argc != 2) {
        !            27:                fprintf(stderr, "usage: config [ -p ] sysname\n");
        !            28:                exit(1);
        !            29:        }
        !            30:        PREFIX = argv[1];
        !            31:        if (freopen(argv[1], "r", stdin) == NULL) {
        !            32:                perror(argv[1]);
        !            33:                exit(2);
        !            34:        }
        !            35:        dtab = NULL;
        !            36:        confp = &conf_list;
        !            37:        if (yyparse())
        !            38:                exit(3);
        !            39:        switch (machine) {
        !            40: 
        !            41:        case MACHINE_VAX:
        !            42:                vax_ioconf();           /* Print ioconf.c */
        !            43:                ubglue();               /* Create ubglue.s */
        !            44:                break;
        !            45: 
        !            46:        case MACHINE_TAHOE:
        !            47:                tahoe_ioconf();         /* Print ioconf.c */
        !            48:                ubglue();               /* Create ubglue.s */
        !            49:                break;
        !            50: 
        !            51:        case MACHINE_SUN:
        !            52:                sun_ioconf();
        !            53:                break;
        !            54: 
        !            55:        default:
        !            56:                printf("Specify machine type, e.g. ``machine vax''\n");
        !            57:                exit(1);
        !            58:        }
        !            59:        makefile();                     /* build Makefile */
        !            60:        headers();                      /* make a lot of .h files */
        !            61:        swapconf();                     /* swap config files */
        !            62:        printf("Don't forget to run \"make depend\"\n");
        !            63: }
        !            64: 
        !            65: /*
        !            66:  * get_word
        !            67:  *     returns EOF on end of file
        !            68:  *     NULL on end of line
        !            69:  *     pointer to the word otherwise
        !            70:  */
        !            71: char *
        !            72: get_word(fp)
        !            73:        register FILE *fp;
        !            74: {
        !            75:        static char line[80];
        !            76:        register int ch;
        !            77:        register char *cp;
        !            78: 
        !            79:        while ((ch = getc(fp)) != EOF)
        !            80:                if (ch != ' ' && ch != '\t')
        !            81:                        break;
        !            82:        if (ch == EOF)
        !            83:                return ((char *)EOF);
        !            84:        if (ch == '\n')
        !            85:                return (NULL);
        !            86:        cp = line;
        !            87:        *cp++ = ch;
        !            88:        while ((ch = getc(fp)) != EOF) {
        !            89:                if (isspace(ch))
        !            90:                        break;
        !            91:                *cp++ = ch;
        !            92:        }
        !            93:        *cp = 0;
        !            94:        if (ch == EOF)
        !            95:                return ((char *)EOF);
        !            96:        (void) ungetc(ch, fp);
        !            97:        return (line);
        !            98: }
        !            99: 
        !           100: /*
        !           101:  * prepend the path to a filename
        !           102:  */
        !           103: char *
        !           104: path(file)
        !           105:        char *file;
        !           106: {
        !           107:        register char *cp;
        !           108: 
        !           109:        cp = malloc((unsigned)(strlen(PREFIX)+strlen(file)+5));
        !           110:        (void) strcpy(cp, "../");
        !           111:        (void) strcat(cp, PREFIX);
        !           112:        (void) strcat(cp, "/");
        !           113:        (void) strcat(cp, file);
        !           114:        return (cp);
        !           115: }

unix.superglobalmegacorp.com

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