Use exit status 2 to indicate that the file was not compressed because

its size would not be reduced (SUSv3).
This commit is contained in:
Tim J. Robbins 2002-05-17 00:58:07 +00:00
parent 5bc74cd68f
commit 6c1b63bb06
2 changed files with 8 additions and 0 deletions

View File

@ -150,6 +150,13 @@ coding (as used in the historical command compact), and takes less
time to compute.
.Sh DIAGNOSTICS
.Ex -std compress uncompress
.Pp
The
.Nm compress
utility exits 2 if attempting to compress the file would not reduce its size
and the
.Fl f
option was not specified.
.Sh SEE ALSO
.Xr gunzip 1 ,
.Xr gzexe 1 ,

View File

@ -249,6 +249,7 @@ compress(in, out, bits)
if (!force && sb.st_size >= isb.st_size) {
if (verbose)
(void)printf("%s: file would grow; left unmodified\n", in);
eval = 2;
if (unlink(out))
cwarn("%s", out);
goto err;