diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2008-09-04 11:53:06 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2008-09-04 11:53:06 +0300 |
commit | da98df54400998be2a6c3876f9655a3c51b93c10 (patch) | |
tree | 3d3d2cd1f8e083dcf9680e3e775c31b17c13197c /src/lzma/args.c | |
parent | Don't allow LZMA_SYNC_FLUSH with decoders anymore. There's (diff) | |
download | xz-da98df54400998be2a6c3876f9655a3c51b93c10.tar.xz |
Added support for raw encoding and decoding to the command
line tool, and made various cleanups. --lzma was renamed to
--lzma1 to prevent people from accidentally using LZMA when
they want LZMA2.
Diffstat (limited to '')
-rw-r--r-- | src/lzma/args.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/lzma/args.c b/src/lzma/args.c index 30df4522..70c3978e 100644 --- a/src/lzma/args.c +++ b/src/lzma/args.c @@ -60,7 +60,7 @@ enum { OPT_ARMTHUMB, OPT_SPARC, OPT_DELTA, - OPT_LZMA, + OPT_LZMA1, OPT_LZMA2, OPT_FILES, @@ -108,7 +108,7 @@ static const struct option long_opts[] = { { "armthumb", no_argument, NULL, OPT_ARMTHUMB }, { "sparc", no_argument, NULL, OPT_SPARC }, { "delta", optional_argument, NULL, OPT_DELTA }, - { "lzma", optional_argument, NULL, OPT_LZMA }, + { "lzma1", optional_argument, NULL, OPT_LZMA1 }, { "lzma2", optional_argument, NULL, OPT_LZMA2 }, // Other @@ -300,7 +300,7 @@ parse_real(int argc, char **argv) add_filter(LZMA_FILTER_DELTA, optarg); break; - case OPT_LZMA: + case OPT_LZMA1: add_filter(LZMA_FILTER_LZMA, optarg); break; @@ -316,7 +316,8 @@ parse_real(int argc, char **argv) "auto", "native", "alone", -// "gzip", + // "gzip", + "raw", NULL }; @@ -471,10 +472,10 @@ set_compression_settings(void) my_exit(ERROR); } - uint64_t memory_usage = lzma_memusage_encoder(opt_filters); - /* opt_mode == MODE_COMPRESS + // If using --format=raw, we can be decoding. + uint64_t memory_usage = opt_mode == MODE_COMPRESS ? lzma_memusage_encoder(opt_filters) - : lzma_memusage_decoder(opt_filters); */ + : lzma_memusage_decoder(opt_filters); // Don't go over the memory limits when the default // setting is used. @@ -546,7 +547,7 @@ parse_args(int argc, char **argv) opt_stdout = true; } - if (opt_mode == MODE_COMPRESS) + if (opt_mode == MODE_COMPRESS || opt_header == HEADER_RAW) set_compression_settings(); // If no filenames are given, use stdin. |