checkpoint for 4.4Alpha
[unix-history] / usr / src / sbin / disklabel / disklabel.c
index 3fc43cd..661c561 100644 (file)
@@ -5,17 +5,7 @@
  * This code is derived from software contributed to Berkeley by
  * Symmetric Computer Systems.
  *
  * This code is derived from software contributed to Berkeley by
  * Symmetric Computer Systems.
  *
- * 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.
+ * %sccs.include.redist.c%
  */
 
 #ifndef lint
  */
 
 #ifndef lint
@@ -25,21 +15,22 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)disklabel.c        5.14 (Berkeley) %G%";
+static char sccsid[] = "@(#)disklabel.c        5.22 (Berkeley) %G%";
 /* from static char sccsid[] = "@(#)disklabel.c        1.2 (Symmetric) 11/28/85"; */
 #endif /* not lint */
 
 /* from static char sccsid[] = "@(#)disklabel.c        1.2 (Symmetric) 11/28/85"; */
 #endif /* not lint */
 
-#include <stdio.h>
-#include <ctype.h>
 #include <sys/param.h>
 #include <sys/signal.h>
 #include <sys/errno.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sys/param.h>
 #include <sys/signal.h>
 #include <sys/errno.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
-#include <sys/fs.h>
-#include <strings.h>
 #define DKTYPENAMES
 #include <sys/disklabel.h>
 #define DKTYPENAMES
 #include <sys/disklabel.h>
+#include <ufs/ffs/fs.h>
+#include <string.h>
+#include <stdio.h>
+#include <ctype.h>
+#include "pathnames.h"
 
 /*
  * Disklabel: read and write disklabels.
 
 /*
  * Disklabel: read and write disklabels.
@@ -50,7 +41,7 @@ static char sccsid[] = "@(#)disklabel.c       5.14 (Berkeley) %G%";
  * for the label on such machines.
  */
 
  * for the label on such machines.
  */
 
-#ifdef vax
+#if defined(vax) || defined(i386) || defined(mips)
 #define RAWPARTITION   'c'
 #else
 #define RAWPARTITION   'a'
 #define RAWPARTITION   'c'
 #else
 #define RAWPARTITION   'a'
@@ -60,16 +51,16 @@ static char sccsid[] = "@(#)disklabel.c     5.14 (Berkeley) %G%";
 #define        BBSIZE  8192                    /* size of boot area, with label */
 #endif
 
 #define        BBSIZE  8192                    /* size of boot area, with label */
 #endif
 
-#ifdef vax
+#if defined(vax) || defined(i386) || defined(mips)
 #define        BOOT                            /* also have bootstrap in "boot area" */
 #define        BOOT                            /* also have bootstrap in "boot area" */
-#define        BOOTDIR "/usr/mdec"             /* source of boot binaries */
+#define        BOOTDIR _PATH_BOOTDIR           /* source of boot binaries */
 #else
 #ifdef lint
 #define        BOOT
 #endif
 #endif
 
 #else
 #ifdef lint
 #define        BOOT
 #endif
 #endif
 
-#define        DEFEDITOR       "/usr/ucb/vi"
+#define        DEFEDITOR       _PATH_VI
 #define        streq(a,b)      (strcmp(a,b) == 0)
 
 #ifdef BOOT
 #define        streq(a,b)      (strcmp(a,b) == 0)
 
 #ifdef BOOT
@@ -79,7 +70,7 @@ char  *bootxx;
 
 char   *dkname;
 char   *specname;
 
 char   *dkname;
 char   *specname;
-char   tmpfil[] = "/tmp/EdDk.aXXXXXX";
+char   tmpfil[] = _PATH_TMP;
 
 extern int errno;
 char   namebuf[BBSIZE], *np = namebuf;
 
 extern int errno;
 char   namebuf[BBSIZE], *np = namebuf;
@@ -155,14 +146,14 @@ main(argc, argv)
 
        dkname = argv[0];
        if (dkname[0] != '/') {
 
        dkname = argv[0];
        if (dkname[0] != '/') {
-               (void)sprintf(np, "/dev/r%s%c", dkname, RAWPARTITION);
+               (void)sprintf(np, "%s/r%s%c", _PATH_DEV, dkname, RAWPARTITION);
                specname = np;
                np += strlen(specname) + 1;
        } else
                specname = dkname;
        f = open(specname, op == READ ? O_RDONLY : O_RDWR);
        if (f < 0 && errno == ENOENT && dkname[0] != '/') {
                specname = np;
                np += strlen(specname) + 1;
        } else
                specname = dkname;
        f = open(specname, op == READ ? O_RDONLY : O_RDWR);
        if (f < 0 && errno == ENOENT && dkname[0] != '/') {
-               (void)sprintf(specname, "/dev/r%s", dkname);
+               (void)sprintf(specname, "%s/r%s", _PATH_DEV, dkname);
                np = namebuf + strlen(specname) + 1;
                f = open(specname, op == READ ? O_RDONLY : O_RDWR);
        }
                np = namebuf + strlen(specname) + 1;
                f = open(specname, op == READ ? O_RDONLY : O_RDWR);
        }