added RXIOC_MASK
[unix-history] / usr / src / usr.sbin / config / mkmakefile.c
index a5183ad..74cc2ba 100644 (file)
@@ -1,4 +1,4 @@
-/*     mkmakefile.c    1.20    82/10/24        */
+/*     mkmakefile.c    1.26    83/02/21        */
 
 /*
  * Build the makefile for the system, from
 
 /*
  * Build the makefile for the system, from
@@ -13,8 +13,8 @@
 
 #define next_word(fp, wd) \
        { register char *word = get_word(fp); \
 
 #define next_word(fp, wd) \
        { register char *word = get_word(fp); \
-         if (word == EOF) \
-               return (EOF); \
+         if (word == (char *)EOF) \
+               return; \
          else \
                wd = word; \
        }
          else \
                wd = word; \
        }
@@ -30,7 +30,7 @@ fl_lookup(file)
 {
        register struct file_list *fp;
 
 {
        register struct file_list *fp;
 
-       for (fp = ftab ; fp != NULL; fp = fp->f_next) {
+       for (fp = ftab ; fp != 0; fp = fp->f_next) {
                if (eq(fp->f_fn, file))
                        return (fp);
        }
                if (eq(fp->f_fn, file))
                        return (fp);
        }
@@ -46,8 +46,9 @@ new_fent()
        register struct file_list *fp;
 
        fp = (struct file_list *) malloc(sizeof *fp);
        register struct file_list *fp;
 
        fp = (struct file_list *) malloc(sizeof *fp);
-       fp->f_needs = fp->f_next = NULL;
-       if (fcur == NULL)
+       fp->f_needs = 0;
+       fp->f_next = 0;
+       if (fcur == 0)
                fcur = ftab = fp;
        else
                fcur->f_next = fp;
                fcur = ftab = fp;
        else
                fcur->f_next = fp;
@@ -68,14 +69,14 @@ makefile()
 
        read_files();
        strcpy(line, "../conf/makefile.");
 
        read_files();
        strcpy(line, "../conf/makefile.");
-       strcat(line, machinename);
+       (void) strcat(line, machinename);
        ifp = fopen(line, "r");
        ifp = fopen(line, "r");
-       if (ifp == NULL) {
+       if (ifp == 0) {
                perror(line);
                exit(1);
        }
        ofp = fopen(path("makefile"), "w");
                perror(line);
                exit(1);
        }
        ofp = fopen(path("makefile"), "w");
-       if (ofp == NULL) {
+       if (ofp == 0) {
                perror(path("makefile"));
                exit(1);
        }
                perror(path("makefile"));
                exit(1);
        }
@@ -98,6 +99,7 @@ makefile()
        fprintf(ofp, "\n");
        if (hadtz == 0)
                printf("timezone not specified; gmt assumed\n");
        fprintf(ofp, "\n");
        if (hadtz == 0)
                printf("timezone not specified; gmt assumed\n");
+#ifdef vax
        if (maxusers == 0) {
                printf("maxusers not specified; 24 assumed\n");
                maxusers = 24;
        if (maxusers == 0) {
                printf("maxusers not specified; 24 assumed\n");
                maxusers = 24;
@@ -108,22 +110,35 @@ makefile()
                printf("maxusers truncated to 128\n");
                maxusers = 128;
        }
                printf("maxusers truncated to 128\n");
                maxusers = 128;
        }
+#endif
+#ifdef sun
+       if (maxusers == 0) {
+               printf("maxusers not specified; 8 assumed\n");
+               maxusers = 8;
+       } else if (maxusers < 2) {
+               printf("minimum of 2 maxusers assumed\n");
+               maxusers = 2;
+       } else if (maxusers > 32) {
+               printf("maxusers truncated to 32\n");
+               maxusers = 32;
+       }
+#endif
        fprintf(ofp, "PARAM=-DTIMEZONE=%d -DDST=%d -DMAXUSERS=%d\n",
            timezone, dst, maxusers);
        fprintf(ofp, "PARAM=-DTIMEZONE=%d -DDST=%d -DMAXUSERS=%d\n",
            timezone, dst, maxusers);
-       while (fgets(line, BUFSIZ, ifp) != NULL) {
+       while (fgets(line, BUFSIZ, ifp) != 0) {
                if (*line == '%')
                        goto percent;
                if (profiling && strncmp(line, "COPTS=", 6) == 0) {
                        register char *cp;
 
                if (*line == '%')
                        goto percent;
                if (profiling && strncmp(line, "COPTS=", 6) == 0) {
                        register char *cp;
 
-                       fprintf(ofp, "CRT0.EX=/usr/src/libc/csu/crt0.ex\n");
+                       fprintf(ofp, "GPROF.EX=/usr/src/lib/libc/csu/gmon.ex\n");
                        cp = index(line, '\n');
                        if (cp)
                                *cp = 0;
                        cp = line + 6;
                        while (*cp && (*cp == ' ' || *cp == '\t'))
                                cp++;
                        cp = index(line, '\n');
                        if (cp)
                                *cp = 0;
                        cp = line + 6;
                        while (*cp && (*cp == ' ' || *cp == '\t'))
                                cp++;
-                       COPTS = malloc(strlen(cp) + 1);
+                       COPTS = malloc((unsigned)(strlen(cp) + 1));
                        if (COPTS == 0) {
                                printf("config: out of memory\n");
                                exit(1);
                        if (COPTS == 0) {
                                printf("config: out of memory\n");
                                exit(1);
@@ -147,9 +162,9 @@ makefile()
                        fprintf(stderr,
                            "Unknown %% construct in generic makefile: %s",
                            line);
                        fprintf(stderr,
                            "Unknown %% construct in generic makefile: %s",
                            line);
-               fclose(ifp);
-               fclose(ofp);
        }
        }
+       (void) fclose(ifp);
+       (void) fclose(ofp);
 }
 
 /*
 }
 
 /*
@@ -166,31 +181,31 @@ read_files()
        int nreqs;
        int first = 1;
 
        int nreqs;
        int first = 1;
 
-       ftab = NULL;
-       strcpy(fname, "files");
+       ftab = 0;
+       (void) strcpy(fname, "files");
 openit:
        fp = fopen(fname, "r");
 openit:
        fp = fopen(fname, "r");
-       if (fp == NULL) {
-               perror("../conf/files");
+       if (fp == 0) {
+               perror(fname);
                exit(1);
        }
 next:
        /* filename     [ standard | optional dev* ] [ device-driver ] */
        wd = get_word(fp);
                exit(1);
        }
 next:
        /* filename     [ standard | optional dev* ] [ device-driver ] */
        wd = get_word(fp);
-       if (wd == EOF) {
-               fclose(fp);
+       if (wd == (char *)EOF) {
+               (void) fclose(fp);
                if (first) {
                if (first) {
-                       sprintf(fname, "files.%s", machinename);
+                       (void) sprintf(fname, "files.%s", machinename);
                        first = 0;
                        goto openit;
                }
                return;
        }
                        first = 0;
                        goto openit;
                }
                return;
        }
-       if (wd == NULL)
+       if (wd == 0)
                goto next;
        this = ns(wd);
        next_word(fp, wd);
                goto next;
        this = ns(wd);
        next_word(fp, wd);
-       if (wd == NULL) {
+       if (wd == 0) {
                printf("%s: No type for %s.\n",
                    fname, this);
                exit(1);
                printf("%s: No type for %s.\n",
                    fname, this);
                exit(1);
@@ -206,24 +221,26 @@ next:
        if (eq(wd, "standard"))
                goto checkdev;
        if (!eq(wd, "optional")) {
        if (eq(wd, "standard"))
                goto checkdev;
        if (!eq(wd, "optional")) {
-               printf("%s: %s must be optional or standard",
+               printf("%s: %s must be optional or standard\n",
                    fname, this);
                exit(1);
        }
 nextopt:
        next_word(fp, wd);
                    fname, this);
                exit(1);
        }
 nextopt:
        next_word(fp, wd);
-       if (wd == NULL)
+       if (wd == 0)
                goto doneopt;
        devorprof = wd;
                goto doneopt;
        devorprof = wd;
-       if (eq(wd, "device-driver") || eq(wd, "profiling-routine"))
+       if (eq(wd, "device-driver") || eq(wd, "profiling-routine")) {
+               next_word(fp, wd);
                goto save;
                goto save;
+       }
        nreqs++;
        if (needs == 0)
                needs = ns(wd);
        nreqs++;
        if (needs == 0)
                needs = ns(wd);
-       for (dp = dtab; dp != NULL; dp = dp->d_next)
+       for (dp = dtab; dp != 0; dp = dp->d_next)
                if (eq(dp->d_name, wd))
                        goto nextopt;
                if (eq(dp->d_name, wd))
                        goto nextopt;
-       while ((wd = get_word(fp)) != NULL)
+       while ((wd = get_word(fp)) != 0)
                ;
        tp = new_fent();
        tp->f_fn = this;
                ;
        tp = new_fent();
        tp->f_fn = this;
@@ -239,17 +256,19 @@ doneopt:
 checkdev:
        if (wd) {
                next_word(fp, wd);
 checkdev:
        if (wd) {
                next_word(fp, wd);
-               if (wd != NULL) {
+               if (wd != 0) {
                        devorprof = wd;
                        next_word(fp, wd);
                }
        }
 save:
                        devorprof = wd;
                        next_word(fp, wd);
                }
        }
 save:
-       if (wd != NULL) {
+       if (wd != 0) {
                printf("%s: syntax error describing %s\n",
                    fname, this);
                exit(1);
        }
                printf("%s: syntax error describing %s\n",
                    fname, this);
                exit(1);
        }
+       if (eq(devorprof, "profiling-routine") && profiling == 0)
+               goto next;
        tp = new_fent();
        tp->f_fn = this;
        if (eq(devorprof, "device-driver"))
        tp = new_fent();
        tp->f_fn = this;
        if (eq(devorprof, "device-driver"))
@@ -272,7 +291,7 @@ do_objs(fp)
 
        fprintf(fp, "OBJS=");
        lpos = 6;
 
        fprintf(fp, "OBJS=");
        lpos = 6;
-       for (tp = ftab; tp != NULL; tp = tp->f_next) {
+       for (tp = ftab; tp != 0; tp = tp->f_next) {
                if (tp->f_type == INVISIBLE)
                        continue;
                sp = tail(tp->f_fn);
                if (tp->f_type == INVISIBLE)
                        continue;
                sp = tail(tp->f_fn);
@@ -299,7 +318,7 @@ do_cfiles(fp)
 
        fprintf(fp, "CFILES=");
        lpos = 8;
 
        fprintf(fp, "CFILES=");
        lpos = 8;
-       for (tp = ftab; tp != NULL; tp = tp->f_next) {
+       for (tp = ftab; tp != 0; tp = tp->f_next) {
                if (tp->f_type == INVISIBLE)
                        continue;
                if (tp->f_fn[strlen(tp->f_fn)-1] != 'c')
                if (tp->f_type == INVISIBLE)
                        continue;
                if (tp->f_fn[strlen(tp->f_fn)-1] != 'c')
@@ -338,7 +357,7 @@ do_rules(f)
        register char *cp, *np, och, *tp;
        register struct file_list *ftp;
 
        register char *cp, *np, och, *tp;
        register struct file_list *ftp;
 
-for (ftp = ftab; ftp != NULL; ftp = ftp->f_next) {
+for (ftp = ftab; ftp != 0; ftp = ftp->f_next) {
        if (ftp->f_type == INVISIBLE)
                continue;
        cp = (np = ftp->f_fn) + strlen(ftp->f_fn) - 1;
        if (ftp->f_type == INVISIBLE)
                continue;
        cp = (np = ftp->f_fn) + strlen(ftp->f_fn) - 1;
@@ -397,10 +416,10 @@ for (ftp = ftab; ftp != NULL; ftp = ftp->f_next) {
 
                case MACHINE_VAX:
                        fprintf(f, "\t${CC} -I. -c -S %s ../%sc\n", COPTS, np);
 
                case MACHINE_VAX:
                        fprintf(f, "\t${CC} -I. -c -S %s ../%sc\n", COPTS, np);
-                       fprintf(f, "\tex - %ss < ${CRT0.EX}\n", tp);
+                       fprintf(f, "\tex - %ss < ${GPROF.EX}\n", tp);
                        fprintf(f,
                        fprintf(f,
-                 "\t/lib/cpp %ss | sed -f ../conf/asm.sed | ${AS} -o %so\n",
-                         tp, tp);
+                           "\tsed -f ../vax/asm.sed %ss | ${AS} -o %so\n",
+                           tp, tp);
                        fprintf(f, "\trm -f %ss\n\n", tp);
                        break;
 
                        fprintf(f, "\trm -f %ss\n\n", tp);
                        break;
 
@@ -409,6 +428,7 @@ for (ftp = ftab; ftp != NULL; ftp = ftp->f_next) {
                            "config: don't know how to profile kernel on sun\n");
                        break;
                }
                            "config: don't know how to profile kernel on sun\n");
                        break;
                }
+               break;
 
        default:
                printf("Don't know rules for %s", np);
 
        default:
                printf("Don't know rules for %s", np);
@@ -427,7 +447,7 @@ do_load(f)
        register struct file_list *fl;
        int first = 1;
 
        register struct file_list *fl;
        int first = 1;
 
-       for (fl = conf_list; fl != NULL; fl = fl->f_next) {
+       for (fl = conf_list; fl != 0; fl = fl->f_next) {
                fprintf(f, "%s: makefile locore.o ${OBJS} param.o",
                    fl->f_needs);
                fprintf(f, " ioconf.o swap%s.o\n", fl->f_fn);
                fprintf(f, "%s: makefile locore.o ${OBJS} param.o",
                    fl->f_needs);
                fprintf(f, " ioconf.o swap%s.o\n", fl->f_fn);
@@ -460,7 +480,7 @@ do_load(f)
                fprintf(f, "\t@size %s\n", fl->f_needs);
                fprintf(f, "\t@chmod 755 %s\n\n", fl->f_needs);
        }
                fprintf(f, "\t@size %s\n", fl->f_needs);
                fprintf(f, "\t@chmod 755 %s\n\n", fl->f_needs);
        }
-       for (fl = conf_list; fl != NULL; fl = fl->f_next) {
+       for (fl = conf_list; fl != 0; fl = fl->f_next) {
                fprintf(f, "swap%s.o: ../%s/swap%s.c\n",
                    fl->f_fn, machinename, fl->f_fn);
                switch (machine) {
                fprintf(f, "swap%s.o: ../%s/swap%s.c\n",
                    fl->f_fn, machinename, fl->f_fn);
                switch (machine) {
@@ -482,11 +502,12 @@ do_load(f)
                }
        }
        fprintf(f, "all:");
                }
        }
        fprintf(f, "all:");
-       for (fl = conf_list; fl != NULL; fl = fl->f_next)
+       for (fl = conf_list; fl != 0; fl = fl->f_next)
                fprintf(f, " %s", fl->f_needs);
        fprintf(f, "\n");
 }
 
                fprintf(f, " %s", fl->f_needs);
        fprintf(f, "\n");
 }
 
+char *
 raise(str)
        register char *str;
 {
 raise(str)
        register char *str;
 {