update for SETOPT/GETOPT (from karels)
[unix-history] / usr / src / sbin / newfs / newfs.c
index bf2b5af..01302a6 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)newfs.c    8.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)newfs.c    8.11 (Berkeley) %G%";
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
@@ -169,7 +169,7 @@ main(argc, argv)
        int fsi, fso, len, n;
        char *cp, *s1, *s2, *special, *opstring, buf[BUFSIZ];
 
        int fsi, fso, len, n;
        char *cp, *s1, *s2, *special, *opstring, buf[BUFSIZ];
 
-       if (progname = rindex(*argv, '/'))
+       if (progname = strrchr(*argv, '/'))
                ++progname;
        else
                progname = *argv;
                ++progname;
        else
                progname = *argv;
@@ -296,7 +296,7 @@ main(argc, argv)
                usage();
 
        special = argv[0];
                usage();
 
        special = argv[0];
-       cp = rindex(special, '/');
+       cp = strrchr(special, '/');
        if (cp == 0) {
                /*
                 * No path prefix; try /dev/r%s then /dev/%s.
        if (cp == 0) {
                /*
                 * No path prefix; try /dev/r%s then /dev/%s.
@@ -349,7 +349,7 @@ main(argc, argv)
                if ((st.st_mode & S_IFMT) != S_IFCHR && !mfs)
                        printf("%s: %s: not a character-special device\n",
                            progname, special);
                if ((st.st_mode & S_IFMT) != S_IFCHR && !mfs)
                        printf("%s: %s: not a character-special device\n",
                            progname, special);
-               cp = index(argv[0], '\0') - 1;
+               cp = strchr(argv[0], '\0') - 1;
                if (cp == 0 || (*cp < 'a' || *cp > 'h') && !isdigit(*cp))
                        fatal("%s: can't figure out file system partition",
                            argv[0]);
                if (cp == 0 || (*cp < 'a' || *cp > 'h') && !isdigit(*cp))
                        fatal("%s: can't figure out file system partition",
                            argv[0]);
@@ -475,7 +475,7 @@ main(argc, argv)
        if (realsectorsize != DEV_BSIZE)
                pp->p_size *= DEV_BSIZE / realsectorsize;
 #endif
        if (realsectorsize != DEV_BSIZE)
                pp->p_size *= DEV_BSIZE / realsectorsize;
 #endif
-       if (!Nflag && bcmp(pp, &oldpartition, sizeof(oldpartition)))
+       if (!Nflag && memcmp(pp, &oldpartition, sizeof(oldpartition)))
                rewritelabel(special, fso, lp);
        if (!Nflag)
                close(fso);
                rewritelabel(special, fso, lp);
        if (!Nflag)
                close(fso);
@@ -565,7 +565,7 @@ rewritelabel(s, fd, lp)
                cfd = open(specname, O_WRONLY);
                if (cfd < 0)
                        fatal("%s: %s", specname, strerror(errno));
                cfd = open(specname, O_WRONLY);
                if (cfd < 0)
                        fatal("%s: %s", specname, strerror(errno));
-               bzero(blk, sizeof(blk));
+               memset(blk, 0, sizeof(blk));
                *(struct disklabel *)(blk + LABELOFFSET) = *lp;
                alt = lp->d_ncylinders * lp->d_secpercyl - lp->d_nsectors;
                for (i = 1; i < 11 && i < lp->d_nsectors; i += 2) {
                *(struct disklabel *)(blk + LABELOFFSET) = *lp;
                alt = lp->d_ncylinders * lp->d_secpercyl - lp->d_nsectors;
                for (i = 1; i < 11 && i < lp->d_nsectors; i += 2) {