BSD 4_3_Reno release
[unix-history] / usr / src / usr.sbin / kvm_mkdb / kvm_mkdb.c
index 9562c96..d003350 100644 (file)
@@ -2,7 +2,19 @@
  * Copyright (c) 1990 The Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1990 The Regents of the University of California.
  * All rights reserved.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms are permitted provided
+ * that: (1) source distributions retain this entire copyright notice and
+ * comment, and (2) distributions including binaries display the following
+ * acknowledgement:  ``This product includes software developed by the
+ * University of California, Berkeley and its contributors'' in the
+ * documentation or other materials provided with the distribution and in
+ * all advertising materials mentioning features or use of this software.
+ * Neither the name of the University nor the names of its contributors may
+ * 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
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
@@ -12,7 +24,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)kvm_mkdb.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)kvm_mkdb.c 5.5 (Berkeley) 6/25/90";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -29,7 +41,6 @@ static char sccsid[] = "@(#)kvm_mkdb.c        5.3 (Berkeley) %G%";
 char *tmp;
 #define basename(cp)   ((tmp=rindex((cp), '/')) ? tmp+1 : (cp))
 #define USAGE  "kvm_mkdb"
 char *tmp;
 #define basename(cp)   ((tmp=rindex((cp), '/')) ? tmp+1 : (cp))
 #define USAGE  "kvm_mkdb"
-extern errno;
 
 char *progname;
 
 
 char *progname;
 
@@ -88,7 +99,7 @@ rmdb(file)
                syserrexit("can't unlink %s", file);
        *(file+len) = '\0';
 }
                syserrexit("can't unlink %s", file);
        *(file+len) = '\0';
 }
-       
+
 mvdb(from, to)
        char *from;
        char *to;
 mvdb(from, to)
        char *from;
        char *to;
@@ -182,16 +193,19 @@ create_knlist(name, db)
                         * store the value of version in VERSION
                         */
                        datum vers;
                         * store the value of version in VERSION
                         */
                        datum vers;
-                       char versbuf[LINE_MAX];
+                       char versbuf[_BSD_LINE_MAX];
                        long versoff;
                        long reloffset;
 
                        long versoff;
                        long reloffset;
 
+                       /* offset relative to start of text image in VM. */
+#ifdef hp300
+                       reloffset = s->n_value;
+#endif
+#ifdef tahoe
                        /*
                        /*
-                        * Offset relative to start of text image in VM.
-                        * On tahoe, first 0x800 is reserved for
-                        * communication with the console processor.
+                        * on tahoe, first 0x800 is reserved for communication
+                        * with the console processor.
                         */
                         */
-#ifdef tahoe
                        reloffset = ((s->n_value & ~KERNBASE) - 0x800);
 #endif
 #ifdef vax
                        reloffset = ((s->n_value & ~KERNBASE) - 0x800);
 #endif
 #ifdef vax
@@ -199,9 +213,9 @@ create_knlist(name, db)
 #endif
                        /*
                         * When loaded, data is rounded
 #endif
                        /*
                         * When loaded, data is rounded
-                        * to next 1024 after text, but not in file.
+                        * to next page cluster after text, but not in file.
                         */
                         */
-                       reloffset -= 1024 - (ebuf.a_text % 1024);
+                       reloffset -= CLBYTES - (ebuf.a_text % CLBYTES);
                        versoff = N_TXTOFF(ebuf) + reloffset;
                        if (fseek(fstr, versoff, SEEK_SET) == -1)
                                syserrexit("seek (version): %x", s->n_value);
                        versoff = N_TXTOFF(ebuf) + reloffset;
                        if (fseek(fstr, versoff, SEEK_SET) == -1)
                                syserrexit("seek (version): %x", s->n_value);
@@ -209,7 +223,7 @@ create_knlist(name, db)
                         * Just read version string up to, and
                         * including newline.
                         */
                         * Just read version string up to, and
                         * including newline.
                         */
-                       if (fgets(versbuf, LINE_MAX, fstr) == NULL)
+                       if (fgets(versbuf, _BSD_LINE_MAX, fstr) == NULL)
                                syserrexit("can't read version");
                        strcpy(sbuf+1, "VERSION");
                        key.dsize = (sizeof ("VERSION") - 1) + 1;
                                syserrexit("can't read version");
                        strcpy(sbuf+1, "VERSION");
                        key.dsize = (sizeof ("VERSION") - 1) + 1;