10 printf("isz converter\n");
11 printf("usage:\n\t%s file.isz\n",progname
);
15 void pread( void * ptr
, size_t size
, size_t count
, FILE * stream
) {
16 size_t s
= fread(ptr
,size
,count
,stream
);
17 if (s
< (size
*count
)) {
18 fprintf(stderr
,"read too little\n");
22 int main (int argc
, char ** argv
) {
25 fprintf(stderr
," isz struct sz: 0x%X, %u\n",
26 (unsigned int)sizeof(isz_header
),(unsigned int)sizeof(isz_header
));
32 isz_header
* header
= malloc(sizeof(isz_header
));
34 fputs("malloc error\n",stderr
);
38 FILE * isz
= fopen(argv
[1],"rb");
40 fprintf(stderr
,"could not open %s\n",argv
[1]);
44 pread(header
,1,sizeof(isz_header
),isz
);
46 if ( memcmp( header
->signature
, ISZ_MAGIC
,
47 sizeof(ISZ_MAGIC
)) ) {
48 fputs("Invalid Magic.\n",stderr
);
52 if (header
->header_size
!= sizeof(isz_header
) ) {
53 fprintf(stderr
, "Failure: ISZ file header size incorrect (is %lu, should be %lu)\n\
54 Possibly older isz version, unsupported\n",
55 (long unsigned int)(header
->header_size
), sizeof(isz_header
));
59 printf("Version : %u\n",header
->version
);
60 printf("Volume Serial : %lu\n",(long)(header
->vsn_1
<<8)+header
->vsn_2
);
61 printf("Sector Size : %d\n", header
->sector_sz
);
62 printf("Total Sectors : %d\n",header
->total_sectors
);
63 printf("Calculated Size : %d Bytes\n", (header
->sector_sz
) * (header
->total_sectors
) );
65 printf("Password Flag : %d\n", header
->has_password
);
66 printf("Segment Size : %ld\n", header
->segment_sz
);
67 printf("Num Blocks/Chunks : %d\n", header
->nblocks
);
68 printf("Block/Chunk Size : %d\n", header
->block_sz
);
70 printf("Chunk Ptr len : %d\n", header
->block_ptr_sz
);
71 printf("Segment Number : %d\n", header
->segment_num
);
73 printf("Chunk Ptr Offset : %d\n", header
->chunk_offset
);
74 printf("Segment Offset : %d\n", header
->segment_offset
);
75 printf("Data Offset : %d\n", header
->data_offset
);