diff options
author | peter <peter@FreeBSD.org> | 1997-03-11 12:12:26 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1997-03-11 12:12:26 +0000 |
commit | a48eeb81247462ba86a89f0d2da3405d910f05e8 (patch) | |
tree | 5c0be2f44568c7b8120a88903d4e7d873c86eef2 /sbin/dumpfs | |
parent | 7f724bc019c31a8c4431544257687485e1f4e097 (diff) | |
download | FreeBSD-src-a48eeb81247462ba86a89f0d2da3405d910f05e8.zip FreeBSD-src-a48eeb81247462ba86a89f0d2da3405d910f05e8.tar.gz |
Merge from Lite2
Diffstat (limited to 'sbin/dumpfs')
-rw-r--r-- | sbin/dumpfs/dumpfs.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/sbin/dumpfs/dumpfs.c b/sbin/dumpfs/dumpfs.c index bcde08a..a63d094 100644 --- a/sbin/dumpfs/dumpfs.c +++ b/sbin/dumpfs/dumpfs.c @@ -38,7 +38,7 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)dumpfs.c 8.2 (Berkeley) 2/2/94"; +static char sccsid[] = "@(#)dumpfs.c 8.5 (Berkeley) 4/29/95"; #endif /* not lint */ #include <sys/param.h> @@ -47,13 +47,14 @@ static char sccsid[] = "@(#)dumpfs.c 8.2 (Berkeley) 2/2/94"; #include <ufs/ufs/dinode.h> #include <ufs/ffs/fs.h> -#include <unistd.h> -#include <fcntl.h> +#include <err.h> #include <errno.h> +#include <fcntl.h> #include <fstab.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> union { struct fs fs; @@ -82,7 +83,7 @@ main(argc, argv) register struct fstab *fs; int ch, eval; - while ((ch = getopt(argc, argv, "")) != EOF) + while ((ch = getopt(argc, argv, "")) != -1) switch(ch) { case '?': default: @@ -115,13 +116,12 @@ dumpfs(name) if (read(fd, &afs, SBSIZE) != SBSIZE) goto err; - if (afs.fs_magic != FS_MAGIC) { - warnx("%s: superblock has bad magic number, skipping.", - name); - (void) close(fd); - return (1); - } - + if (afs.fs_magic != FS_MAGIC) { + warnx("%s: superblock has bad magic number, skipped", name); + (void)close(fd); + return (1); + } + if (afs.fs_postblformat == FS_42POSTBLFMT) afs.fs_nrpos = 8; dev_bsize = afs.fs_fsize / fsbtodb(&afs, 1); @@ -219,7 +219,7 @@ dumpfs(name) err: if (fd != -1) (void)close(fd); - (void)fprintf(stderr, "dumpfs: %s: %s\n", name, strerror(errno)); + warn("%s", name); return (1); }; @@ -236,7 +236,7 @@ dumpcg(name, fd, c) (off_t)dev_bsize, SEEK_SET)) == (off_t)-1) return (1); if (read(fd, &acg, afs.fs_bsize) != afs.fs_bsize) { - (void)fprintf(stderr, "dumpfs: %s: error reading cg\n", name); + warnx("%s: error reading cg", name); return (1); } printf("magic\t%x\ttell\t%qx\ttime\t%s", |