set BINDIR to install registerd in /usr/libexec
[unix-history] / usr / src / sbin / fsck / preen.c
index 8b3390f..7599013 100644 (file)
@@ -2,21 +2,11 @@
  * 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.
  *
- * 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * %sccs.include.redist.c%
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)preen.c    5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)preen.c    5.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -25,9 +15,10 @@ static char sccsid[] = "@(#)preen.c  5.3 (Berkeley) %G%";
 #include <fstab.h>
 #include <string.h>
 #include <stdio.h>
 #include <fstab.h>
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <ctype.h>
 
 #include <ctype.h>
 
-char   *rawname(), *unrawname(), *blockcheck(), *malloc();
+char   *rawname(), *unrawname(), *blockcheck();
 
 struct part {
        struct  part *next;             /* forward link of partitions on disk */
 
 struct part {
        struct  part *next;             /* forward link of partitions on disk */
@@ -175,7 +166,7 @@ finddisk(name)
 {
        register struct disk *dk, **dkp;
        register char *p;
 {
        register struct disk *dk, **dkp;
        register char *p;
-       int len;
+       size_t len;
 
        for (p = name + strlen(name) - 1; p >= name; --p)
                if (isdigit(*p)) {
 
        for (p = name + strlen(name) - 1; p >= name; --p)
                if (isdigit(*p)) {
@@ -195,11 +186,11 @@ finddisk(name)
                exit (8);
        }
        dk = *dkp;
                exit (8);
        }
        dk = *dkp;
-       if ((dk->name = malloc((unsigned int)len + 1)) == NULL) {
+       if ((dk->name = malloc(len + 1)) == NULL) {
                fprintf(stderr, "out of memory");
                exit (8);
        }
                fprintf(stderr, "out of memory");
                exit (8);
        }
-       strncpy(dk->name, name, len);
+       (void)strncpy(dk->name, name, len);
        dk->name[len] = '\0';
        dk->part = NULL;
        dk->next = NULL;
        dk->name[len] = '\0';
        dk->part = NULL;
        dk->next = NULL;
@@ -225,16 +216,16 @@ addpart(name, fsname, auxdata)
                exit (8);
        }
        pt = *ppt;
                exit (8);
        }
        pt = *ppt;
-       if ((pt->name = malloc((unsigned int)strlen(name) + 1)) == NULL) {
+       if ((pt->name = malloc(strlen(name) + 1)) == NULL) {
                fprintf(stderr, "out of memory");
                exit (8);
        }
                fprintf(stderr, "out of memory");
                exit (8);
        }
-       strcpy(pt->name, name);
-       if ((pt->fsname = malloc((unsigned int)strlen(fsname) + 1)) == NULL) {
+       (void)strcpy(pt->name, name);
+       if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) {
                fprintf(stderr, "out of memory");
                exit (8);
        }
                fprintf(stderr, "out of memory");
                exit (8);
        }
-       strcpy(pt->fsname, fsname);
+       (void)strcpy(pt->fsname, fsname);
        pt->next = NULL;
        pt->auxdata = auxdata;
 }
        pt->next = NULL;
        pt->auxdata = auxdata;
 }