/**************************************************************************** main ****************************************************************************/ int main(int argc, char *argv[]) { int level; int result; int no_comp_diff = 48; printf("ISO9660 comp/dec to/from CISO/ZISO v1.1 by SWAT\n"); if (argc < 5) { printf("Usage: %s library level infile outfile [no_comp_diff_bytes]\n", argv[0]); printf(" level: 1-9 for compress (1=fast/large - 9=small/slow), 0 for decompress\n"); printf(" library: zlib or lzo\n\n"); return 0; } level = argv[2][0] - '0'; if(level < 0 || level > 9) { printf("Unknown mode: %c\n", argv[2][0]); return 1; } fname_in = argv[3]; fname_out = argv[4]; if(argc > 5) { no_comp_diff = atoi(argv[5]); } if(!strcmp("lzo", argv[1])) { is_ziso = 1; } if ((fin = fopen(fname_in, "rb")) == NULL) { printf("Can't open %s\n", fname_in); return 1; } if ((fout = fopen(fname_out, "wb")) == NULL) { printf("Can't create %s\n", fname_out); return 1; } if(level==0) result = decomp_ciso(); else result = comp_ciso(level, no_comp_diff); /* free memory */ if(index_buf) free(index_buf); if(crc_buf) free(crc_buf); if(block_buf1) free(block_buf1); if(block_buf2) free(block_buf2); /* close files */ fclose(fin); fclose(fout); return result; }
/**************************************************************************** main ****************************************************************************/ int main(int argc, char *argv[]) { int level; int result; if (argc != 4) { fprintf(stderr, "Usage: cbin level infile outfile\n"); fprintf(stderr, " level: 1-9 compress ISO to CBN (1=fast/large - 9=small/slow\n"); fprintf(stderr, " 0 decompress CBN to ISO\n"); return 0; } level = argv[1][0] - '0'; if(level < 0 || level > 9) { fprintf(stderr, "Unknown mode: %c\n", argv[1][0]); return 1; } fname_in = argv[2]; fname_out = argv[3]; if ((fin = fopen(fname_in, "rb")) == NULL) { fprintf(stderr, "Can't open %s\n", fname_in); return 1; } if ((fout = fopen(fname_out, "wb")) == NULL) { fprintf(stderr, "Can't create %s\n", fname_out); return 1; } if(level==0) result = decomp_ciso(); else result = comp_ciso(level); // free memory if(index_buf) free(index_buf); if(crc_buf) free(crc_buf); if(block_buf1) free(block_buf1); if(block_buf2) free(block_buf2); // close files fclose(fin); fclose(fout); return result; }