Add a `-y' option which filters archives through bzip2(1).

This commit is contained in:
ad 2000-07-05 11:57:57 +00:00
parent fce98185a9
commit 97053d8364
2 changed files with 23 additions and 4 deletions

View File

@ -3,7 +3,7 @@
.\"
.\" Written by John F. Woods <jfw@jfwhome.funhouse.com>
.\"
.\" $NetBSD: tar.1,v 1.17 2000/01/17 12:44:39 wiz Exp $
.\" $NetBSD: tar.1,v 1.18 2000/07/05 11:57:57 ad Exp $
.\"
.Dd 6 August 1994
.Os
@ -280,6 +280,11 @@ Exclude files matching the
.It Fl -exclude-from Ar file
Exclude files listed in
.Ar file .
.It Fl y
.It Fl -bzip2
.It Fl -unbzip2
Filter the archive through
.Xr bzip2 1 .
.It Fl Z
.It Fl -compress
.It Fl -uncompress
@ -398,6 +403,7 @@ The default tape drive.
.\" (command return values (to shell) and fprintf/stderr type diagnostics)
.\" .Sh DIAGNOSTICS
.Sh SEE ALSO
.Xr bzip2 1 ,
.Xr compress 1 ,
.Xr gzip 1 ,
.Xr pax 1 ,

View File

@ -18,7 +18,7 @@ along with GNU Tar; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef lint
static char rcsid[] = "$NetBSD: tar.c,v 1.12 2000/06/26 08:25:34 kleink Exp $";
static char rcsid[] = "$NetBSD: tar.c,v 1.13 2000/07/05 11:57:57 ad Exp $";
#endif /* not lint */
/*
@ -170,6 +170,8 @@ struct option long_options[] =
{"compress", 0, 0, 'Z'},
{"uncompress", 0, 0, 'Z'},
{"block-compress", 0, &f_compress_block, 1},
{"bzip2", 0, 0, 'y'},
{"unbzip2", 0, 0, 'y'},
{"gzip", 0, 0, 'z'},
{"ungzip", 0, 0, 'z'},
{"use-compress-program", 1, 0, 18},
@ -314,7 +316,7 @@ options (argc, argv)
/* Parse options */
while ((c = getoldopt (argc, argv,
"-01234567Ab:BcC:df:F:g:GhikK:lL:mMN:oOpPrRsStT:uvV:wWxX:zZ",
"-01234567Ab:BcC:df:F:g:GhikK:lL:mMN:oOpPrRsStT:uvV:wWxX:yzZ",
long_options, &ind)) != EOF)
{
switch (c)
@ -629,6 +631,15 @@ options (argc, argv)
add_exclude_file (optarg);
break;
case 'y':
if (f_compressprog)
{
msg ("Only one compression option permitted\n");
exit (EX_ARGSBAD);
}
f_compressprog = "bzip2";
break;
case 'z':
if (f_compressprog)
{
@ -671,7 +682,7 @@ options (argc, argv)
if (f_compress_block && !f_compressprog)
{
msg ("You must use a compression option (--gzip, --compress\n\
or --use-compress-program) with --block-compress.\n");
--bzip2 or --use-compress-program) with --block-compress.\n");
exit (EX_ARGSBAD);
}
}
@ -761,6 +772,8 @@ Other options:\n\
-W, --verify attempt to verify the archive after writing it\n\
--exclude FILE exclude file FILE\n\
-X, --exclude-from FILE exclude files listed in FILE\n\
-y, --bzip2,\n\
--unbzip2 filter the archive through bzip2\n\
-Z, --compress,\n\
--uncompress filter the archive through compress\n\
-z, --gzip,\n\