BSD 4 release
[unix-history] / usr / src / cmd / clri.c
index d4da6de..78f7c79 100644 (file)
@@ -1,11 +1,12 @@
+static char *sccsid = "@(#)clri.c      4.1 (Berkeley) 10/1/80";
 /*
  * clri filsys inumber ...
  */
 
 /*
  * clri filsys inumber ...
  */
 
-#include <sys/types.h>
+#include <sys/param.h>
 #include <sys/ino.h>
 #include <sys/ino.h>
+
 #define ISIZE  (sizeof(struct dinode))
 #define ISIZE  (sizeof(struct dinode))
-#define        BSIZE   512
 #define        NI      (BSIZE/ISIZE)
 struct ino
 {
 #define        NI      (BSIZE/ISIZE)
 struct ino
 {
@@ -43,7 +44,7 @@ char *argv[];
                        status = 1;
                        continue;
                }
                        status = 1;
                        continue;
                }
-               off = ((n-1)/NI + 2) * (long)512;
+               off = itod(n) * BSIZE;
                lseek(f, off, 0);
                if(read(f, (char *)buf, BSIZE) != BSIZE) {
                        printf("%s: read error\n", argv[i]);
                lseek(f, off, 0);
                if(read(f, (char *)buf, BSIZE) != BSIZE) {
                        printf("%s: read error\n", argv[i]);
@@ -55,10 +56,10 @@ char *argv[];
        for(i=2; i<argc; i++) {
                n = atoi(argv[i]);
                printf("clearing %u\n", n);
        for(i=2; i<argc; i++) {
                n = atoi(argv[i]);
                printf("clearing %u\n", n);
-               off = ((n-1)/NI + 2) * (long)512;
+               off = itod(n) * BSIZE;
                lseek(f, off, 0);
                read(f, (char *)buf, BSIZE);
                lseek(f, off, 0);
                read(f, (char *)buf, BSIZE);
-               j = (n-1)%NI;
+               j = itoo(n);
                for(k=0; k<ISIZE; k++)
                        buf[j].junk[k] = 0;
                lseek(f, off, 0);
                for(k=0; k<ISIZE; k++)
                        buf[j].junk[k] = 0;
                lseek(f, off, 0);