FreeBSD Bugzilla – Attachment 5472 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]
minigzip.stdout.fbsd5.patch
minigzip.stdout.fbsd5.patch (text/plain; charset=us-ascii), 4.85 KB, created by
jontow
on 2002-06-09 15:37:39 UTC
(
hide
)
Description:
minigzip.stdout.fbsd5.patch
Filename:
MIME Type:
Creator:
jontow
Created:
2002-06-09 15:37:39 UTC
Size:
4.85 KB
patch
obsolete
>*** ../../lib/libz/minigzip.c.orig Sun Jun 9 10:00:14 2002 >--- ../../lib/libz/minigzip.c Sun Jun 9 10:18:00 2002 >*************** >*** 123,129 **** > 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> */ >--- 123,128 ---- >*************** >*** 158,164 **** > > munmap(buf, buf_len); > fclose(in); >- if (gzclose(out) != Z_OK) error("failed gzclose"); > return Z_OK; > } > #endif /* USE_MMAP */ >--- 157,162 ---- >*************** >*** 183,189 **** > error("failed fwrite"); > } > } >- if (fclose(out)) error("failed fclose"); > > if (gzclose(in) != Z_OK) error("failed gzclose"); > } >--- 181,186 ---- >*************** >*** 221,226 **** >--- 218,224 ---- > } > gz_compress(in, out); > >+ if (gzclose(out) != Z_OK) error("failed gzclose"); > unlink(file); > } > >*************** >*** 266,277 **** > > gz_uncompress(in, out); > > unlink(infile); > } > > > /* =========================================================================== >! * Usage: minigzip [-d] [-f] [-h] [-1 to -9] [files...] > * -d : decompress > * -f : compress with Z_FILTERED > * -h : compress with Z_HUFFMAN_ONLY >--- 264,277 ---- > > gz_uncompress(in, out); > >+ if (fclose(out)) error("failed fclose"); > unlink(infile); > } > > > /* =========================================================================== >! * Usage: minigzip [-c ] [-d] [-f] [-h] [-1 to -9] [files...] >! * -c : decompress to standard output > * -d : decompress > * -f : compress with Z_FILTERED > * -h : compress with Z_HUFFMAN_ONLY >*************** >*** 282,287 **** >--- 282,288 ---- > int argc; > char *argv[]; > { >+ int copyout = 0; > int uncompr = 0; > gzFile file; > char *bname, outmode[20]; >*************** >*** 296,307 **** > bname = argv[0]; > argc--, argv++; > >! if (!strcmp(bname, "gunzip") || !strcmp(bname, "zcat")) > uncompr = 1; > > while (argc > 0) { > if (strcmp(*argv, "-c") == 0) >! ; /* Just for compatibility with gzip */ > else if (strcmp(*argv, "-d") == 0) > uncompr = 1; > else if (strcmp(*argv, "-f") == 0) >--- 297,310 ---- > bname = argv[0]; > argc--, argv++; > >! if (!strcmp(bname, "gunzip")) > uncompr = 1; >+ else if (!strcmp(bname, "zcat")) >+ copyout = uncompr = 1; > > while (argc > 0) { > if (strcmp(*argv, "-c") == 0) >! copyout = 1; /* Just for compatibility with gzip */ > else if (strcmp(*argv, "-d") == 0) > uncompr = 1; > else if (strcmp(*argv, "-f") == 0) >*************** >*** 326,341 **** > file = gzdopen(fileno(stdout), outmode); > if (file == NULL) error("can't gzdopen stdout"); > gz_compress(stdin, file); > } > } else { > do { > if (uncompr) { >! file_uncompress(*argv); > } else { >! file_compress(*argv, outmode); > } > } while (argv++, --argc); > } > exit(0); > return 0; /* to avoid warning */ > } >--- 329,371 ---- > 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) { >! 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 { >! 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 */ > } >*** ../../usr.bin/minigzip/minigzip.1.orig Sat Apr 20 08:15:48 2002 >--- ../../usr.bin/minigzip/minigzip.1 Sun Jun 9 10:27:05 2002 >*************** >*** 32,37 **** >--- 32,38 ---- > .Nd minimal implementation of the 'gzip' compression tool > .Sh SYNOPSIS > .Nm >+ .Op Fl c > .Op Fl d > .Op Ar > .Sh DESCRIPTION >*************** >*** 64,69 **** >--- 65,74 ---- > .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