svn commit: r296626 - head/usr.bin/mkuzip
Maxim Sobolev
sobomax at FreeBSD.org
Thu Mar 10 21:36:26 UTC 2016
Author: sobomax
Date: Thu Mar 10 21:36:24 2016
New Revision: 296626
URL: https://svnweb.freebsd.org/changeset/base/296626
Log:
Add -S option to print out summary after compression has been
completed.
MFC after: 2 weeks
Modified:
head/usr.bin/mkuzip/mkuzip.8
head/usr.bin/mkuzip/mkuzip.c
Modified: head/usr.bin/mkuzip/mkuzip.8
==============================================================================
--- head/usr.bin/mkuzip/mkuzip.8 Thu Mar 10 21:16:01 2016 (r296625)
+++ head/usr.bin/mkuzip/mkuzip.8 Thu Mar 10 21:36:24 2016 (r296626)
@@ -118,6 +118,9 @@ detects identical blocks in the input an
of such block with pointer to the very first one in the output.
Setting this option results is moderate decrease of compressed image size,
typically around 3-5% of a final size of the compressed image.
+.It Fl S
+Print summary about the compression ratio as well as output
+file size after file has been processed.
.El
.Sh NOTES
The compression ratio largely depends on the cluster size used.
Modified: head/usr.bin/mkuzip/mkuzip.c
==============================================================================
--- head/usr.bin/mkuzip/mkuzip.c Thu Mar 10 21:16:01 2016 (r296625)
+++ head/usr.bin/mkuzip/mkuzip.c Thu Mar 10 21:36:24 2016 (r296626)
@@ -90,6 +90,7 @@ int main(int argc, char **argv)
char *iname, *oname, *obuf, *ibuf;
uint64_t *toc;
int fdr, fdw, i, opt, verbose, no_zcomp, tmp, en_dedup;
+ int summary;
struct iovec iov[2];
struct stat sb;
uint32_t destlen;
@@ -104,9 +105,10 @@ int main(int argc, char **argv)
verbose = 0;
no_zcomp = 0;
en_dedup = 0;
+ summary = 0;
handler = &uzip_fmt;
- while((opt = getopt(argc, argv, "o:s:vZdL")) != -1) {
+ while((opt = getopt(argc, argv, "o:s:vZdLS")) != -1) {
switch(opt) {
case 'o':
oname = optarg;
@@ -138,6 +140,10 @@ int main(int argc, char **argv)
handler = &ulzma_fmt;
break;
+ case 'S':
+ summary = 1;
+ break;
+
default:
usage();
/* Not reached */
@@ -294,7 +300,7 @@ int main(int argc, char **argv)
}
close(fdr);
- if (verbose != 0)
+ if (verbose != 0 || summary != 0)
fprintf(stderr, "compressed data to %ju bytes, saved %lld "
"bytes, %.2f%% decrease.\n", offset,
(long long)(sb.st_size - offset),
@@ -337,7 +343,7 @@ static void
usage(void)
{
- fprintf(stderr, "usage: mkuzip [-vZdL] [-o outfile] [-s cluster_size] "
+ fprintf(stderr, "usage: mkuzip [-vZdLS] [-o outfile] [-s cluster_size] "
"infile\n");
exit(1);
}
More information about the svn-src-all
mailing list