summaryrefslogtreecommitdiff
path: root/ufs-utils
diff options
context:
space:
mode:
authorHurd Maintainers <hurd-maintainers@gnu.org>1994-10-04 23:44:09 +0000
committerHurd Maintainers <hurd-maintainers@gnu.org>1994-10-04 23:44:09 +0000
commitd18f25f9700cd9672e19c07a00d227a317247ddb (patch)
tree5b856621461c28b2c91a907255c8222d50d32072 /ufs-utils
parentf59914f17bdde169e5ad516c4b24f890a2b27bb6 (diff)
entered into RCS
Diffstat (limited to 'ufs-utils')
-rw-r--r--ufs-utils/clri.c41
1 files changed, 32 insertions, 9 deletions
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 <sys/param.h>
#include <sys/time.h>
-#include <ufs/ufs/dinode.h>
-#include <ufs/ffs/fs.h>
+#include "../ufs/dinode.h"
+#include "../ufs/fs.h"
+
+
-#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
@@ -60,6 +61,10 @@ static char sccsid[] = "@(#)clri.c 8.2 (Berkeley) 9/23/93";
#include <stdio.h>
#include <unistd.h>
+#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);