From owner-svn-src-all@freebsd.org Thu Mar 10 21:36:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA504ACBA7B; Thu, 10 Mar 2016 21:36:25 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A21F7110; Thu, 10 Mar 2016 21:36:25 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2ALaOBh015898; Thu, 10 Mar 2016 21:36:24 GMT (envelope-from sobomax@FreeBSD.org) Received: (from sobomax@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2ALaORK015895; Thu, 10 Mar 2016 21:36:24 GMT (envelope-from sobomax@FreeBSD.org) Message-Id: <201603102136.u2ALaORK015895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sobomax set sender to sobomax@FreeBSD.org using -f From: Maxim Sobolev Date: Thu, 10 Mar 2016 21:36:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296626 - head/usr.bin/mkuzip X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Mar 2016 21:36:26 -0000 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); }