20 #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) 23 # define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) 25 # define SET_BINARY_MODE(file) 36 int def(FILE *source, FILE *dest,
int level)
70 if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
92 int inf(FILE *source, FILE *dest)
113 if (ferror(source)) {
136 if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
153 fputs(
"zpipe: ", stderr);
157 fputs(
"error reading stdin\n", stderr);
159 fputs(
"error writing stdout\n", stderr);
162 fputs(
"invalid compression level\n", stderr);
165 fputs(
"invalid or incomplete deflate data\n", stderr);
168 fputs(
"out of memory\n", stderr);
171 fputs(
"zlib version mismatch!\n", stderr);
176 int main(
int argc,
char **argv)
193 else if (argc == 2 && strcmp(argv[1],
"-d") == 0) {
194 ret =
inf(stdin, stdout);
202 fputs(
"zpipe usage: zpipe [-d] < source > dest\n", stderr);
int deflateEnd(z_streamp strm)
static int out(void *out_desc, unsigned char *buf, unsigned len)
int inf(FILE *source, FILE *dest)
#define SET_BINARY_MODE(file)
static unsigned in(void *in_desc, z_const unsigned char **buf)
#define deflateInit(strm, level)
#define inflateInit(strm)
int inflateEnd(z_streamp strm)
int inflate(z_streamp strm, int flush)
int def(FILE *source, FILE *dest, int level)
int deflate(z_streamp strm, int flush)
int main(int argc, char **argv)
#define Z_DEFAULT_COMPRESSION