FreeBSD Bugzilla – Attachment 5471 Details for
Bug 13043
minigzip -c option support.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 3.55 KB, created by
toshi
on 1999-08-09 15:40:00 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
toshi
Created:
1999-08-09 15:40:00 UTC
Size:
3.55 KB
patch
obsolete
>--- ../../lib/libz/minigzip.c.orig Sun Jan 10 18:53:50 1999 >+++ ../../lib/libz/minigzip.c Mon Aug 9 00:30:12 1999 >@@ -122,7 +122,6 @@ > if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); > } > fclose(in); >- if (gzclose(out) != Z_OK) error("failed gzclose"); > } > > #ifdef USE_MMAP /* MMAP version, Miguel Albrecht <malbrech@eso.org> */ >@@ -157,7 +156,6 @@ > > munmap(buf, buf_len); > fclose(in); >- if (gzclose(out) != Z_OK) error("failed gzclose"); > return Z_OK; > } > #endif /* USE_MMAP */ >@@ -182,7 +180,6 @@ > error("failed fwrite"); > } > } >- if (fclose(out)) error("failed fclose"); > > if (gzclose(in) != Z_OK) error("failed gzclose"); > } >@@ -215,6 +212,7 @@ > } > gz_compress(in, out); > >+ if (gzclose(out) != Z_OK) error("failed gzclose"); > unlink(file); > } > >@@ -255,12 +253,14 @@ > > gz_uncompress(in, out); > >+ if (fclose(out)) error("failed fclose"); > unlink(infile); > } > > > /* =========================================================================== >- * Usage: minigzip [-d] [-f] [-h] [-1 to -9] [files...] >+ * Usage: minigzip [-c] [-d] [-f] [-h] [-1 to -9] [files...] >+ * -c : standart output > * -d : decompress > * -f : compress with Z_FILTERED > * -h : compress with Z_HUFFMAN_ONLY >@@ -271,6 +271,7 @@ > int argc; > char *argv[]; > { >+ int copyout = 0; > int uncompr = 0; > gzFile file; > char *bname, outmode[20]; >@@ -285,12 +286,14 @@ > bname = argv[0]; > argc--, argv++; > >- if (!strcmp(bname, "gunzip") || !strcmp(bname, "zcat")) >+ if (!strcmp(bname, "gunzip")) > uncompr = 1; >+ else if (!strcmp(bname, "zcat")) >+ copyout = uncompr = 1; > > while (argc > 0) { > if (strcmp(*argv, "-c") == 0) >- ; /* Just for compatability with gzip */ >+ copyout = 1; /* Just for compatability with gzip */ > else if (strcmp(*argv, "-d") == 0) > uncompr = 1; > else if (strcmp(*argv, "-f") == 0) >@@ -315,15 +318,39 @@ > file = gzdopen(fileno(stdout), outmode); > if (file == NULL) error("can't gzdopen stdout"); > gz_compress(stdin, file); >+ if (gzclose(file) != Z_OK) error("failed gzclose"); > } > } else { >+ if (copyout) { >+ SET_BINARY_MODE(stdout); >+ if (!uncompr) { >+ file = gzdopen(fileno(stdout), outmode); >+ if (file == NULL) error("can't gzdopen stdout"); >+ } >+ } > do { > if (uncompr) { >- file_uncompress(*argv); >+ if (copyout) { >+ file = gzopen(*argv, "rb"); >+ if (file == NULL) >+ fprintf(stderr, "%s: can't gzopen %s\n", prog, *argv); >+ else >+ gz_uncompress(file, stdout); >+ } else >+ file_uncompress(*argv); > } else { >- file_compress(*argv, outmode); >+ if (copyout) { >+ FILE * in = fopen(*argv, "rb"); >+ if (in == NULL) >+ perror(*argv); >+ else >+ gz_compress(in, file); >+ } else >+ file_compress(*argv, outmode); > } > } while (argv++, --argc); >+ if (copyout && !uncompr) >+ if (gzclose(file) != Z_OK) error("failed gzclose"); > } > exit(0); > return 0; /* to avoid warning */ >--- minigzip.1.orig Mon Jan 5 16:14:54 1998 >+++ minigzip.1 Mon Aug 9 00:07:49 1999 >@@ -32,6 +32,7 @@ > .Nd minimal implementation of the 'gzip' compression tool > .Sh SYNOPSIS > .Nm minigzip >+.Op Fl c > .Op Fl d > .Op Ar file ... > .Sh DESCRIPTION >@@ -63,6 +64,10 @@ > .Nm > reads from standard input and writes the results of the operation > to standard output. >+.Pp >+If the >+.Fl c >+option is specified, write results to standard output. > .Sh SEE ALSO > .Xr gzip 1 > .Sh AUTHORS
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 13043
: 5471 |
5472