diff options
author | kris <kris@FreeBSD.org> | 2001-05-05 01:10:13 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2001-05-05 01:10:13 +0000 |
commit | b48e2b1dc26b8ed5eefa8412ae1efc92d53c6247 (patch) | |
tree | 863108cbe97f2ce506e4671f0a90e21db4946c19 /bin/pax/options.c | |
parent | 4ac9ed2901e82789c73fcf17f3c486b55fbef8c2 (diff) | |
download | FreeBSD-src-b48e2b1dc26b8ed5eefa8412ae1efc92d53c6247.zip FreeBSD-src-b48e2b1dc26b8ed5eefa8412ae1efc92d53c6247.tar.gz |
Add -z flag to pax to allow gzipping of archive output. Add -z and -Z (gzip
and compress) to pax when used in tar mode (invoked as 'tar') for
compatibility with GNU tar.
bzip2 functionality for further GNU tar compatibility will be added at a
later date.
Note in the manpage that -z is non-standard.
Obtained from: OpenBSD
Reviewed by: -hackers
MFC after: 2 weeks
Diffstat (limited to 'bin/pax/options.c')
-rw-r--r-- | bin/pax/options.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/bin/pax/options.c b/bin/pax/options.c index 5b253f9..cbdcb11 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -78,6 +78,9 @@ static void cpio_options __P((register int, register char **)); static void cpio_usage __P((void)); #endif +#define GZIP_CMD "gzip" /* command to run as gzip */ +#define COMPRESS_CMD "compress" /* command to run as compress */ + /* * Format specific routine table - MUST BE IN SORTED ORDER BY NAME * (see pax.h for description of each function) @@ -192,7 +195,7 @@ pax_options(argc, argv) /* * process option flags */ - while ((c=getopt(argc,argv,"ab:cdf:iklno:p:rs:tuvwx:B:DE:G:HLPT:U:XYZ")) + while ((c=getopt(argc,argv,"ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLPT:U:XYZ")) != -1) { switch (c) { case 'a': @@ -376,6 +379,12 @@ pax_options(argc, argv) (void)fputs("\n\n", stderr); pax_usage(); break; + case 'z': + /* + * use gzip. Non standard option. + */ + gzip_program = GZIP_CMD; + break; case 'B': /* * non-standard option on number of bytes written on a @@ -694,6 +703,12 @@ tar_options(argc, argv) */ act = EXTRACT; break; + case 'z': + /* + * use gzip. Non standard option. + */ + gzip_program = GZIP_CMD; + break; case 'B': /* * Nothing to do here, this is pax default @@ -723,6 +738,12 @@ tar_options(argc, argv) */ Xflag = 1; break; + case 'Z': + /* + * use compress. + */ + gzip_program = COMPRESS_CMD; + break; case '0': arcname = DEV_0; break; @@ -1075,18 +1096,18 @@ void pax_usage() #endif { - (void)fputs("usage: pax [-cdnv] [-E limit] [-f archive] ", stderr); + (void)fputs("usage: pax [-cdnvz] [-E limit] [-f archive] ", stderr); (void)fputs("[-s replstr] ... [-U user] ...", stderr); (void)fputs("\n [-G group] ... ", stderr); (void)fputs("[-T [from_date][,to_date]] ... ", stderr); (void)fputs("[pattern ...]\n", stderr); - (void)fputs(" pax -r [-cdiknuvDYZ] [-E limit] ", stderr); + (void)fputs(" pax -r [-cdiknuvzDYZ] [-E limit] ", stderr); (void)fputs("[-f archive] [-o options] ... \n", stderr); (void)fputs(" [-p string] ... [-s replstr] ... ", stderr); (void)fputs("[-U user] ... [-G group] ...\n ", stderr); (void)fputs("[-T [from_date][,to_date]] ... ", stderr); (void)fputs(" [pattern ...]\n", stderr); - (void)fputs(" pax -w [-dituvHLPX] [-b blocksize] ", stderr); + (void)fputs(" pax -w [-dituvzHLPX] [-b blocksize] ", stderr); (void)fputs("[ [-a] [-f archive] ] [-x format] \n", stderr); (void)fputs(" [-B bytes] [-s replstr] ... ", stderr); (void)fputs("[-o options] ... [-U user] ...", stderr); @@ -1114,7 +1135,7 @@ void tar_usage() #endif { - (void)fputs("usage: tar -{txru}[cevfbmopwBHLPX014578] [tapefile] ", + (void)fputs("usage: tar -{txru}[cevfbmopwzBHLPXZ014578] [tapefile] ", stderr); (void)fputs("[blocksize] file1 file2...\n", stderr); exit(1); |