summaryrefslogtreecommitdiffstats
path: root/lib/libz/minigzip.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-06-30 23:54:46 +0000
committertjr <tjr@FreeBSD.org>2004-06-30 23:54:46 +0000
commit23687471664c322d3854e587a32af938a5b1c185 (patch)
treede1d43b9c6f17b0eac60ab29d51d8339ed949c0b /lib/libz/minigzip.c
parent6ea5314b57928a6385cf31fb23a37d5b50104805 (diff)
downloadFreeBSD-src-23687471664c322d3854e587a32af938a5b1c185.zip
FreeBSD-src-23687471664c322d3854e587a32af938a5b1c185.tar.gz
Resolve conflicts.
Diffstat (limited to 'lib/libz/minigzip.c')
-rw-r--r--lib/libz/minigzip.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/libz/minigzip.c b/lib/libz/minigzip.c
index 076aa2c..979fd9f 100644
--- a/lib/libz/minigzip.c
+++ b/lib/libz/minigzip.c
@@ -1,6 +1,6 @@
/* 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
+ * For conditions of distribution and use, see copyright notice in zlib.h
*/
/*
@@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$");
# include <sys/stat.h>
#endif
-#if defined(MSDOS) || defined(OS2) || defined(WIN32)
+#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
# include <fcntl.h>
# include <io.h>
# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
@@ -113,7 +113,7 @@ void gz_compress(in, out)
if (gz_compress_mmap(in, out) == Z_OK) return;
#endif
for (;;) {
- len = fread(buf, 1, sizeof(buf), in);
+ len = (int)fread(buf, 1, sizeof(buf), in);
if (ferror(in)) {
perror("fread");
exit(1);
@@ -148,7 +148,7 @@ int gz_compress_mmap(in, out)
if (buf_len <= 0) return Z_ERRNO;
/* Now do the actual mmap: */
- buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0);
+ buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0);
if (buf == (caddr_t)(-1)) return Z_ERRNO;
/* Compress the whole file at once: */
@@ -180,8 +180,8 @@ void gz_uncompress(in, out)
if (len == 0) break;
if ((int)fwrite(buf, 1, (unsigned)len, out) != len) {
- error("failed fwrite");
- }
+ error("failed fwrite");
+ }
}
if (fclose(out)) error("failed fclose");
@@ -271,11 +271,12 @@ void file_uncompress(file)
/* ===========================================================================
- * Usage: minigzip [-c ] [-d] [-f] [-h] [-1 to -9] [files...]
+ * Usage: minigzip [-c] [-d] [-f] [-h] [-r] [-1 to -9] [files...]
* -c : write to standard output
* -d : decompress
* -f : compress with Z_FILTERED
* -h : compress with Z_HUFFMAN_ONLY
+ * -r : compress with Z_RLE
* -1 to -9 : compression level
*/
@@ -309,14 +310,16 @@ int main(argc, argv)
else if (strcmp(*argv, "-d") == 0)
uncompr = 1;
else if (strcmp(*argv, "-f") == 0)
- outmode[3] = 'f';
+ outmode[3] = 'f';
else if (strcmp(*argv, "-h") == 0)
- outmode[3] = 'h';
+ outmode[3] = 'h';
+ else if (strcmp(*argv, "-r") == 0)
+ outmode[3] = 'R';
else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' &&
- (*argv)[2] == 0)
- outmode[2] = (*argv)[1];
+ (*argv)[2] == 0)
+ outmode[2] = (*argv)[1];
else
- break;
+ break;
argc--, argv++;
}
if (argc == 0) {
@@ -365,6 +368,5 @@ int main(argc, argv)
}
} while (argv++, --argc);
}
- exit(0);
- return 0; /* to avoid warning */
+ return 0;
}
OpenPOWER on IntegriCloud