Add -S option to print out summary after compression has been
completed. MFC after: 2 weeks
This commit is contained in:
parent
30d816a7b5
commit
d83e07789d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296626
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user