00001 #include <sfs_index.h>
00002 #include <stdio.h>
00003 #include <rtsLog.h>
00004
00005
00006
00007 int main(int argc, char *argv[])
00008 {
00009 rtsLogOutput(2);
00010
00011
00012 if(argc < 2) {
00013 printf("Need a filename and offset\n");
00014 exit(0);
00015 }
00016
00017
00018
00019 sfs_index sfs;
00020
00021
00022 long long int off = 0;
00023 if(argc>2) off = atoi(argv[2]);
00024
00025 int sz = 0;
00026 int ret = sfs.mountSingleDir(argv[1], off);
00027
00028 if(ret < 0) {
00029 printf("Error mounting %s",argv[1]);
00030 return -1;
00031 }
00032
00033 do {
00034 int last_sz = sz;
00035 long long int last_off = off;
00036 sz= sfs.singleDirSize;
00037 off = sfs.singleDirOffset;
00038
00039
00040 LOG("JEFF", "Mounting new directory: (%s) offset=%lld (calc: %lld) size=%d",
00041 sfs.singleDirIttr->fullpath,
00042 off,
00043 (last_off + last_sz) - off,
00044 sz);
00045
00046
00047 fs_dir *dir = sfs.opendir("/");
00048 if(dir) {
00049 fs_filelist list;
00050 sfs.mem_ls(&list, 1, dir);
00051 for(int i=0;i<list.n;i++) {
00052 if(strstr(list.filename[i], "TRGID") != NULL) {
00053 int sz = sfs.fileSize(list.filename[i]);
00054 LOG("JEFF", "%s: %d bytes",list.filename[i],sz);
00055 char *buff = (char *)malloc(sz);
00056 sfs.read(list.filename[i], buff, sz);
00057 sfs.hexdump(buff, sz);
00058 free(buff);
00059 }
00060 }
00061
00062 sfs.closedir(dir);
00063 }
00064 else {
00065 printf("no rootdir?\n");
00066 }
00067
00068 ret = sfs.mountNextDir();
00069 } while(ret > 0);
00070
00071
00072 }
00073
00074
00075