From d18f25f9700cd9672e19c07a00d227a317247ddb Mon Sep 17 00:00:00 2001 From: Hurd Maintainers Date: Tue, 4 Oct 1994 23:44:09 +0000 Subject: entered into RCS --- ufs-utils/clri.c | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'ufs-utils/clri.c') diff --git a/ufs-utils/clri.c b/ufs-utils/clri.c index bebc262f..203073e2 100644 --- a/ufs-utils/clri.c +++ b/ufs-utils/clri.c @@ -49,10 +49,11 @@ static char sccsid[] = "@(#)clri.c 8.2 (Berkeley) 9/23/93"; #include #include -#include -#include +#include "../ufs/dinode.h" +#include "../ufs/fs.h" + + -#include #include #include #include @@ -60,6 +61,10 @@ static char sccsid[] = "@(#)clri.c 8.2 (Berkeley) 9/23/93"; #include #include +#define MAXPHYS (64 * 1024) +#define DEV_BSIZE 512 + + int main(argc, argv) int argc; @@ -83,9 +88,15 @@ main(argc, argv) /* get the superblock. */ if ((fd = open(fs, O_RDWR, 0)) < 0) - err(1, "%s", fs); + { + perror (fs); + exit (1); + } if (lseek(fd, (off_t)(SBLOCK * DEV_BSIZE), SEEK_SET) < 0) - err(1, "%s", fs); + { + perror (fs); + exit (1); + } if (read(fd, sblock, sizeof(sblock)) != sizeof(sblock)) { (void)fprintf(stderr, "clri: %s: can't read the superblock.\n", fs); @@ -118,9 +129,15 @@ main(argc, argv) /* seek and read the block */ if (lseek(fd, offset, SEEK_SET) < 0) - err(1, "%s", fs); + { + perror (fs); + exit (1); + } if (read(fd, ibuf, bsize) != bsize) - err(1, "%s", fs); + { + perror (fs); + exit (1); + } /* get the inode within the block. */ ip = &ibuf[ino_to_fsbo(sbp, inonum)]; @@ -132,9 +149,15 @@ main(argc, argv) /* backup and write the block */ if (lseek(fd, (off_t)-bsize, SEEK_CUR) < 0) - err(1, "%s", fs); + { + perror (fs); + exit (1); + } if (write(fd, ibuf, bsize) != bsize) - err(1, "%s", fs); + { + perror (fs); + exit (1); + } (void)fsync(fd); } (void)close(fd); -- cgit v1.2.3