aboutsummaryrefslogtreecommitdiff
path: root/src/xz/args.c
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2023-01-06 00:02:29 +0800
committerJia Tan <jiat0218@gmail.com>2023-07-17 23:34:55 +0800
commit9ded880a0221f4d1256845fc4ab957ffd377c760 (patch)
tree29c2b360d4cd4156ef73d40dcbab00dc5a76a32b /src/xz/args.c
parentTests: Improve feature testing for skipping. (diff)
downloadxz-9ded880a0221f4d1256845fc4ab957ffd377c760.tar.xz
xz: Add --filters option to CLI.
The --filters option uses the new lzma_str_to_filters() function to convert a string into a full filter chain. Using this option will reset all previous filters set by --preset, --[filter], or --filters.
Diffstat (limited to 'src/xz/args.c')
-rw-r--r--src/xz/args.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/xz/args.c b/src/xz/args.c
index b831946f..e21aee93 100644
--- a/src/xz/args.c
+++ b/src/xz/args.c
@@ -136,7 +136,8 @@ static void
parse_real(args_info *args, int argc, char **argv)
{
enum {
- OPT_X86 = INT_MIN,
+ OPT_FILTERS = INT_MIN,
+ OPT_X86,
OPT_POWERPC,
OPT_IA64,
OPT_ARM,
@@ -206,6 +207,7 @@ parse_real(args_info *args, int argc, char **argv)
{ "best", no_argument, NULL, '9' },
// Filters
+ { "filters", optional_argument, NULL, OPT_FILTERS},
{ "lzma1", optional_argument, NULL, OPT_LZMA1 },
{ "lzma2", optional_argument, NULL, OPT_LZMA2 },
{ "x86", optional_argument, NULL, OPT_X86 },
@@ -372,7 +374,10 @@ parse_real(args_info *args, int argc, char **argv)
opt_mode = MODE_COMPRESS;
break;
- // Filter setup
+ // --filters
+ case OPT_FILTERS:
+ coder_add_filters_from_str(optarg);
+ break;
case OPT_X86:
coder_add_filter(LZMA_FILTER_X86,