/* minigzip.c -- simulate gzip using the zlib compression library
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
* minigzip is a minimal implementation of the gzip utility. This is
* only an example of using zlib and isn't meant to replace the
* full-featured gzip. No attempt is made to deal with file systems
* limiting names to 14 or 8+3 characters, etc... Error checking is
* very limited. So use minigzip only for testing; use gzip for the
* real thing. On MSDOS, use only on file names without extension
* or in pipe mode.
*/
#include <stdio.h>
#include "zlib.h"
#ifdef STDC
# include <string.h>
# include <stdlib.h>
#else
#endif
#ifdef USE_MMAP
#endif
# include <fcntl.h>
# include <io.h>
#else
#endif
#ifdef VMS
#endif
#ifdef RISCOS
#endif
# include <unix.h> /* for fileno */
#endif
#endif
#ifndef GZ_SUFFIX
#endif
#ifdef MAXSEG_64K
# define local static
/* Needed for systems with limitation on stack size. */
#else
# define local
#endif
char *prog;
#ifdef USE_MMAP
#endif
/* ===========================================================================
* Display error message and exit
*/
const char *msg;
{
exit(1);
}
/* ===========================================================================
* Compress input to output then close both files.
*/
{
int len;
int err;
#ifdef USE_MMAP
/* Try first compressing with mmap. If mmap fails (minigzip used in a
* pipe), use the normal fread loop.
*/
#endif
for (;;) {
perror("fread");
exit(1);
}
if (len == 0) break;
}
}
#ifdef USE_MMAP /* MMAP version, Miguel Albrecht <malbrech@eso.org> */
/* Try compressing the input file at once using mmap. Return Z_OK if
* if success, Z_ERRNO otherwise.
*/
{
int len;
int err;
/* Determine the size of the file, needed for mmap: */
/* Now do the actual mmap: */
/* Compress the whole file at once: */
return Z_OK;
}
#endif /* USE_MMAP */
/* ===========================================================================
* Uncompress input to output then close both files.
*/
{
int len;
int err;
for (;;) {
if (len == 0) break;
error("failed fwrite");
}
}
}
/* ===========================================================================
* Compress the given file: create a corresponding .gz file and remove the
* original.
*/
char *file;
char *mode;
{
exit(1);
}
exit(1);
}
}
/* ===========================================================================
* Uncompress the given file and remove the original.
*/
char *file;
{
} else {
}
exit(1);
}
exit(1);
}
}
/* ===========================================================================
* Usage: minigzip [-d] [-f] [-h] [-1 to -9] [files...]
* -d : decompress
* -f : compress with Z_FILTERED
* -h : compress with Z_HUFFMAN_ONLY
* -1 to -9 : compression level
*/
int argc;
char *argv[];
{
int uncompr = 0;
while (argc > 0) {
uncompr = 1;
(*argv)[2] == 0)
else
break;
}
if (argc == 0) {
if (uncompr) {
} else {
}
} else {
do {
if (uncompr) {
} else {
}
}
exit(0);
return 0; /* to avoid warning */
}