When -S is specified dump summary to stdout, not stderr, so it's
easier to capture and process it with external tools via pipe.
This commit is contained in:
parent
641cb8b823
commit
0e0b4ac1f0
@ -90,7 +90,10 @@ int main(int argc, char **argv)
|
|||||||
char *iname, *oname, *obuf, *ibuf;
|
char *iname, *oname, *obuf, *ibuf;
|
||||||
uint64_t *toc;
|
uint64_t *toc;
|
||||||
int fdr, fdw, i, opt, verbose, no_zcomp, tmp, en_dedup;
|
int fdr, fdw, i, opt, verbose, no_zcomp, tmp, en_dedup;
|
||||||
int summary;
|
struct {
|
||||||
|
int en;
|
||||||
|
FILE *f;
|
||||||
|
} summary;
|
||||||
struct iovec iov[2];
|
struct iovec iov[2];
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
uint32_t destlen;
|
uint32_t destlen;
|
||||||
@ -105,7 +108,8 @@ int main(int argc, char **argv)
|
|||||||
verbose = 0;
|
verbose = 0;
|
||||||
no_zcomp = 0;
|
no_zcomp = 0;
|
||||||
en_dedup = 0;
|
en_dedup = 0;
|
||||||
summary = 0;
|
summary.en = 0;
|
||||||
|
summary.f = stderr;
|
||||||
handler = &uzip_fmt;
|
handler = &uzip_fmt;
|
||||||
|
|
||||||
while((opt = getopt(argc, argv, "o:s:vZdLS")) != -1) {
|
while((opt = getopt(argc, argv, "o:s:vZdLS")) != -1) {
|
||||||
@ -141,7 +145,8 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'S':
|
case 'S':
|
||||||
summary = 1;
|
summary.en = 1;
|
||||||
|
summary.f = stdout;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -300,8 +305,8 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
close(fdr);
|
close(fdr);
|
||||||
|
|
||||||
if (verbose != 0 || summary != 0)
|
if (verbose != 0 || summary.en != 0)
|
||||||
fprintf(stderr, "compressed data to %ju bytes, saved %lld "
|
fprintf(summary.f, "compressed data to %ju bytes, saved %lld "
|
||||||
"bytes, %.2f%% decrease.\n", offset,
|
"bytes, %.2f%% decrease.\n", offset,
|
||||||
(long long)(sb.st_size - offset),
|
(long long)(sb.st_size - offset),
|
||||||
100.0 * (long long)(sb.st_size - offset) /
|
100.0 * (long long)(sb.st_size - offset) /
|
||||||
|
Loading…
Reference in New Issue
Block a user