1 /*----------------------------------------------------------------------------
2 * jacu - Just Another Compression Utility
3 *----------------------------------------------------------------------------
4 * This file is part of jacu.
6 * jacu is free software; you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation; either version 2 of the License, or (at your option) any later
11 * jacu is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * You should have received a copy of the GNU General Public License along
17 * with jacu; if not, write to the Free Software Foundation, Inc., 59 Temple
18 * Place, Suite 330, Boston, MA 02111-1307 USA
19 *----------------------------------------------------------------------------
25 void print_v(char *txt, char *data, Uint32 len)
31 for(i=0; i<len; i++) {
35 printf("%c", data[i]);
40 int main(int argc, char *argv[])
45 unsigned long int len, i, k, total;
51 fp = fopen(argv[1], "r");
53 } else if (argc == 2) {
61 data = malloc(sizeof(char)*len);
62 salida = malloc(sizeof(char)*(len+1+sizeof(unsigned long int)));
63 orig = malloc(sizeof(char)*(len+1));
73 i = bs_readblock(fp, data, len, 1);
77 bs_solve(data, salida, bs, &k, i);
79 /* XXX ACA SALIDA DEBERIA PASAR A LA SIGUIENTE ETAPA XXX */
81 bs_restore(orig, salida+sizeof(Uint32), k, i);
82 print_v("Leido : ", data, i);
83 print_v("BS : ", salida+sizeof(Uint32), i);
84 /*print_v("Restorado : ", orig, i);*/
86 fwrite(salida, 1, i, stdout);
91 /*printf("Total bytes : %ld\n", total);*/