mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
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.
This commit is contained in:
parent
b0063023f8
commit
8836139b63
1 changed files with 6 additions and 11 deletions
|
@ -432,10 +432,6 @@ args_parse(args_info *args, int argc, char **argv)
|
||||||
args->files_file = NULL;
|
args->files_file = NULL;
|
||||||
args->files_delim = '\0';
|
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.
|
// Check how we were called.
|
||||||
{
|
{
|
||||||
#ifdef DOSLIKE
|
#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]
|
// NOTE: It's possible that name[0] is now '\0' if argv[0]
|
||||||
// is weird, but it doesn't matter here.
|
// is weird, but it doesn't matter here.
|
||||||
|
|
||||||
// The default file format is .lzma if the command name
|
// If the command name contains "lz",
|
||||||
// contains "lz".
|
// it implies --format=lzma.
|
||||||
if (strstr(name, "lz") != NULL)
|
if (strstr(name, "lz") != NULL)
|
||||||
format_compress_auto = FORMAT_LZMA;
|
opt_format = FORMAT_LZMA;
|
||||||
|
|
||||||
// Operation mode
|
// Operation mode
|
||||||
if (strstr(name, "cat") != NULL) {
|
if (strstr(name, "cat") != NULL) {
|
||||||
|
@ -485,11 +481,10 @@ args_parse(args_info *args, int argc, char **argv)
|
||||||
opt_stdout = true;
|
opt_stdout = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no --format flag was used, or it was --format=auto, we need to
|
// When compressing, if no --format flag was used, or it
|
||||||
// decide what is the target file format we are going to use. This
|
// was --format=auto, we compress to the .xz format.
|
||||||
// depends on how we were called (checked earlier in this function).
|
|
||||||
if (opt_mode == MODE_COMPRESS && opt_format == FORMAT_AUTO)
|
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
|
// Compression settings need to be validated (options themselves and
|
||||||
// their memory usage) when compressing to any file format. It has to
|
// their memory usage) when compressing to any file format. It has to
|
||||||
|
|
Loading…
Reference in a new issue