2 #include "statichuff/statichuff.h"
3 #include "blocksorting/bs.h"
9 int main(int argc, char* argv[])
14 long int volumesize = 0;
18 while ((ch = getopt(argc, argv, "cdt:")) != -1) {
28 volumesize = atoi(optarg);
31 default: fprintf(stderr, "Usage: %s [-cdt] sourcefile targetfile\n", argv[0]);
36 if ( (argc == 1) || (cflag & dflag) || !(cflag | dflag) || ((argc - optind) < 2) ) {
37 fprintf(stderr, "Usage: %s [-cdt] sourcefile targetfile\n", argv[0]);
38 if ((tflag == 1) && (volumesize <= 0)) fprintf(stderr,"Error: The volume size must be a non-zero value\n");
44 /* No me gusta el tmpfile ... es para probar como anda todo junto */
46 unsigned long int len, i, j, total, k;
48 char *salida, *data, c;
50 data = malloc(sizeof(char)*len);
51 salida = malloc(sizeof(char)*(len));
53 fp = fopen(argv[optind], "rb");
54 fp_out = fopen("tmp.comp", "wb");
59 while ((!feof(fp)) && (i < len)) {
65 bs_solve(data, salida, bs, &k, i);
66 /* Le aplico el MTF */
67 mtf = jacu_mtf(salida, i);
69 fputc(mtf[j], fp_out);
74 return shuff_encode_file("tmp.comp",argv[optind+1]);
79 return shuff_decode_file(argv[optind],argv[optind+1]);