--- /dev/null
+#----------------------------------------------------------------------------
+# jacu
+#----------------------------------------------------------------------------
+# This file is part of jacu.
+#
+# jacu is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# jacu is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along
+# with jacu; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+#----------------------------------------------------------------------------
+# Creado: jue jun 17 00:41:52 ART 2004
+# Autores: Leandro Lucarella <llucare@fi.uba.ar>
+#----------------------------------------------------------------------------
+#
+# $Id: bufford.c 624 2004-05-30 20:18:04Z llucare $
+#
+
+TARGETS=jacu
+COMMON=
+SRCS=main.c
+
+#CFLAGS=-O3 -Wall -DNDEBUG
+CFLAGS=-ggdb -Wall -DDEBUG
+
+all: $(TARGETS)
+
+jacu: $(COMMON) main.o
+
+depend:
+ makedepend -- $(CFLAGS) -- $(SRCS)
+
+clean:
+ @$(RM) -f *.o $(TARGETS)
+
+.PHONY: all clean depend
+
+# DO NOT DELETE
+
+main.o: statichuff/statichuff.h /usr/include/stdio.h /usr/include/features.h
+main.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
+main.o: /usr/include/bits/types.h /usr/include/bits/wordsize.h
+main.o: /usr/include/bits/typesizes.h /usr/include/libio.h
+main.o: /usr/include/_G_config.h /usr/include/wchar.h
+main.o: /usr/include/bits/wchar.h /usr/include/gconv.h
+main.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h
+main.o: /usr/include/unistd.h /usr/include/bits/posix_opt.h
+main.o: /usr/include/bits/confname.h blocksorting/bs.h /usr/include/string.h
+main.o: /usr/include/stdlib.h mtf/mtf.h
--- /dev/null
+
+#include "statichuff/statichuff.h"
+#include "blocksorting/bs.h"
+#include "mtf/mtf.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+int main(int argc, char* argv[])
+{
+ int cflag = 0;
+ int dflag = 0;
+ int tflag = 0;
+ long int volumesize = 0;
+ int ch;
+ t_BlockSort *bs;
+
+ while ((ch = getopt(argc, argv, "cdt:")) != -1) {
+
+ switch (ch) {
+ case 'c': cflag = 1;
+ break;
+
+ case 'd': dflag = 1;
+ break;
+
+ case 't': tflag = 1;
+ volumesize = atoi(optarg);
+ break;
+
+ default: fprintf(stderr, "Usage: %s [-cdt] sourcefile targetfile\n", argv[0]);
+ return(2);
+ }
+ }
+
+ if ( (argc == 1) || (cflag & dflag) || !(cflag | dflag) || ((argc - optind) < 2) ) {
+ fprintf(stderr, "Usage: %s [-cdt] sourcefile targetfile\n", argv[0]);
+ if ((tflag == 1) && (volumesize <= 0)) fprintf(stderr,"Error: The volume size must be a non-zero value\n");
+ return (2);
+ }
+
+ if (cflag == 1) {
+ /* Comprimo */
+ /* No me gusta el tmpfile ... es para probar como anda todo junto */
+ FILE *fp, *fp_out;
+ unsigned long int len, i, j, total, k;
+ int *mtf;
+ char *salida, *data, c;
+ len = 4096;
+ data = malloc(sizeof(char)*len);
+ salida = malloc(sizeof(char)*(len));
+ bs = bs_create(len);
+ fp = fopen(argv[optind], "rb");
+ fp_out = fopen("tmp.comp", "wb");
+ c = fgetc(fp);
+ total = 0;
+ while (!feof(fp)) {
+ i = 0;
+ while ((!feof(fp)) && (i < len)) {
+ data[i++] = c;
+ c = fgetc(fp);
+ total++;
+ }
+ /* Hago el BS */
+ bs_solve(data, salida, bs, &k, i);
+ /* Le aplico el MTF */
+ mtf = jacu_mtf(salida, i);
+ for(j=0; j<i; j++)
+ fputc(mtf[j], fp_out);
+ }
+ fclose(fp);
+ fclose(fp_out);
+ bs_destroy(bs);
+ return shuff_encode_file("tmp.comp",argv[optind+1]);
+ }
+
+ if (dflag == 1) {
+ /* Descomprimo */
+ return shuff_decode_file(argv[optind],argv[optind+1]);
+ }
+
+ return 0;
+}