aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/mkuzip
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2016-03-10 21:36:24 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2016-03-10 21:36:24 +0000
commitd83e07789d1ee151ae564f9529828ddbdf0d31d7 (patch)
tree993bb6d7e125a1d714f9045151e85b3d8518e3cb /usr.bin/mkuzip
parent30d816a7b569b260360265885c779f6d8e923947 (diff)
downloadsrc-d83e07789d1ee151ae564f9529828ddbdf0d31d7.tar.gz
src-d83e07789d1ee151ae564f9529828ddbdf0d31d7.zip
Add -S option to print out summary after compression has been
completed. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=296626
Diffstat (limited to 'usr.bin/mkuzip')
-rw-r--r--usr.bin/mkuzip/mkuzip.83
-rw-r--r--usr.bin/mkuzip/mkuzip.c12
2 files changed, 12 insertions, 3 deletions
diff --git a/usr.bin/mkuzip/mkuzip.8 b/usr.bin/mkuzip/mkuzip.8
index c8395512d34e..cb05098be368 100644
--- a/usr.bin/mkuzip/mkuzip.8
+++ b/usr.bin/mkuzip/mkuzip.8
@@ -118,6 +118,9 @@ detects identical blocks in the input and replaces each subsequent occurence
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.
diff --git a/usr.bin/mkuzip/mkuzip.c b/usr.bin/mkuzip/mkuzip.c
index 1e3a204ebcd1..49861971a52b 100644
--- a/usr.bin/mkuzip/mkuzip.c
+++ b/usr.bin/mkuzip/mkuzip.c
@@ -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);
}