11 #include "sfs_index.h"
14 void printittr(
SFS_ittr *ittr,
int ctr) {
17 attr[0] = (ittr->entry.attr == SFS_ATTR_CD) ?
'C' :
'-';
18 attr[1] = (ittr->entry.attr & SFS_ATTR_NOCD) ?
'N' :
'-';
19 attr[2] = (ittr->entry.attr & SFS_ATTR_STICKY_CD) ?
'S' :
'-';
20 attr[3] = (ittr->entry.attr & SFS_ATTR_POPSTICKY) ?
'P' :
'-';
23 memcpy(type, ittr->entry.type, 4);
25 printf(
"#%05d@%12lld: %s %s %s [S:%s] [P:%s] [F:%s] (totsz=%d) (skipped %d)\n",
33 ittr->entry.sz + ittr->entry.head_sz,
37 int main(
int argc,
char *argv[])
40 printf(
"sfs_headers filename\n");
48 long long int sz = statbuf.st_size;
53 if(file.opendisk(fn, O_RDONLY) < 0) {
54 printf(
"Error openeing file %s (%s)\n",fn,strerror(errno));
62 long long int pos = 0;
63 while((ittr.next() >=0) && (ittr.filepos >= 0)) {
67 pos += ittr.entry.sz + ittr.entry.head_sz + ittr.skipped_bytes;
71 printf(
"Filesz = %lld Position = %lld\n",sz,pos);
73 int fd = open(fn, O_RDONLY);
74 lseek(fd, pos-200, SEEK_SET);
76 int ret = read(fd, buff, 25600);
78 printf(
"Errr Buffer: \n\t");
79 for(
int i=0;i<ret;i++) {
83 if(!isprint(c)) c =
'.';
86 if((i+1) % 10 == 0) printf(
" ");
87 if((i+1) % 100 == 0) printf(
"\n\t");
88 if((i+1) == 200) printf(
"\n\t-----------------------\n\n\t");