diff --git a/sbin/fsck/dir.c b/sbin/fsck/dir.c index 6ab67d33ca32..ac34c6fc1cce 100644 --- a/sbin/fsck/dir.c +++ b/sbin/fsck/dir.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include diff --git a/sbin/fsck/fsck.8 b/sbin/fsck/fsck.8 index 9221ea8ffaad..51d1679f6d1d 100644 --- a/sbin/fsck/fsck.8 +++ b/sbin/fsck/fsck.8 @@ -10,7 +10,7 @@ .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: +.\" must display the following acknowledgment: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)fsck.8 8.4 (Berkeley) 5/9/95 -.\" $Id: fsck.8,v 1.9 1997/03/11 12:19:36 peter Exp $ +.\" $Id: fsck.8,v 1.10 1997/03/12 16:35:26 bde Exp $ .\" .Dd May 9, 1995 .Dt FSCK 8 @@ -54,13 +54,13 @@ .Ar ... .Sh DESCRIPTION The first form of -.Nm fsck +.Nm preens a standard set of filesystems or the specified filesystems. It is normally used in the script .Pa /etc/rc during automatic reboot. Here -.Nm fsck +.Nm reads the table .Pa /etc/fstab to determine which filesystems to check. @@ -78,7 +78,7 @@ The clean flag of each filesystem's superblock is examined and only those filesy are not marked clean are checked. Filesystems are marked clean when they are unmounted, when they have been mounted read-only, or when -.Nm fsck +.Nm runs on them successfully. If the .Fl f @@ -102,7 +102,7 @@ Counts in the super-block wrong .El .Pp These are the only inconsistencies that -.Nm fsck +.Nm with the .Fl p option will correct; if it encounters other inconsistencies, it exits @@ -110,7 +110,7 @@ with an abnormal return status and an automatic reboot will then fail. For each corrected inconsistency one or more lines will be printed identifying the filesystem on which the correction will take place, and the nature of the correction. After successfully correcting a filesystem, -.Nm fsck +.Nm will print the number of files on that filesystem, the number of used and free blocks, and the percentage of fragmentation. @@ -118,7 +118,7 @@ and the percentage of fragmentation. If sent a .Dv QUIT signal, -.Nm fsck +.Nm will finish the filesystem checks, then exit with an abnormal return status that causes an automatic reboot to fail. This is useful when you want to finish the filesystem checks during an @@ -128,7 +128,7 @@ but do not want the machine to come up multiuser after the checks complete. Without the .Fl p option, -.Nm fsck +.Nm audits and interactively repairs inconsistent conditions for filesystems. If the filesystem is inconsistent the operator is prompted for concurrence before each correction is attempted. @@ -144,7 +144,7 @@ is to wait for the operator to respond or .Li no . If the operator does not have write permission on the filesystem -.Nm fsck +.Nm will default to a .Fl n action. @@ -158,7 +158,7 @@ and combined. .Pp The following flags are interpreted by -.Nm fsck . +.Nm Ns . .Bl -tag -width indent .It Fl b Use the block specified immediately after the flag as @@ -180,12 +180,12 @@ by all users on the system should use a more restrictive set of permissions such as 700. .It Fl y Assume a yes response to all questions asked by -.Nm fsck ; +.Nm Ns ; this should be used with great caution as this is a free license to continue after essentially unlimited trouble has been encountered. .It Fl n Assume a no response to all questions asked by -.Nm fsck +.Nm except for .Ql CONTINUE? , which is assumed to be affirmative; @@ -210,7 +210,7 @@ If maxcontig is equal to one, delete any existing segment maps. .El .Pp In interactive mode, -.Nm fsck +.Nm will list the conversion to be made and ask whether the conversion should be done. If a negative answer is given, @@ -226,7 +226,7 @@ first line of output from .El .Pp If no filesystems are given to -.Nm fsck +.Nm then a default list of filesystems is read from the file .Pa /etc/fstab . @@ -296,7 +296,7 @@ contains default list of filesystems to check. .El .Sh DIAGNOSTICS The diagnostics produced by -.Nm fsck +.Nm are fully enumerated and explained in Appendix A of .Rs .%T "Fsck \- The UNIX File System Check Program" diff --git a/sbin/fsck/inode.c b/sbin/fsck/inode.c index 74561c8eb1b4..8d642c73ce7b 100644 --- a/sbin/fsck/inode.c +++ b/sbin/fsck/inode.c @@ -32,7 +32,11 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include @@ -339,7 +343,7 @@ resetinodebuf() } if (inodebuf == NULL && (inodebuf = (struct dinode *)malloc((unsigned)inobufsize)) == NULL) - errx(EEXIT, "Cannot allocate space for inode buffer"); + errx(EEXIT, "cannot allocate space for inode buffer"); while (nextino < ROOTINO) (void)getnextinode(nextino); } diff --git a/sbin/fsck/main.c b/sbin/fsck/main.c index b4bc2c9caaaf..9ff947c52f84 100644 --- a/sbin/fsck/main.c +++ b/sbin/fsck/main.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95"; #endif static const char rcsid[] = - "$Id: main.c,v 1.12 1997/12/20 22:24:32 bde Exp $"; + "$Id: main.c,v 1.13 1998/03/08 09:55:26 julian Exp $"; #endif /* not lint */ #include @@ -53,10 +53,8 @@ static const char rcsid[] = #include #include -#include #include #include -#include #include "fsck.h" diff --git a/sbin/fsck/pass1.c b/sbin/fsck/pass1.c index 181f858184bc..3ad7e61e3b7f 100644 --- a/sbin/fsck/pass1.c +++ b/sbin/fsck/pass1.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include diff --git a/sbin/fsck/pass1b.c b/sbin/fsck/pass1b.c index e5036c7e8806..32a3be7723bd 100644 --- a/sbin/fsck/pass1b.c +++ b/sbin/fsck/pass1b.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass1b.c 8.4 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include diff --git a/sbin/fsck/pass2.c b/sbin/fsck/pass2.c index ebc33b8a650f..4c24b23a9ca4 100644 --- a/sbin/fsck/pass2.c +++ b/sbin/fsck/pass2.c @@ -32,15 +32,17 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include -#include #include #include diff --git a/sbin/fsck/pass3.c b/sbin/fsck/pass3.c index 89aff79958fa..6524a117e9a6 100644 --- a/sbin/fsck/pass3.c +++ b/sbin/fsck/pass3.c @@ -32,14 +32,16 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass3.c 8.2 (Berkeley) 4/27/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include -#include #include "fsck.h" diff --git a/sbin/fsck/pass4.c b/sbin/fsck/pass4.c index e20f6fa30372..b2f1fe9ff00b 100644 --- a/sbin/fsck/pass4.c +++ b/sbin/fsck/pass4.c @@ -32,14 +32,16 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include -#include #include #include diff --git a/sbin/fsck/pass5.c b/sbin/fsck/pass5.c index aa37694fa1b5..7d913a447add 100644 --- a/sbin/fsck/pass5.c +++ b/sbin/fsck/pass5.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include diff --git a/sbin/fsck/preen.c b/sbin/fsck/preen.c index de9bb5598615..9705aeea9280 100644 --- a/sbin/fsck/preen.c +++ b/sbin/fsck/preen.c @@ -32,7 +32,11 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include @@ -42,6 +46,7 @@ static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; #include #include +#include #include #include @@ -88,8 +93,7 @@ checkfstab(preen, maxrun, docheck, chkit) sumstatus = 0; for (passno = 1; passno <= 2; passno++) { if (setfsent() == 0) { - fprintf(stderr, "Can't open checklist file: %s\n", - _PATH_FSTAB); + warnx("can't open checklist file: %s", _PATH_FSTAB); return (8); } while ((fsp = getfsent()) != 0) { @@ -218,15 +222,11 @@ finddisk(name) dk->name[len] == 0) return (dk); } - if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) + errx(8, "out of memory"); dk = *dkp; - if ((dk->name = malloc(len + 1)) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((dk->name = malloc(len + 1)) == NULL) + errx(8, "out of memory"); (void)strncpy(dk->name, name, len); dk->name[len] = '\0'; dk->part = NULL; @@ -249,20 +249,14 @@ addpart(name, fsname, auxdata) printf("%s in fstab more than once!\n", name); return; } - if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) + errx(8, "out of memory"); pt = *ppt; - if ((pt->name = malloc(strlen(name) + 1)) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((pt->name = malloc(strlen(name) + 1)) == NULL) + errx(8, "out of memory"); (void)strcpy(pt->name, name); - if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) + errx(8, "out of memory"); (void)strcpy(pt->fsname, fsname); pt->next = NULL; pt->auxdata = auxdata; @@ -277,7 +271,7 @@ startdisk(dk, checkit) dk->pid = fork(); if (dk->pid < 0) { - perror("fork"); + warn("fork"); return (8); } if (dk->pid == 0) @@ -297,14 +291,14 @@ blockcheck(origname) hotroot = 0; if (stat("/", &stslash) < 0) { - perror("/"); + warn("/"); printf("Can't stat root\n"); return (origname); } newname = origname; retry: if (stat(newname, &stblock) < 0) { - perror(newname); + warn("%s", newname); printf("Can't stat %s\n", newname); return (origname); } @@ -313,7 +307,7 @@ blockcheck(origname) hotroot++; raw = rawname(newname); if (stat(raw, &stchar) < 0) { - perror(raw); + warn("%s", raw); printf("Can't stat %s\n", raw); return (origname); } diff --git a/sbin/fsck/setup.c b/sbin/fsck/setup.c index f464b63e53ba..308dfd0e3e24 100644 --- a/sbin/fsck/setup.c +++ b/sbin/fsck/setup.c @@ -32,14 +32,16 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #define DKTYPENAMES #include -#include #include -#include #include #include diff --git a/sbin/fsck/utilities.c b/sbin/fsck/utilities.c index 465fb3be3884..0d82d6ebbcf6 100644 --- a/sbin/fsck/utilities.c +++ b/sbin/fsck/utilities.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include @@ -267,7 +270,7 @@ ckfini(markclean) free((char *)bp); } if (bufhead.b_size != cnt) - errx(EEXIT, "Panic: lost %d buffers", bufhead.b_size - cnt); + errx(EEXIT, "panic: lost %d buffers", bufhead.b_size - cnt); pbp = pdirbp = (struct bufarea *)0; if (markclean && sblock.fs_clean == 0) { sblock.fs_clean = 1; diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index 6ab67d33ca32..ac34c6fc1cce 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include diff --git a/sbin/fsck_ffs/fsck_ffs.8 b/sbin/fsck_ffs/fsck_ffs.8 index 9221ea8ffaad..51d1679f6d1d 100644 --- a/sbin/fsck_ffs/fsck_ffs.8 +++ b/sbin/fsck_ffs/fsck_ffs.8 @@ -10,7 +10,7 @@ .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: +.\" must display the following acknowledgment: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)fsck.8 8.4 (Berkeley) 5/9/95 -.\" $Id: fsck.8,v 1.9 1997/03/11 12:19:36 peter Exp $ +.\" $Id: fsck.8,v 1.10 1997/03/12 16:35:26 bde Exp $ .\" .Dd May 9, 1995 .Dt FSCK 8 @@ -54,13 +54,13 @@ .Ar ... .Sh DESCRIPTION The first form of -.Nm fsck +.Nm preens a standard set of filesystems or the specified filesystems. It is normally used in the script .Pa /etc/rc during automatic reboot. Here -.Nm fsck +.Nm reads the table .Pa /etc/fstab to determine which filesystems to check. @@ -78,7 +78,7 @@ The clean flag of each filesystem's superblock is examined and only those filesy are not marked clean are checked. Filesystems are marked clean when they are unmounted, when they have been mounted read-only, or when -.Nm fsck +.Nm runs on them successfully. If the .Fl f @@ -102,7 +102,7 @@ Counts in the super-block wrong .El .Pp These are the only inconsistencies that -.Nm fsck +.Nm with the .Fl p option will correct; if it encounters other inconsistencies, it exits @@ -110,7 +110,7 @@ with an abnormal return status and an automatic reboot will then fail. For each corrected inconsistency one or more lines will be printed identifying the filesystem on which the correction will take place, and the nature of the correction. After successfully correcting a filesystem, -.Nm fsck +.Nm will print the number of files on that filesystem, the number of used and free blocks, and the percentage of fragmentation. @@ -118,7 +118,7 @@ and the percentage of fragmentation. If sent a .Dv QUIT signal, -.Nm fsck +.Nm will finish the filesystem checks, then exit with an abnormal return status that causes an automatic reboot to fail. This is useful when you want to finish the filesystem checks during an @@ -128,7 +128,7 @@ but do not want the machine to come up multiuser after the checks complete. Without the .Fl p option, -.Nm fsck +.Nm audits and interactively repairs inconsistent conditions for filesystems. If the filesystem is inconsistent the operator is prompted for concurrence before each correction is attempted. @@ -144,7 +144,7 @@ is to wait for the operator to respond or .Li no . If the operator does not have write permission on the filesystem -.Nm fsck +.Nm will default to a .Fl n action. @@ -158,7 +158,7 @@ and combined. .Pp The following flags are interpreted by -.Nm fsck . +.Nm Ns . .Bl -tag -width indent .It Fl b Use the block specified immediately after the flag as @@ -180,12 +180,12 @@ by all users on the system should use a more restrictive set of permissions such as 700. .It Fl y Assume a yes response to all questions asked by -.Nm fsck ; +.Nm Ns ; this should be used with great caution as this is a free license to continue after essentially unlimited trouble has been encountered. .It Fl n Assume a no response to all questions asked by -.Nm fsck +.Nm except for .Ql CONTINUE? , which is assumed to be affirmative; @@ -210,7 +210,7 @@ If maxcontig is equal to one, delete any existing segment maps. .El .Pp In interactive mode, -.Nm fsck +.Nm will list the conversion to be made and ask whether the conversion should be done. If a negative answer is given, @@ -226,7 +226,7 @@ first line of output from .El .Pp If no filesystems are given to -.Nm fsck +.Nm then a default list of filesystems is read from the file .Pa /etc/fstab . @@ -296,7 +296,7 @@ contains default list of filesystems to check. .El .Sh DIAGNOSTICS The diagnostics produced by -.Nm fsck +.Nm are fully enumerated and explained in Appendix A of .Rs .%T "Fsck \- The UNIX File System Check Program" diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index 74561c8eb1b4..8d642c73ce7b 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -32,7 +32,11 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include @@ -339,7 +343,7 @@ resetinodebuf() } if (inodebuf == NULL && (inodebuf = (struct dinode *)malloc((unsigned)inobufsize)) == NULL) - errx(EEXIT, "Cannot allocate space for inode buffer"); + errx(EEXIT, "cannot allocate space for inode buffer"); while (nextino < ROOTINO) (void)getnextinode(nextino); } diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index b4bc2c9caaaf..9ff947c52f84 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95"; #endif static const char rcsid[] = - "$Id: main.c,v 1.12 1997/12/20 22:24:32 bde Exp $"; + "$Id: main.c,v 1.13 1998/03/08 09:55:26 julian Exp $"; #endif /* not lint */ #include @@ -53,10 +53,8 @@ static const char rcsid[] = #include #include -#include #include #include -#include #include "fsck.h" diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index 181f858184bc..3ad7e61e3b7f 100644 --- a/sbin/fsck_ffs/pass1.c +++ b/sbin/fsck_ffs/pass1.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include diff --git a/sbin/fsck_ffs/pass1b.c b/sbin/fsck_ffs/pass1b.c index e5036c7e8806..32a3be7723bd 100644 --- a/sbin/fsck_ffs/pass1b.c +++ b/sbin/fsck_ffs/pass1b.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass1b.c 8.4 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include diff --git a/sbin/fsck_ffs/pass2.c b/sbin/fsck_ffs/pass2.c index ebc33b8a650f..4c24b23a9ca4 100644 --- a/sbin/fsck_ffs/pass2.c +++ b/sbin/fsck_ffs/pass2.c @@ -32,15 +32,17 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include -#include #include #include diff --git a/sbin/fsck_ffs/pass3.c b/sbin/fsck_ffs/pass3.c index 89aff79958fa..6524a117e9a6 100644 --- a/sbin/fsck_ffs/pass3.c +++ b/sbin/fsck_ffs/pass3.c @@ -32,14 +32,16 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass3.c 8.2 (Berkeley) 4/27/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include -#include #include "fsck.h" diff --git a/sbin/fsck_ffs/pass4.c b/sbin/fsck_ffs/pass4.c index e20f6fa30372..b2f1fe9ff00b 100644 --- a/sbin/fsck_ffs/pass4.c +++ b/sbin/fsck_ffs/pass4.c @@ -32,14 +32,16 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include -#include #include #include diff --git a/sbin/fsck_ffs/pass5.c b/sbin/fsck_ffs/pass5.c index aa37694fa1b5..7d913a447add 100644 --- a/sbin/fsck_ffs/pass5.c +++ b/sbin/fsck_ffs/pass5.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include diff --git a/sbin/fsck_ffs/preen.c b/sbin/fsck_ffs/preen.c index de9bb5598615..9705aeea9280 100644 --- a/sbin/fsck_ffs/preen.c +++ b/sbin/fsck_ffs/preen.c @@ -32,7 +32,11 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include @@ -42,6 +46,7 @@ static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; #include #include +#include #include #include @@ -88,8 +93,7 @@ checkfstab(preen, maxrun, docheck, chkit) sumstatus = 0; for (passno = 1; passno <= 2; passno++) { if (setfsent() == 0) { - fprintf(stderr, "Can't open checklist file: %s\n", - _PATH_FSTAB); + warnx("can't open checklist file: %s", _PATH_FSTAB); return (8); } while ((fsp = getfsent()) != 0) { @@ -218,15 +222,11 @@ finddisk(name) dk->name[len] == 0) return (dk); } - if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) + errx(8, "out of memory"); dk = *dkp; - if ((dk->name = malloc(len + 1)) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((dk->name = malloc(len + 1)) == NULL) + errx(8, "out of memory"); (void)strncpy(dk->name, name, len); dk->name[len] = '\0'; dk->part = NULL; @@ -249,20 +249,14 @@ addpart(name, fsname, auxdata) printf("%s in fstab more than once!\n", name); return; } - if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) + errx(8, "out of memory"); pt = *ppt; - if ((pt->name = malloc(strlen(name) + 1)) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((pt->name = malloc(strlen(name) + 1)) == NULL) + errx(8, "out of memory"); (void)strcpy(pt->name, name); - if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) + errx(8, "out of memory"); (void)strcpy(pt->fsname, fsname); pt->next = NULL; pt->auxdata = auxdata; @@ -277,7 +271,7 @@ startdisk(dk, checkit) dk->pid = fork(); if (dk->pid < 0) { - perror("fork"); + warn("fork"); return (8); } if (dk->pid == 0) @@ -297,14 +291,14 @@ blockcheck(origname) hotroot = 0; if (stat("/", &stslash) < 0) { - perror("/"); + warn("/"); printf("Can't stat root\n"); return (origname); } newname = origname; retry: if (stat(newname, &stblock) < 0) { - perror(newname); + warn("%s", newname); printf("Can't stat %s\n", newname); return (origname); } @@ -313,7 +307,7 @@ blockcheck(origname) hotroot++; raw = rawname(newname); if (stat(raw, &stchar) < 0) { - perror(raw); + warn("%s", raw); printf("Can't stat %s\n", raw); return (origname); } diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index f464b63e53ba..308dfd0e3e24 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -32,14 +32,16 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #define DKTYPENAMES #include -#include #include -#include #include #include diff --git a/sbin/fsck_ffs/utilities.c b/sbin/fsck_ffs/utilities.c index 465fb3be3884..0d82d6ebbcf6 100644 --- a/sbin/fsck_ffs/utilities.c +++ b/sbin/fsck_ffs/utilities.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include @@ -267,7 +270,7 @@ ckfini(markclean) free((char *)bp); } if (bufhead.b_size != cnt) - errx(EEXIT, "Panic: lost %d buffers", bufhead.b_size - cnt); + errx(EEXIT, "panic: lost %d buffers", bufhead.b_size - cnt); pbp = pdirbp = (struct bufarea *)0; if (markclean && sblock.fs_clean == 0) { sblock.fs_clean = 1; diff --git a/sbin/fsck_ifs/dir.c b/sbin/fsck_ifs/dir.c index 6ab67d33ca32..ac34c6fc1cce 100644 --- a/sbin/fsck_ifs/dir.c +++ b/sbin/fsck_ifs/dir.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include diff --git a/sbin/fsck_ifs/fsck_ifs.8 b/sbin/fsck_ifs/fsck_ifs.8 index 9221ea8ffaad..51d1679f6d1d 100644 --- a/sbin/fsck_ifs/fsck_ifs.8 +++ b/sbin/fsck_ifs/fsck_ifs.8 @@ -10,7 +10,7 @@ .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: +.\" must display the following acknowledgment: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)fsck.8 8.4 (Berkeley) 5/9/95 -.\" $Id: fsck.8,v 1.9 1997/03/11 12:19:36 peter Exp $ +.\" $Id: fsck.8,v 1.10 1997/03/12 16:35:26 bde Exp $ .\" .Dd May 9, 1995 .Dt FSCK 8 @@ -54,13 +54,13 @@ .Ar ... .Sh DESCRIPTION The first form of -.Nm fsck +.Nm preens a standard set of filesystems or the specified filesystems. It is normally used in the script .Pa /etc/rc during automatic reboot. Here -.Nm fsck +.Nm reads the table .Pa /etc/fstab to determine which filesystems to check. @@ -78,7 +78,7 @@ The clean flag of each filesystem's superblock is examined and only those filesy are not marked clean are checked. Filesystems are marked clean when they are unmounted, when they have been mounted read-only, or when -.Nm fsck +.Nm runs on them successfully. If the .Fl f @@ -102,7 +102,7 @@ Counts in the super-block wrong .El .Pp These are the only inconsistencies that -.Nm fsck +.Nm with the .Fl p option will correct; if it encounters other inconsistencies, it exits @@ -110,7 +110,7 @@ with an abnormal return status and an automatic reboot will then fail. For each corrected inconsistency one or more lines will be printed identifying the filesystem on which the correction will take place, and the nature of the correction. After successfully correcting a filesystem, -.Nm fsck +.Nm will print the number of files on that filesystem, the number of used and free blocks, and the percentage of fragmentation. @@ -118,7 +118,7 @@ and the percentage of fragmentation. If sent a .Dv QUIT signal, -.Nm fsck +.Nm will finish the filesystem checks, then exit with an abnormal return status that causes an automatic reboot to fail. This is useful when you want to finish the filesystem checks during an @@ -128,7 +128,7 @@ but do not want the machine to come up multiuser after the checks complete. Without the .Fl p option, -.Nm fsck +.Nm audits and interactively repairs inconsistent conditions for filesystems. If the filesystem is inconsistent the operator is prompted for concurrence before each correction is attempted. @@ -144,7 +144,7 @@ is to wait for the operator to respond or .Li no . If the operator does not have write permission on the filesystem -.Nm fsck +.Nm will default to a .Fl n action. @@ -158,7 +158,7 @@ and combined. .Pp The following flags are interpreted by -.Nm fsck . +.Nm Ns . .Bl -tag -width indent .It Fl b Use the block specified immediately after the flag as @@ -180,12 +180,12 @@ by all users on the system should use a more restrictive set of permissions such as 700. .It Fl y Assume a yes response to all questions asked by -.Nm fsck ; +.Nm Ns ; this should be used with great caution as this is a free license to continue after essentially unlimited trouble has been encountered. .It Fl n Assume a no response to all questions asked by -.Nm fsck +.Nm except for .Ql CONTINUE? , which is assumed to be affirmative; @@ -210,7 +210,7 @@ If maxcontig is equal to one, delete any existing segment maps. .El .Pp In interactive mode, -.Nm fsck +.Nm will list the conversion to be made and ask whether the conversion should be done. If a negative answer is given, @@ -226,7 +226,7 @@ first line of output from .El .Pp If no filesystems are given to -.Nm fsck +.Nm then a default list of filesystems is read from the file .Pa /etc/fstab . @@ -296,7 +296,7 @@ contains default list of filesystems to check. .El .Sh DIAGNOSTICS The diagnostics produced by -.Nm fsck +.Nm are fully enumerated and explained in Appendix A of .Rs .%T "Fsck \- The UNIX File System Check Program" diff --git a/sbin/fsck_ifs/inode.c b/sbin/fsck_ifs/inode.c index 74561c8eb1b4..8d642c73ce7b 100644 --- a/sbin/fsck_ifs/inode.c +++ b/sbin/fsck_ifs/inode.c @@ -32,7 +32,11 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include @@ -339,7 +343,7 @@ resetinodebuf() } if (inodebuf == NULL && (inodebuf = (struct dinode *)malloc((unsigned)inobufsize)) == NULL) - errx(EEXIT, "Cannot allocate space for inode buffer"); + errx(EEXIT, "cannot allocate space for inode buffer"); while (nextino < ROOTINO) (void)getnextinode(nextino); } diff --git a/sbin/fsck_ifs/main.c b/sbin/fsck_ifs/main.c index b4bc2c9caaaf..9ff947c52f84 100644 --- a/sbin/fsck_ifs/main.c +++ b/sbin/fsck_ifs/main.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95"; #endif static const char rcsid[] = - "$Id: main.c,v 1.12 1997/12/20 22:24:32 bde Exp $"; + "$Id: main.c,v 1.13 1998/03/08 09:55:26 julian Exp $"; #endif /* not lint */ #include @@ -53,10 +53,8 @@ static const char rcsid[] = #include #include -#include #include #include -#include #include "fsck.h" diff --git a/sbin/fsck_ifs/pass1.c b/sbin/fsck_ifs/pass1.c index 181f858184bc..3ad7e61e3b7f 100644 --- a/sbin/fsck_ifs/pass1.c +++ b/sbin/fsck_ifs/pass1.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include diff --git a/sbin/fsck_ifs/pass1b.c b/sbin/fsck_ifs/pass1b.c index e5036c7e8806..32a3be7723bd 100644 --- a/sbin/fsck_ifs/pass1b.c +++ b/sbin/fsck_ifs/pass1b.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass1b.c 8.4 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include diff --git a/sbin/fsck_ifs/pass2.c b/sbin/fsck_ifs/pass2.c index ebc33b8a650f..4c24b23a9ca4 100644 --- a/sbin/fsck_ifs/pass2.c +++ b/sbin/fsck_ifs/pass2.c @@ -32,15 +32,17 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include -#include #include #include diff --git a/sbin/fsck_ifs/pass3.c b/sbin/fsck_ifs/pass3.c index 89aff79958fa..6524a117e9a6 100644 --- a/sbin/fsck_ifs/pass3.c +++ b/sbin/fsck_ifs/pass3.c @@ -32,14 +32,16 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass3.c 8.2 (Berkeley) 4/27/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include -#include #include "fsck.h" diff --git a/sbin/fsck_ifs/pass4.c b/sbin/fsck_ifs/pass4.c index e20f6fa30372..b2f1fe9ff00b 100644 --- a/sbin/fsck_ifs/pass4.c +++ b/sbin/fsck_ifs/pass4.c @@ -32,14 +32,16 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass4.c 8.4 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include -#include #include #include diff --git a/sbin/fsck_ifs/pass5.c b/sbin/fsck_ifs/pass5.c index aa37694fa1b5..7d913a447add 100644 --- a/sbin/fsck_ifs/pass5.c +++ b/sbin/fsck_ifs/pass5.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)pass5.c 8.9 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include diff --git a/sbin/fsck_ifs/preen.c b/sbin/fsck_ifs/preen.c index de9bb5598615..9705aeea9280 100644 --- a/sbin/fsck_ifs/preen.c +++ b/sbin/fsck_ifs/preen.c @@ -32,7 +32,11 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include @@ -42,6 +46,7 @@ static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; #include #include +#include #include #include @@ -88,8 +93,7 @@ checkfstab(preen, maxrun, docheck, chkit) sumstatus = 0; for (passno = 1; passno <= 2; passno++) { if (setfsent() == 0) { - fprintf(stderr, "Can't open checklist file: %s\n", - _PATH_FSTAB); + warnx("can't open checklist file: %s", _PATH_FSTAB); return (8); } while ((fsp = getfsent()) != 0) { @@ -218,15 +222,11 @@ finddisk(name) dk->name[len] == 0) return (dk); } - if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) + errx(8, "out of memory"); dk = *dkp; - if ((dk->name = malloc(len + 1)) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((dk->name = malloc(len + 1)) == NULL) + errx(8, "out of memory"); (void)strncpy(dk->name, name, len); dk->name[len] = '\0'; dk->part = NULL; @@ -249,20 +249,14 @@ addpart(name, fsname, auxdata) printf("%s in fstab more than once!\n", name); return; } - if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) + errx(8, "out of memory"); pt = *ppt; - if ((pt->name = malloc(strlen(name) + 1)) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((pt->name = malloc(strlen(name) + 1)) == NULL) + errx(8, "out of memory"); (void)strcpy(pt->name, name); - if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) + errx(8, "out of memory"); (void)strcpy(pt->fsname, fsname); pt->next = NULL; pt->auxdata = auxdata; @@ -277,7 +271,7 @@ startdisk(dk, checkit) dk->pid = fork(); if (dk->pid < 0) { - perror("fork"); + warn("fork"); return (8); } if (dk->pid == 0) @@ -297,14 +291,14 @@ blockcheck(origname) hotroot = 0; if (stat("/", &stslash) < 0) { - perror("/"); + warn("/"); printf("Can't stat root\n"); return (origname); } newname = origname; retry: if (stat(newname, &stblock) < 0) { - perror(newname); + warn("%s", newname); printf("Can't stat %s\n", newname); return (origname); } @@ -313,7 +307,7 @@ blockcheck(origname) hotroot++; raw = rawname(newname); if (stat(raw, &stchar) < 0) { - perror(raw); + warn("%s", raw); printf("Can't stat %s\n", raw); return (origname); } diff --git a/sbin/fsck_ifs/setup.c b/sbin/fsck_ifs/setup.c index f464b63e53ba..308dfd0e3e24 100644 --- a/sbin/fsck_ifs/setup.c +++ b/sbin/fsck_ifs/setup.c @@ -32,14 +32,16 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #define DKTYPENAMES #include -#include #include -#include #include #include diff --git a/sbin/fsck_ifs/utilities.c b/sbin/fsck_ifs/utilities.c index 465fb3be3884..0d82d6ebbcf6 100644 --- a/sbin/fsck_ifs/utilities.c +++ b/sbin/fsck_ifs/utilities.c @@ -32,11 +32,14 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include -#include #include #include @@ -267,7 +270,7 @@ ckfini(markclean) free((char *)bp); } if (bufhead.b_size != cnt) - errx(EEXIT, "Panic: lost %d buffers", bufhead.b_size - cnt); + errx(EEXIT, "panic: lost %d buffers", bufhead.b_size - cnt); pbp = pdirbp = (struct bufarea *)0; if (markclean && sblock.fs_clean == 0) { sblock.fs_clean = 1; diff --git a/sbin/quotacheck/preen.c b/sbin/quotacheck/preen.c index de9bb5598615..9705aeea9280 100644 --- a/sbin/quotacheck/preen.c +++ b/sbin/quotacheck/preen.c @@ -32,7 +32,11 @@ */ #ifndef lint +#if 0 static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include @@ -42,6 +46,7 @@ static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; #include #include +#include #include #include @@ -88,8 +93,7 @@ checkfstab(preen, maxrun, docheck, chkit) sumstatus = 0; for (passno = 1; passno <= 2; passno++) { if (setfsent() == 0) { - fprintf(stderr, "Can't open checklist file: %s\n", - _PATH_FSTAB); + warnx("can't open checklist file: %s", _PATH_FSTAB); return (8); } while ((fsp = getfsent()) != 0) { @@ -218,15 +222,11 @@ finddisk(name) dk->name[len] == 0) return (dk); } - if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) + errx(8, "out of memory"); dk = *dkp; - if ((dk->name = malloc(len + 1)) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((dk->name = malloc(len + 1)) == NULL) + errx(8, "out of memory"); (void)strncpy(dk->name, name, len); dk->name[len] = '\0'; dk->part = NULL; @@ -249,20 +249,14 @@ addpart(name, fsname, auxdata) printf("%s in fstab more than once!\n", name); return; } - if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) + errx(8, "out of memory"); pt = *ppt; - if ((pt->name = malloc(strlen(name) + 1)) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((pt->name = malloc(strlen(name) + 1)) == NULL) + errx(8, "out of memory"); (void)strcpy(pt->name, name); - if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) { - fprintf(stderr, "out of memory"); - exit (8); - } + if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) + errx(8, "out of memory"); (void)strcpy(pt->fsname, fsname); pt->next = NULL; pt->auxdata = auxdata; @@ -277,7 +271,7 @@ startdisk(dk, checkit) dk->pid = fork(); if (dk->pid < 0) { - perror("fork"); + warn("fork"); return (8); } if (dk->pid == 0) @@ -297,14 +291,14 @@ blockcheck(origname) hotroot = 0; if (stat("/", &stslash) < 0) { - perror("/"); + warn("/"); printf("Can't stat root\n"); return (origname); } newname = origname; retry: if (stat(newname, &stblock) < 0) { - perror(newname); + warn("%s", newname); printf("Can't stat %s\n", newname); return (origname); } @@ -313,7 +307,7 @@ blockcheck(origname) hotroot++; raw = rawname(newname); if (stat(raw, &stchar) < 0) { - perror(raw); + warn("%s", raw); printf("Can't stat %s\n", raw); return (origname); }