static char *sccsid
= "@(#)ncheck.c 1.2 (Berkeley) %G%";
* ncheck -- obtain file names from reading filesystem
#define NDIR (BSIZE/sizeof(struct direct))
struct dinode itab
[MAXIPG
];
fprintf(stderr
, "ncheck: bad flag %c\n", (*argv
)[1]);
fprintf(stderr
, "ncheck: cannot open %s\n", file
);
bread(SBLOCK
, (char *)&sblock
, sizeof(sblock
));
for (c
= 0; c
< sblock
.fs_ncg
; c
++) {
bread(cgimin(c
, &sblock
), (char *)itab
,
sblock
.fs_ipg
* sizeof (struct dinode
));
for(j
=0; j
<sblock
.fs_ipg
; j
++) {
for (c
= 0; c
< sblock
.fs_ncg
; c
++) {
bread(cgimin(c
, &sblock
), (char *)itab
,
sblock
.fs_ipg
* sizeof (struct dinode
));
for(j
=0; j
<sblock
.fs_ipg
; j
++) {
for (c
= 0; c
< sblock
.fs_ncg
; c
++) {
bread(cgimin(c
, &sblock
), (char *)itab
,
sblock
.fs_ipg
* sizeof (struct dinode
));
for(j
=0; j
<sblock
.fs_ipg
; j
++) {
register struct dinode
*ip
;
if((ip
->di_mode
& IFMT
) != IFDIR
) {
if (sflg
==0 || nxfile
>=NB
)
if ((ip
->di_mode
&IFMT
)==IFBLK
|| (ip
->di_mode
&IFMT
)==IFCHR
|| ip
->di_mode
&(ISUID
|ISGID
))
register struct dinode
*ip
;
struct direct dbuf
[NDIR
];
if((ip
->di_mode
&IFMT
) != IFDIR
)
bread(d
, (char *)dbuf
, sizeof(dbuf
));
doff
+= sizeof(struct direct
);
hp
->h_name
[k
] = dp
->d_name
[k
];
register struct dinode
*ip
;
struct direct dbuf
[NDIR
];
if((ip
->di_mode
&IFMT
) != IFDIR
)
bread(d
, (char *)dbuf
, sizeof(dbuf
));
doff
+= sizeof(struct direct
);
if(aflg
==0 && dotname(dp
))
for(k
=0; ilist
[k
] != 0; k
++)
printf("/%.14s", dp
->d_name
);
register struct direct
*dp
;
if (dp
->d_name
[1]==0 || (dp
->d_name
[1]=='.' && dp
->d_name
[2]==0))
register struct htab
*hp
;
if ((hp
= lookup(i
, 0)) == 0) {
pname(hp
->h_pino
, ++lev
);
printf("/%.14s", hp
->h_name
);
register struct htab
*hp
;
for (hp
= &htab
[i
%HSIZE
]; hp
->h_ino
;) {
if (++hp
>= &htab
[HSIZE
])
fprintf(stderr
, "ncheck: out of core-- increase HSIZE\n");
if (read(fi
, buf
, cnt
) != cnt
) {
fprintf(stderr
, "ncheck: read error %d\n", bno
);
fprintf(stderr
, "ncheck: %u - huge directory\n", ino
);
bread(gip
->di_ib
[i
], (char *)ibuf
, sizeof(ibuf
));