install correct aliases file
[unix-history] / usr / src / usr.sbin / config / mkheaders.c
index ac99d98..e858701 100644 (file)
@@ -1,4 +1,23 @@
-/*     mkheaders.c     1.11    82/10/24        */
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)mkheaders.c        5.5 (Berkeley) %G%";
+#endif /* not lint */
 
 /*
  * Make all the .h files for the optional entries
 
 /*
  * Make all the .h files for the optional entries
@@ -32,7 +51,8 @@ do_count(dev, hname, search)
        for (count = 0,dp = dtab; dp != 0; dp = dp->d_next)
                if (dp->d_unit != -1 && eq(dp->d_name, dev)) {
                        if (dp->d_type == PSEUDO_DEVICE) {
        for (count = 0,dp = dtab; dp != 0; dp = dp->d_next)
                if (dp->d_unit != -1 && eq(dp->d_name, dev)) {
                        if (dp->d_type == PSEUDO_DEVICE) {
-                               count = dp->d_slave != UNKNOWN ? dp->d_slave : 1;
+                               count =
+                                   dp->d_slave != UNKNOWN ? dp->d_slave : 1;
                                break;
                        }
                        count++;
                                break;
                        }
                        count++;
@@ -45,7 +65,8 @@ do_count(dev, hname, search)
                                count = dp->d_unit + 1;
                        if (search) {
                                mp = dp->d_conn;
                                count = dp->d_unit + 1;
                        if (search) {
                                mp = dp->d_conn;
-                               if (mp != 0 && mp != -1 && mp->d_conn != -1) {
+                               if (mp != 0 && mp != TO_NEXUS &&
+                                   mp->d_conn != 0 && mp->d_conn != TO_NEXUS) {
                                        do_count(mp->d_name, hname, 0);
                                        search = 0;
                                }
                                        do_count(mp->d_name, hname, 0);
                                        search = 0;
                                }
@@ -74,19 +95,19 @@ do_header(dev, hname, count)
                        exit(1);
                }
                fprintf(outf, "#define %s %d\n", name, count);
                        exit(1);
                }
                fprintf(outf, "#define %s %d\n", name, count);
-               fclose(outf);
+               (void) fclose(outf);
                return;
        }
        fl_head = 0;
        for (;;) {
                char *cp;
                return;
        }
        fl_head = 0;
        for (;;) {
                char *cp;
-               if ((inw = get_word(inf)) == 0 || inw == EOF)
+               if ((inw = get_word(inf)) == 0 || inw == (char *)EOF)
                        break;
                        break;
-               if ((inw = get_word(inf)) == 0 || inw == EOF)
+               if ((inw = get_word(inf)) == 0 || inw == (char *)EOF)
                        break;
                inw = ns(inw);
                cp = get_word(inf);
                        break;
                inw = ns(inw);
                cp = get_word(inf);
-               if (cp == 0 || cp == EOF)
+               if (cp == 0 || cp == (char *)EOF)
                        break;
                inc = atoi(cp);
                if (eq(inw, name)) {
                        break;
                inc = atoi(cp);
                if (eq(inw, name)) {
@@ -94,7 +115,7 @@ do_header(dev, hname, count)
                        inc = count;
                }
                cp = get_word(inf);
                        inc = count;
                }
                cp = get_word(inf);
-               if (cp == 0 || cp == EOF)
+               if (cp == (char *)EOF)
                        break;
                fl = (struct file_list *) malloc(sizeof *fl);
                fl->f_fn = inw;
                        break;
                fl = (struct file_list *) malloc(sizeof *fl);
                fl->f_fn = inw;
@@ -102,10 +123,10 @@ do_header(dev, hname, count)
                fl->f_next = fl_head;
                fl_head = fl;
        }
                fl->f_next = fl_head;
                fl_head = fl;
        }
-       fclose(inf);
+       (void) fclose(inf);
        if (count == oldcount) {
                for (fl = fl_head; fl != 0; fl = fl->f_next)
        if (count == oldcount) {
                for (fl = fl_head; fl != 0; fl = fl->f_next)
-                       free(fl);
+                       free((char *)fl);
                return;
        }
        if (oldcount == -1) {
                return;
        }
        if (oldcount == -1) {
@@ -121,11 +142,11 @@ do_header(dev, hname, count)
                exit(1);
        }
        for (fl = fl_head; fl != 0; fl = fl->f_next) {
                exit(1);
        }
        for (fl = fl_head; fl != 0; fl = fl->f_next) {
-               fprintf(outf, "#define %s %d\n",
+               fprintf(outf, "#define %s %u\n",
                    fl->f_fn, count ? fl->f_type : 0);
                    fl->f_fn, count ? fl->f_type : 0);
-               free(fl);
+               free((char *)fl);
        }
        }
-       fclose(outf);
+       (void) fclose(outf);
 }
 
 /*
 }
 
 /*
@@ -137,8 +158,8 @@ toheader(dev)
 {
        static char hbuf[80];
 
 {
        static char hbuf[80];
 
-       strcpy(hbuf, path(dev));
-       strcat(hbuf, ".h");
+       (void) strcpy(hbuf, path(dev));
+       (void) strcat(hbuf, ".h");
        return (hbuf);
 }
 
        return (hbuf);
 }