aboutsummaryrefslogtreecommitdiff
path: root/src/xz/args.c (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2024-02-14Add SPDX license identifier into 0BSD source code files.Lasse Collin1-0/+2
2024-02-14Change most public domain parts to 0BSD.Lasse Collin1-3/+0
Translations and doc/xz-file-format.txt and doc/lzma-file-format.txt were not touched. COPYING.0BSD was added.
2024-01-23liblzma: Add RISC-V BCJ filter.Jia Tan1-0/+7
The new Filter ID is 0x0B. Thanks to Chien Wong <m@xv97.com> for the initial version of the Filter, the xz CLI updates, and the Autotools build system modifications. Thanks to Igor Pavlov for his many contributions to the design of the filter.
2023-11-18xz: Move the check for --suffix with --format=raw a few lines earlier.Lasse Collin1-22/+22
Now it reads from argv[] instead of args->arg_names.
2023-11-17xz: Fix a bug with --files and --files0 in raw mode without a suffix.Jia Tan1-0/+5
The following command caused a segmentation fault: xz -Fraw --lzma1 --files=foo when foo was a valid file. The usage of --files or --files0 was not being checked when compressing or decompressing in raw mode without a suffix. The suffix checking code was meant to validate that all files to be processed are "-" (if not writing to standard out), meaning the data is only coming from standard in. In this case, there were no file names to check since --files and --files0 store their file name in a different place. Later code assumed the suffix was set and caused a segmentation fault. Now, the above command results in an error.
2023-11-15xz: Refactor suffix test with raw format.Jia Tan1-25/+13
The previous version set opt_stdout, but this caused an issue with copying an input file to standard out when decompressing an unknown file type. The following needs to result in an error: echo foo | xz -df since -c, --stdout is not used. This fixes the previous error by not setting opt_stdout.
2023-11-14xz: Move suffix check after stdout mode is detected.Jia Tan1-8/+8
This fixes a bug introduced in cc5aa9ab138beeecaee5a1e81197591893ee9ca0 when the suffix check was initially moved. This caused a situation that previously worked: echo foo | xz -Fraw --lzma1 | wc -c to fail because the old code knew that this would write to standard out so a suffix was not needed.
2023-11-14xz: Detect when all data will be written to standard out earlier.Jia Tan1-0/+21
If the -c, --stdout argument is not used, then we can still detect when the data will be written to standard out if all of the provided filenames are "-" (denoting standard in) or if no filenames are provided.
2023-09-24xz: Change quoting style from `...' to '...'.Jia Tan1-3/+3
2023-07-18xz: Make "%s: %s" translatable because French needs "%s : %s".Lasse Collin1-1/+4
2023-07-18xz: Update Authors list in a few files.Jia Tan1-1/+2
2023-07-17xz: Add a new --filters-help option.Jia Tan1-0/+8
The --filters-help can be used to help create filter chains with the --filters and --filtersX options. The message in --long-help is too short to fully explain the syntax to construct complex filter chains. In --robot mode, xz will only print the output from liblzma function lzma_str_list_filters.
2023-07-17xz: Add a message if --block-list is used outside of xz compresssion.Jia Tan1-0/+11
--block-list is only supported with compression in xz format. This avoids silently ignoring when --block-list is unused.
2023-07-17xz: Create command line options for filters[1-9].Jia Tan1-7/+75
The new command line options are meant to be combined with --block-list. They work as an optional extension to --block-list to specify a custom filter chain for each block listed. The new options allow the creation of up to 9 reusable filter chains. For instance: xz --block-list=1:10MiB,3:5MiB,,2:5MiB,1:0 --filters1=delta--lzma2 \ --filters2=x86--lzma2 --filters3=arm64--lzma2 Will create the following blocks: 1. A block of size 10 MiB with filter chain delta, lzma2. 2. A block of size 5 MiB with filter chain arm64, lzma2. 3. A block of size 5 MiB with filter chain arm64, lzma2. 4. A block of size 5 MiB with filter chain x86, lzma2. 5. A block containing the rest of the file contents with filter chain delta, lzma2.
2023-07-17xz: Add --filters option to CLI.Jia Tan1-2/+7
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.
2023-01-24xz: Flip the return value of suffix_is_set to match the documentation.Lasse Collin1-3/+3
Also edit style to match the existing coding style in the project.
2023-01-21xz: Refactor duplicated check for custom suffix when using --format=rawJia Tan1-0/+8
2023-01-16xz: Do not set compression settings with raw format in list mode.Jia Tan1-1/+2
Calling coder_set_compression_settings() in list mode with verbose mode on caused the filter chain and memory requirements to print. This was unnecessary since the command results in an error and not consistent with other formats like lzma and alone.
2022-12-11xz: Rename --experimental-arm64 to --arm64.Lasse Collin1-1/+1
2022-12-08xz: Make args_info.files_name a const pointer.Lasse Collin1-1/+1
2022-12-08xz: Don't modify argv[].Lasse Collin1-4/+19
The code that parses --memlimit options and --block-list modified the argv[] when parsing the option string from optarg. This was visible in "ps auxf" and such and could be confusing. I didn't understand it back in the day when I wrote that code. Now a copy is allocated when modifiable strings are needed.
2022-11-19xz: Add support --threads=+N so that -T+1 gives threaded mode.Lasse Collin1-3/+15
2022-11-14Replace the experimental ARM64 filter with a new experimental version.Lasse Collin1-1/+1
This is incompatible with the previous version. This has space/tab fixes in filter_*.c and bcj.h too.
2022-11-09xz: Remove the commented-out FORMAT_GZIP, gzip, .gz, and .tgz.Lasse Collin1-2/+0
2022-11-09xz: Add .lz (lzip) decompression support.Lasse Collin1-0/+9
If configured with --disable-lzip-decoder then --long-help will still list `lzip' in --format but I left it like that since due to translations it would be messy to have two help strings. Features are disabled only in special situations so wrong help in such a situation shouldn't matter much. Thanks to Michał Górny for the original patch.
2022-09-19xz: Add --experimental-arm64[=width=WIDTH].Lasse Collin1-0/+7
It will be renamed to --arm64 once it is stable. Man page or --long-help weren't updated yet.
2022-04-12xz: Add --memlimit-mt-decompress along with a default limit value.Lasse Collin1-7/+17
--memlimit-mt-decompress allows specifying the limit for multithreaded decompression. This matches memlimit_threading in liblzma. This limit can only affect the number of threads being used; it will never prevent xz from decompressing a file. The old --memlimit-decompress option is still used at the same time. If the value of --memlimit-decompress (the default value or one specified by the user) is less than the value of --memlimit-mt-decompress , then --memlimit-mt-decompress is reduced to match --memlimit-decompress. Man page wasn't updated yet.
2019-06-23xz: Fix some of the warnings from -Wsign-conversion.Lasse Collin1-2/+2
2019-05-11spellingAntoine Cœur1-1/+1
2015-11-03xz: Make xz buildable even when encoders or decoders are disabled.Lasse Collin1-0/+16
The patch is quite long but it's mostly about adding new #ifdefs to omit code when encoders or decoders have been disabled. This adds two new #defines to config.h: HAVE_ENCODERS and HAVE_DECODERS.
2014-08-05xz: Add --ignore-check.Lasse Collin1-0/+7
2013-07-04xz: Add preliminary support for --flush-timeout=TIMEOUT.Lasse Collin1-0/+7
When --flush-timeout=TIMEOUT is used, xz will use LZMA_SYNC_FLUSH if read() would block and at least TIMEOUT milliseconds has elapsed since the previous flush. This can be useful in realtime-like use cases where the data is simultanously decompressed by another process (possibly on a different computer). If new uncompressed input data is produced slowly, without this option xz could buffer the data for a long time until it would become decompressible from the output. If TIMEOUT is 0, the feature is disabled. This is the default. This commit affects the compression side. Using xz for the decompression side for the above purpose doesn't work yet so well because there is quite a bit of input and output buffering when decompressing. The --long-help or man page were not updated yet. The details of this feature may change.
2012-07-03xz: Add incomplete support for --block-list.Lasse Collin1-0/+78
It's broken with threads and when also --block-size is used.
2011-11-04xz: Fix a typo in a comment.Lasse Collin1-1/+1
Thanks to Bela Lubkin.
2011-04-11xz: Add support for threaded compression.Lasse Collin1-1/+2
2011-04-09xz: Minor internal changes to handling of --threads.Lasse Collin1-2/+2
Now it always defaults to one thread. Maybe this will change again if a threading method is added that doesn't affect memory usage.
2011-03-18xz: Add --block-size=SIZE.Lasse Collin1-0/+7
This uses LZMA_FULL_FLUSH every SIZE bytes of input. Man page wasn't updated yet.
2011-03-18xz: Add --single-stream.Lasse Collin1-0/+6
This can be useful when there is garbage after the compressed stream (.xz, .lzma, or raw stream). Man page wasn't updated yet.
2010-09-05xz: Use an array instead of pointer for stdin_filename.Lasse Collin1-1/+1
Thanks Joerg Sonnenberger.
2010-08-07Disable the memory usage limiter by default.Lasse Collin1-29/+58
For several people, the limiter causes bigger problems that it solves, so it is better to have it disabled by default. Those who want to have a limiter by default need to enable it via the environment variable XZ_DEFAULTS. Support for environment variable XZ_DEFAULTS was added. It is parsed before XZ_OPT and technically identical with it. The intended uses differ quite a bit though; see the man page. The memory usage limit can now be set separately for compression and decompression using --memlimit-compress and --memlimit-decompress. To set both at once, -M or --memlimit can be used. --memory was retained as a legacy alias for --memlimit for backwards compatibility. The semantics of --info-memory were changed in backwards incompatible way. Compatibility wasn't meaningful due to changes in the memory usage limiter functionality. The memory usage limiter info is no longer shown at the bottom of xz --long -help. The memory usage limiter support for removed completely from xzdec. xz's man page was updated to match the above changes. Various unrelated fixes were also made to the man page.
2010-08-06Add missing const to a global constant in xz.Lasse Collin1-1/+1
2010-06-15Add --no-adjust.Lasse Collin1-0/+6
2010-05-26Rename MIN() and MAX() to my_min() and my_max().Lasse Collin1-1/+2
This should avoid some minor portability issues.
2010-05-26Remove the Subblock filter code for now.Lasse Collin1-8/+1
The spec isn't finished and the code didn't compile anymore. It won't be included in XZ Utils 5.0.0. It's easy to get it back once the spec is done.
2010-01-26Add a missing space to an error message.Lasse Collin1-1/+1
Thanks to Robert Readman.
2010-01-24Set LC_NUMERIC=C when --robot is used.Lasse Collin1-0/+4
It is to ensure that floating point numbers will always have a dot as the decimal separator.
2009-11-25Create sparse files by default when decompressing intoLasse Collin1-0/+6
a regular file. Sparse file creation can be disabled with --no-sparse. I don't promise yet that the name of this option won't change before 5.0.0. It's possible that the code, that checks when it is safe to use sparse output on stdout, is not good enough, and a more flexible command line option is needed to configure sparse file handling.
2009-11-16Add support for --info-memory and --robot to xz.Lasse Collin1-35/+50
Currently --robot works only with --info-memory and --version. --help and --long-help work too, but --robot has no effect on them. Thanks to Jonathan Nieder for the original patches.
2009-09-19Various changes.Lasse Collin1-7/+1
Separate a few reusable components from XZ Utils specific code. The reusable code is now in "tuklib" modules. A few more could be separated still, e.g. bswap.h. Fix some bugs in lzmainfo. Fix physmem and cpucores code on OS/2. Thanks to Elbert Pol for help. Add OpenVMS support into physmem. Add a few #ifdefs to ease building XZ Utils on OpenVMS. Thanks to Jouk Jansen for the original patch.
2009-07-23Fix incorrect usage of getopt_long(), which causedLasse Collin1-1/+0
invalid memory access if XZ_OPT was defined.
2009-07-10Look for full command names instead of substringsLasse Collin1-9/+13
like "un", "cat", and "lz" when determining if xz is run as unxz, xzcat, lzma, unlzma, or lzcat. This is to ensure that if xz is renamed (e.g. via --program-transform-name), it doesn't so easily work in wrong mode.
2009-06-24Cast a char argument to isspace() to unsigned char.Lasse Collin1-2/+9
2009-05-23Remove undocumented alternative option names --bcj, --ppc,Lasse Collin1-3/+0
and --itanium.
2009-05-23Add support for specifying the BCJ filter start offsetLasse Collin1-15/+21
in the xz command line tool.
2009-05-22Add --no-warn.Lasse Collin1-1/+7
2009-05-22Remove the --info option, which was an alias for --list.Lasse Collin1-1/+0
2009-05-22If xz is run as lzma, unlzma, or lzcat, simply implyLasse Collin1-11/+6
--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.
2009-05-22Make the default memory usage limit 40 % of RAM for bothLasse Collin1-7/+21
compressing and decompressing. This should be OK now that xz automatically scales down the compression settings if they would exceed the memory usage limit (earlier, the limit for compression was increased to 90 % because low limit broke scripts that used "xz -9" on systems with low RAM). Support spcifying the memory usage limit as a percentage of RAM (e.g. --memory=50%). Support --threads=0 to reset the thread limit to the default value (number of available CPU cores). Use UINT32_MAX instead of SIZE_MAX as the maximum in args.c. hardware.c was already expecting uint32_t value. Cleaned up the output of --help and --long-help.
2009-04-13Put the interesting parts of XZ Utils into the public domain.Lasse Collin1-10/+3
Some minor documentation cleanups were made at the same time.
2009-02-14Cleanups to the code that detects the amount of RAM andLasse Collin1-2/+2
the number of CPU cores. Added support for using sysinfo() on Linux systems whose libc lacks appropriate sysconf() support (at least dietlibc). The Autoconf macros were split into separate files, and CPU core count detection was moved from hardware.c to cpucores.h. The core count isn't used for anything real for now, so a problematic part in process.c was commented out.
2009-02-13Fix handling of integrity check type in the xz command line tool.Lasse Collin1-1/+8
2009-02-13Improve support for DOS-like systems.Lasse Collin1-8/+5
Here DOS-like means DOS, Windows, and OS/2.
2009-02-08Support both slash and backslash as path componentLasse Collin1-0/+9
separator on Windows when parsing argv[0].
2008-12-27Some xz command line tool improvements.Lasse Collin1-13/+10
2008-11-19Renamed lzma to xz and lzmadec to xzdec. We create symlinksLasse Collin1-0/+0
lzma, unlzma, and lzcat in "make install" for backwards compatibility with LZMA Utils 4.32.x; I'm not sure if this should be the default though.
2008-11-19Oh well, big messy commit again. Some highlights:Lasse Collin1-314/+217
- Updated to the latest, probably final file format version. - Command line tool reworked to not use threads anymore. Threading will probably go into liblzma anyway. - Memory usage limit is now about 30 % for uncompression and about 90 % for compression. - Progress indicator with --verbose - Simplified --help and full --long-help - Upgraded to the last LGPLv2.1+ getopt_long from gnulib. - Some bug fixes
2008-10-07Made the preset numbering more logical in liblzma API.Lasse Collin1-4/+4
2008-10-02Initial changes to change the suffix of the new format to .xz.Lasse Collin1-20/+47
This also fixes a bug related to --suffix option. Some issues with suffixes with --format=raw were not fixed.
2008-09-27Some API changes, bug fixes, cleanups etc.Lasse Collin1-12/+21
2008-09-13Renamed constants:Lasse Collin1-1/+1
- LZMA_VLI_VALUE_MAX -> LZMA_VLI_MAX - LZMA_VLI_VALUE_UNKNOWN -> LZMA_VLI_UNKNOWN - LZMA_HEADER_ERRRO -> LZMA_OPTIONS_ERROR
2008-09-04Added support for raw encoding and decoding to the commandLasse Collin1-8/+9
line tool, and made various cleanups. --lzma was renamed to --lzma1 to prevent people from accidentally using LZMA when they want LZMA2.
2008-08-28Sort of garbage collection commit. :-| Many things are stillLasse Collin1-15/+20
broken. API has changed a lot and it will still change a little more here and there. The command line tool doesn't have all the required changes to reflect the API changes, so it's easy to get "internal error" or trigger assertions.
2008-06-18Update the code to mostly match the new simpler file formatLasse Collin1-21/+1
specification. Simplify things by removing most of the support for known uncompressed size in most places. There are some miscellaneous changes here and there too. The API of liblzma has got many changes and still some more will be done soon. While most of the code has been updated, some things are not fixed (the command line tool will choke with invalid filter chain, if nothing else). Subblock filter is somewhat broken for now. It will be updated once the encoded format of the Subblock filter has been decided.
2008-04-30Fix a crash with --format=alone if other filters than LZMALasse Collin1-0/+9
are specified on the command line.
2007-12-13Fixed a few short options that take an argument.Lasse Collin1-1/+1
short_opts[] was missing colons to indicate required argument. Thanks to Fabio Pedretti for the bug report.