summaryrefslogtreecommitdiff
path: root/tar
diff options
context:
space:
mode:
authorSean Purcell <me@seanp.xyz>2017-04-19 16:51:50 -0700
committerSean Purcell <iburinoc@gmail.com>2017-05-15 23:06:48 -0400
commitf59fec02545917911a632ccff2d2305f0d65b401 (patch)
tree06e4a5df99c63dd696ee19af241d3c881b923f43 /tar
parent26838cf5c17642f57192753cc5c3880b16b65ba3 (diff)
downloadlibarchive-f59fec02545917911a632ccff2d2305f0d65b401.tar.gz
Add Zstandard write support
Diffstat (limited to 'tar')
-rw-r--r--tar/bsdtar.16
-rw-r--r--tar/bsdtar.c8
-rw-r--r--tar/bsdtar.h1
-rw-r--r--tar/cmdline.c1
-rw-r--r--tar/creation_set.c3
5 files changed, 15 insertions, 4 deletions
diff --git a/tar/bsdtar.1 b/tar/bsdtar.1
index cdc317b6..89b50779 100644
--- a/tar/bsdtar.1
+++ b/tar/bsdtar.1
@@ -342,6 +342,10 @@ In extract or list modes, this option is ignored.
Compress the archive with lz4-compatible compression before writing it.
In input mode, this option is ignored; lz4 compression is recognized
automatically on input.
+.It Fl Fl zstd
+Compress the archive with zstd-compatible compression before writing it.
+In input mode, this option is ignored; lz4 compression is recognized
+automatically on input.
.It Fl Fl lzma
(c mode only) Compress the resulting archive with the original LZMA algorithm.
Use of this option is discouraged and new archives should be created with
@@ -577,6 +581,8 @@ A decimal integer from 4 to 7 specifying the lz4 compression block size
.It Cm lz4:block-dependence
Use the previous block of the block being compressed for
a compression dictionary to improve compression ratio.
+.It Cm zstd:compression-level
+A decimal integer from 1 to 22 specifying the zstd compression level.
.It Cm lzop:compression-level
A decimal integer from 1 to 9 specifying the lzop compression level.
.It Cm xz:compression-level
diff --git a/tar/bsdtar.c b/tar/bsdtar.c
index 9fc68332..1b9851f9 100644
--- a/tar/bsdtar.c
+++ b/tar/bsdtar.c
@@ -416,6 +416,7 @@ main(int argc, char **argv)
break;
case OPTION_LRZIP:
case OPTION_LZ4:
+ case OPTION_ZSTD:
case OPTION_LZIP: /* GNU tar beginning with 1.23 */
case OPTION_LZMA: /* GNU tar beginning with 1.20 */
case OPTION_LZOP: /* GNU tar beginning with 1.21 */
@@ -427,9 +428,10 @@ main(int argc, char **argv)
switch (opt) {
case OPTION_LRZIP: compression_name = "lrzip"; break;
case OPTION_LZ4: compression_name = "lz4"; break;
- case OPTION_LZIP: compression_name = "lzip"; break;
- case OPTION_LZMA: compression_name = "lzma"; break;
- case OPTION_LZOP: compression_name = "lzop"; break;
+ case OPTION_ZSTD: compression_name = "zstd"; break;
+ case OPTION_LZIP: compression_name = "lzip"; break;
+ case OPTION_LZMA: compression_name = "lzma"; break;
+ case OPTION_LZOP: compression_name = "lzop"; break;
}
break;
case 'm': /* SUSv2 */
diff --git a/tar/bsdtar.h b/tar/bsdtar.h
index 10a2cf2f..304fb568 100644
--- a/tar/bsdtar.h
+++ b/tar/bsdtar.h
@@ -147,6 +147,7 @@ enum {
OPTION_KEEP_NEWER_FILES,
OPTION_LRZIP,
OPTION_LZ4,
+ OPTION_ZSTD,
OPTION_LZIP,
OPTION_LZMA,
OPTION_LZOP,
diff --git a/tar/cmdline.c b/tar/cmdline.c
index e36c545b..23388db0 100644
--- a/tar/cmdline.c
+++ b/tar/cmdline.c
@@ -107,6 +107,7 @@ static const struct bsdtar_option {
{ "list", 0, 't' },
{ "lrzip", 0, OPTION_LRZIP },
{ "lz4", 0, OPTION_LZ4 },
+ { "zstd", 0, OPTION_ZSTD },
{ "lzip", 0, OPTION_LZIP },
{ "lzma", 0, OPTION_LZMA },
{ "lzop", 0, OPTION_LZOP },
diff --git a/tar/creation_set.c b/tar/creation_set.c
index 24cf3fcd..e246c0a5 100644
--- a/tar/creation_set.c
+++ b/tar/creation_set.c
@@ -76,13 +76,14 @@ get_filter_code(const char *suffix)
{ ".lrz", "lrzip" },
{ ".lz", "lzip" },
{ ".lz4", "lz4" },
+ { ".zstd", "zstd"},
{ ".lzo", "lzop" },
{ ".lzma", "lzma" },
{ ".uu", "uuencode" },
{ ".xz", "xz" },
{ NULL, NULL }
};
-
+
return get_suffix_code(filters, suffix);
}