src/hg/oneShot/freen/freen.c 1.92
1.92 2009/11/12 23:11:54 kent
More zlib testing.
Index: src/hg/oneShot/freen/freen.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/oneShot/freen/freen.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -b -B -U 1000000 -r1.91 -r1.92
--- src/hg/oneShot/freen/freen.c 10 Nov 2009 20:52:58 -0000 1.91
+++ src/hg/oneShot/freen/freen.c 12 Nov 2009 23:11:54 -0000 1.92
@@ -1,48 +1,55 @@
/* freen - My Pet Freen. */
#include "common.h"
+#include "options.h"
#include "zlibFace.h"
#include "memalloc.h"
#include "dystring.h"
#include "linefile.h"
#include "hash.h"
#include "obscure.h"
static char const rcsid[] = "$Id$";
void usage()
{
errAbort("freen - test some hairbrained thing.\n"
"usage: freen file\n");
}
+static struct optionSpec options[] = {
+ {NULL, 0},
+};
+
void freen(char *input, char *output, char *uncompressed)
/* Test some hair-brained thing. */
{
size_t uncompressedSize;
char *uncompressedBuf;
readInGulp(input, &uncompressedBuf, &uncompressedSize);
size_t compBufSize = zCompBufSize(uncompressedSize);
char *compBuf = needLargeMem(compBufSize);
size_t compressedSize = zCompress(uncompressedBuf, uncompressedSize, compBuf, compBufSize);
printf("uncompressedSize %d, compressedSize %d\n", (int)uncompressedSize, (int)compressedSize);
FILE *f = mustOpen(output, "wb");
mustWrite(f, compBuf, compressedSize);
carefulClose(&f);
f = mustOpen(uncompressed, "wb");
memset(uncompressedBuf, 0, uncompressedSize);
size_t uncSize = zUncompress(compBuf, compressedSize, uncompressedBuf, uncompressedSize);
printf("uncompressedSize %d\n", (int)uncSize);
mustWrite(f, uncompressedBuf, uncSize);
carefulClose(&f);
}
int main(int argc, char *argv[])
/* Process command line. */
{
+optionInit(&argc, argv, options);
if (argc != 4)
usage();
+zSelfTest(100);
freen(argv[1], argv[2], argv[3]);
return 0;
}