#include "stdlib.h" #include "stdio.h" #include "zlib.h" z_stream z; #define DEFAULT_BUFFER_SIZE 32*1024 #define DEFAULT_COMPRESSION Z_DEFAULT_COMPRESSION; #define MAX(a,b) ((a) >= (b) ? (a) : (b)) #define MIN(a,b) ((a) <= (b) ? (a) : (b)) char *input_buffer = NULL; char *output_buffer = NULL; int buffer_size = DEFAULT_BUFFER_SIZE; int compression_rate = DEFAULT_COMPRESSION; FILE * fin = stdin; FILE * fout = stdout; void HelpScreen (const char *progname) { fprintf(stderr, "\nDeflates using Zlib from stdin to stdout\n"); fprintf(stderr, "Usage: %s\n", progname ? progname : "deflate"); fprintf(stderr, "Options:\n"); fprintf(stderr, "\t-b\tBuffer size (default 32K). This has no effect on compression result\n"); fprintf(stderr, "\t-c\tCompression rate [1..9] where 1 is compress faster and 9 is compress better (default 6)\n"); fprintf(stderr, "\t-h\tHelp - this help screen\n"); } int main (int argc, char ** argv) { int arg; int status; int count; /* Scan command line for parameters */ for (arg=1; arg