diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2011-03-18 18:19:19 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2011-03-18 18:19:19 +0200 |
commit | 57597d42ca1740ad506437be168d800a50f1a0ad (patch) | |
tree | 9a545dc10dd74be9923cfdbcf425b2628f8cbd3d /src/xz/coder.c | |
parent | xz: Clean up suffix.c. (diff) | |
download | xz-57597d42ca1740ad506437be168d800a50f1a0ad.tar.xz |
xz: Add --single-stream.
This can be useful when there is garbage after the
compressed stream (.xz, .lzma, or raw stream).
Man page wasn't updated yet.
Diffstat (limited to '')
-rw-r--r-- | src/xz/coder.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/xz/coder.c b/src/xz/coder.c index 5182dddc..266482eb 100644 --- a/src/xz/coder.c +++ b/src/xz/coder.c @@ -24,6 +24,7 @@ enum coder_init_ret { enum operation_mode opt_mode = MODE_COMPRESS; enum format_type opt_format = FORMAT_AUTO; bool opt_auto_adjust = true; +bool opt_single_stream = false; /// Stream used to communicate with liblzma @@ -366,8 +367,9 @@ coder_init(file_pair *pair) break; } } else { - const uint32_t flags = LZMA_TELL_UNSUPPORTED_CHECK - | LZMA_CONCATENATED; + uint32_t flags = LZMA_TELL_UNSUPPORTED_CHECK; + if (!opt_single_stream) + flags |= LZMA_CONCATENATED; // We abuse FORMAT_AUTO to indicate unknown file format, // for which we may consider passthru mode. @@ -518,6 +520,11 @@ coder_normal(file_pair *pair) } if (ret == LZMA_STREAM_END) { + if (opt_single_stream) { + success = true; + break; + } + // Check that there is no trailing garbage. // This is needed for LZMA_Alone and raw // streams. |