summaryrefslogtreecommitdiffstats
path: root/usr.bin/tar/write.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2007-05-29 05:39:10 +0000
committerkientzle <kientzle@FreeBSD.org>2007-05-29 05:39:10 +0000
commit57eb78da4c46c88fa232f249fb32318f1c9f78f6 (patch)
tree65824c6a122704c18c5f4261710047c9567d981a /usr.bin/tar/write.c
parent052215bb5907c5ca24320dcce2a2aadf3a17cb6c (diff)
downloadFreeBSD-src-57eb78da4c46c88fa232f249fb32318f1c9f78f6.zip
FreeBSD-src-57eb78da4c46c88fa232f249fb32318f1c9f78f6.tar.gz
bsdtar 2.2.3:
* Implement --use-compress-program using new libarchive feature. * Minor portability improvement by adjusting casts used to print out uids, gids, and device numbers. Thanks to: Joerg Sonnenberger for the --use-compress-program implementation. MFC after: 15 days
Diffstat (limited to 'usr.bin/tar/write.c')
-rw-r--r--usr.bin/tar/write.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c
index 76d6fcf..0efddd0 100644
--- a/usr.bin/tar/write.c
+++ b/usr.bin/tar/write.c
@@ -203,23 +203,28 @@ tar_mode_c(struct bsdtar *bsdtar)
} else
archive_write_set_bytes_per_block(a, DEFAULT_BYTES_PER_BLOCK);
- switch (bsdtar->create_compression) {
- case 0:
- break;
+ if (bsdtar->compress_program) {
+ archive_write_set_compression_program(a, bsdtar->compress_program);
+ } else {
+ switch (bsdtar->create_compression) {
+ case 0:
+ archive_write_set_compression_none(a);
+ break;
#ifdef HAVE_LIBBZ2
- case 'j': case 'y':
- archive_write_set_compression_bzip2(a);
- break;
+ case 'j': case 'y':
+ archive_write_set_compression_bzip2(a);
+ break;
#endif
#ifdef HAVE_LIBZ
- case 'z':
- archive_write_set_compression_gzip(a);
- break;
+ case 'z':
+ archive_write_set_compression_gzip(a);
+ break;
#endif
- default:
- bsdtar_errc(bsdtar, 1, 0,
- "Unrecognized compression option -%c",
- bsdtar->create_compression);
+ default:
+ bsdtar_errc(bsdtar, 1, 0,
+ "Unrecognized compression option -%c",
+ bsdtar->create_compression);
+ }
}
r = archive_write_open_file(a, bsdtar->filename);
OpenPOWER on IntegriCloud