aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2009-05-22 12:27:43 +0300
committerLasse Collin <lasse.collin@tukaani.org>2009-05-22 12:27:43 +0300
commit8836139b63ce774bdd62abf17ab69b290e08229e (patch)
tree3fc2e3a5e36c407a7390e9cbfafd2af4df1c928e
parentMake the default memory usage limit 40 % of RAM for both (diff)
downloadxz-8836139b63ce774bdd62abf17ab69b290e08229e.tar.xz
If xz is run as lzma, unlzma, or lzcat, simply imply
--format=lzma. This means that xz emulating lzma doesn't decompress .xz files, while before this commit it did. The new way is slightly simpler in code and especially in upcoming documentation.
-rw-r--r--src/xz/args.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/xz/args.c b/src/xz/args.c
index f38397cf..98a9711f 100644
--- a/src/xz/args.c
+++ b/src/xz/args.c
@@ -432,10 +432,6 @@ args_parse(args_info *args, int argc, char **argv)
args->files_file = NULL;
args->files_delim = '\0';
- // Type of the file format to use when --format=auto or no --format
- // was specified.
- enum format_type format_compress_auto = FORMAT_XZ;
-
// Check how we were called.
{
#ifdef DOSLIKE
@@ -454,10 +450,10 @@ args_parse(args_info *args, int argc, char **argv)
// NOTE: It's possible that name[0] is now '\0' if argv[0]
// is weird, but it doesn't matter here.
- // The default file format is .lzma if the command name
- // contains "lz".
+ // If the command name contains "lz",
+ // it implies --format=lzma.
if (strstr(name, "lz") != NULL)
- format_compress_auto = FORMAT_LZMA;
+ opt_format = FORMAT_LZMA;
// Operation mode
if (strstr(name, "cat") != NULL) {
@@ -485,11 +481,10 @@ args_parse(args_info *args, int argc, char **argv)
opt_stdout = true;
}
- // If no --format flag was used, or it was --format=auto, we need to
- // decide what is the target file format we are going to use. This
- // depends on how we were called (checked earlier in this function).
+ // When compressing, if no --format flag was used, or it
+ // was --format=auto, we compress to the .xz format.
if (opt_mode == MODE_COMPRESS && opt_format == FORMAT_AUTO)
- opt_format = format_compress_auto;
+ opt_format = FORMAT_XZ;
// Compression settings need to be validated (options themselves and
// their memory usage) when compressing to any file format. It has to