diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-12-08 15:52:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-12-08 15:52:09 +0000 |
commit | 4568b11461f80bbc5fa0fb2c522205683ea14ec7 (patch) | |
tree | 58834b3aa970b99bc0a1b0fcb9ae5510ca149cb1 /doc | |
parent | Adding upstream version 1.12~pre2. (diff) | |
download | zutils-4568b11461f80bbc5fa0fb2c522205683ea14ec7.tar.xz zutils-4568b11461f80bbc5fa0fb2c522205683ea14ec7.zip |
Adding upstream version 1.12~rc1.upstream/1.12_rc1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | doc/zcat.1 | 7 | ||||
-rw-r--r-- | doc/zcmp.1 | 26 | ||||
-rw-r--r-- | doc/zdiff.1 | 7 | ||||
-rw-r--r-- | doc/zgrep.1 | 7 | ||||
-rw-r--r-- | doc/ztest.1 | 29 | ||||
-rw-r--r-- | doc/zupdate.1 | 11 | ||||
-rw-r--r-- | doc/zutils.info | 366 | ||||
-rw-r--r-- | doc/zutils.texi | 424 |
8 files changed, 545 insertions, 332 deletions
@@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.16. -.TH ZCAT "1" "April 2022" "zutils 1.12-pre2" "User Commands" +.TH ZCAT "1" "December 2022" "zutils 1.12-rc1" "User Commands" .SH NAME zcat \- decompress and concatenate files to standard output .SH SYNOPSIS @@ -54,7 +54,7 @@ number all output lines don't read runtime configuration file .TP \fB\-O\fR, \fB\-\-force\-format=\fR<fmt> -force the format given (bz2, gz, lz, xz, zst) +force the input format .TP \fB\-q\fR, \fB\-\-quiet\fR suppress all messages @@ -94,6 +94,9 @@ set compressor and options for xz format .TP \fB\-\-zst=\fR<command> set compressor and options for zstd format +.PP +Valid formats for options '\-M' and '\-O' are 'bz2', 'gz', 'lz', 'xz', 'zst', +and 'un' for uncompressed. .SH "REPORTING BUGS" Report bugs to zutils\-bug@nongnu.org .br @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.16. -.TH ZCMP "1" "April 2022" "zutils 1.12-pre2" "User Commands" +.TH ZCMP "1" "December 2022" "zutils 1.12-rc1" "User Commands" .SH NAME zcmp \- decompress and compare two files byte by byte .SH SYNOPSIS @@ -37,6 +37,9 @@ output version information and exit \fB\-b\fR, \fB\-\-print\-bytes\fR print differing bytes .TP +\fB\-H\fR, \fB\-\-hexadecimal\fR +print hexadecimal values instead of octal +.TP \fB\-i\fR, \fB\-\-ignore\-initial=\fR<n>[:<n2>] ignore differences in the first <n> bytes .TP @@ -53,16 +56,16 @@ compare at most <n> bytes don't read runtime configuration file .TP \fB\-O\fR, \fB\-\-force\-format\fR=\fI\,[\/\fR<f1>][,<f2>] -force the formats given (bz2,gz,lz,xz,zst) +force one or both input formats .TP -\fB\-q\fR, \fB\-\-quiet\fR -suppress all messages +\fB\-q\fR, \fB\-\-quiet\fR, \fB\-\-silent\fR +suppress diagnostics written to stderr .TP -\fB\-s\fR, \fB\-\-silent\fR -(same as \fB\-\-quiet\fR) +\fB\-s\fR, \fB\-\-script\fR +suppress messages about file differences .TP \fB\-v\fR, \fB\-\-verbose\fR -verbose mode (same as \fB\-\-list\fR) +verbose mode (opposite of \fB\-\-quiet\fR) .TP \fB\-\-bz2=\fR<command> set compressor and options for bzip2 format @@ -79,8 +82,13 @@ set compressor and options for xz format \fB\-\-zst=\fR<command> set compressor and options for zstd format .PP -Numbers may be followed by a multiplier: k = kB = 10^3 = 1000, -Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc... +Valid formats for options '\-M' and '\-O' are 'bz2', 'gz', 'lz', 'xz', 'zst', +and 'un' for uncompressed. +.PP +Byte counts given as arguments to options may be expressed in decimal, +hexadecimal, or octal (using the same syntax as integer constants in C++), +and may be followed by a multiplier: k = kB = 10^3 = 1000, +Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc. .SH "REPORTING BUGS" Report bugs to zutils\-bug@nongnu.org .br diff --git a/doc/zdiff.1 b/doc/zdiff.1 index 55342c6..a5ff42b 100644 --- a/doc/zdiff.1 +++ b/doc/zdiff.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.16. -.TH ZDIFF "1" "April 2022" "zutils 1.12-pre2" "User Commands" +.TH ZDIFF "1" "December 2022" "zutils 1.12-rc1" "User Commands" .SH NAME zdiff \- decompress and compare two files line by line .SH SYNOPSIS @@ -68,7 +68,7 @@ process only the formats in <list> don't read runtime configuration file .TP \fB\-O\fR, \fB\-\-force\-format\fR=\fI\,[\/\fR<f1>][,<f2>] -force the formats given (bz2,gz,lz,xz,zst) +force one or both input formats .TP \fB\-p\fR, \fB\-\-show\-c\-function\fR show which C function each change is in @@ -117,6 +117,9 @@ set compressor and options for xz format .TP \fB\-\-zst=\fR<command> set compressor and options for zstd format +.PP +Valid formats for options '\-M' and '\-O' are 'bz2', 'gz', 'lz', 'xz', 'zst', +and 'un' for uncompressed. .SH "REPORTING BUGS" Report bugs to zutils\-bug@nongnu.org .br diff --git a/doc/zgrep.1 b/doc/zgrep.1 index bbe311c..79acdf2 100644 --- a/doc/zgrep.1 +++ b/doc/zgrep.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.16. -.TH ZGREP "1" "April 2022" "zutils 1.12-pre2" "User Commands" +.TH ZGREP "1" "December 2022" "zutils 1.12-rc1" "User Commands" .SH NAME zgrep \- search compressed files for a regular expression .SH SYNOPSIS @@ -112,7 +112,7 @@ don't read runtime configuration file show only the part of a line matching <pattern> .TP \fB\-O\fR, \fB\-\-force\-format=\fR<fmt> -force the format given (bz2, gz, lz, xz, zst) +force the input format .TP \fB\-P\fR, \fB\-\-perl\-regexp\fR <pattern> is a Perl regular expression @@ -165,6 +165,9 @@ set compressor and options for xz format \fB\-\-zst=\fR<command> set compressor and options for zstd format .PP +Valid formats for options '\-M' and '\-O' are 'bz2', 'gz', 'lz', 'xz', 'zst', +and 'un' for uncompressed. +.PP Numbers may be followed by a multiplier: k = kB = 10^3 = 1000, Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc... .SH "REPORTING BUGS" diff --git a/doc/ztest.1 b/doc/ztest.1 index 2f51e51..5eb3bb4 100644 --- a/doc/ztest.1 +++ b/doc/ztest.1 @@ -1,19 +1,21 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.16. -.TH ZTEST "1" "April 2022" "zutils 1.12-pre2" "User Commands" +.TH ZTEST "1" "December 2022" "zutils 1.12-rc1" "User Commands" .SH NAME ztest \- verify the integrity of compressed files .SH SYNOPSIS .B ztest [\fI\,options\/\fR] [\fI\,files\/\fR] .SH DESCRIPTION -ztest verifies the integrity of the compressed files specified. -Uncompressed files are ignored. If a file is specified as '\-', the -integrity of compressed data read from standard input is verified. Data -read from standard input must be all in the same compressed format. If -a file fails to decompress, does not exist, can't be opened, or is a -terminal, ztest continues verifying the rest of the files. A final -diagnostic is shown at verbosity level 1 or higher if any file fails the -test when testing multiple files. +ztest verifies the integrity of the compressed files specified. It +also warns if an uncompressed file has a compressed file name extension, or +if a compressed file has a wrong compressed extension. Uncompressed files +are otherwise ignored. If a file is specified as '\-', the integrity of +compressed data read from standard input is verified. Data read from +standard input must be all in the same compressed format. If a file fails to +decompress, does not exist, can't be opened, or is a terminal, ztest +continues verifying the rest of the files. A final diagnostic is shown at +verbosity level 1 or higher if any file fails the test when testing multiple +files. .PP If no files are specified, recursive searches examine the current working directory, and nonrecursive searches read standard input. @@ -28,8 +30,9 @@ garbage output without issuing any warning. Therefore, xz files can't always be verified as reliably as files in the other formats can. .PP Exit status is 0 if all compressed files verify OK, 1 if environmental -problems (file not found, invalid flags, I/O errors, etc), 2 if any -compressed file is corrupt or invalid. +problems (file not found, invalid command line options, I/O errors, etc), +2 if any compressed file is corrupt or invalid, or if any file has an +incorrect file name extension. .SH OPTIONS .TP \fB\-h\fR, \fB\-\-help\fR @@ -45,7 +48,7 @@ process only the formats in <list> don't read runtime configuration file .TP \fB\-O\fR, \fB\-\-force\-format=\fR<fmt> -force the format given (bz2, gz, lz, xz, zst) +force the input format .TP \fB\-q\fR, \fB\-\-quiet\fR suppress all messages @@ -73,6 +76,8 @@ set compressor and options for xz format .TP \fB\-\-zst=\fR<command> set compressor and options for zstd format +.PP +Valid formats for options '\-M' and '\-O' are 'bz2', 'gz', 'lz', 'xz', and 'zst'. .SH "REPORTING BUGS" Report bugs to zutils\-bug@nongnu.org .br diff --git a/doc/zupdate.1 b/doc/zupdate.1 index 8519088..4a8c0b1 100644 --- a/doc/zupdate.1 +++ b/doc/zupdate.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.16. -.TH ZUPDATE "1" "April 2022" "zutils 1.12-pre2" "User Commands" +.TH ZUPDATE "1" "December 2022" "zutils 1.12-rc1" "User Commands" .SH NAME zupdate \- recompress bzip2, gzip, xz, zstd files to lzip format .SH SYNOPSIS @@ -33,8 +33,8 @@ The names of the original files must have one of the following extensions: Exit status is 0 if all the compressed files were successfully recompressed (if needed), compared, and deleted (if requested). 1 if a non\-fatal error occurred (file not found or not regular, or has invalid format, or can't be -deleted). 2 if a fatal error occurred (compressor can't be run, or -comparison fails). +deleted). 2 if a fatal error occurred (invalid command line options, +compressor can't be run, or comparison fails). .SH OPTIONS .TP \fB\-h\fR, \fB\-\-help\fR @@ -43,6 +43,9 @@ display this help and exit \fB\-V\fR, \fB\-\-version\fR output version information and exit .TP +\fB\-d\fR, \fB\-\-destdir=\fR<dir> +write recompressed files into <dir> +.TP \fB\-e\fR, \fB\-\-expand\-extensions\fR expand combined extensions; tgz \-> tar.lz .TP @@ -93,6 +96,8 @@ set compressor and options for xz format .TP \fB\-\-zst=\fR<command> set compressor and options for zstd format +.PP +Valid formats for option '\-M' are 'bz2', 'gz', 'lz', 'xz', and 'zst'. .SH "REPORTING BUGS" Report bugs to zutils\-bug@nongnu.org .br diff --git a/doc/zutils.info b/doc/zutils.info index 9a9ca05..ea12cc3 100644 --- a/doc/zutils.info +++ b/doc/zutils.info @@ -11,13 +11,13 @@ File: zutils.info, Node: Top, Next: Introduction, Up: (dir) Zutils Manual ************* -This manual is for Zutils (version 1.12-pre2, 12 April 2022). +This manual is for Zutils (version 1.12-rc1, 5 December 2022). * Menu: * Introduction:: Purpose and features of zutils * Common options:: Options common to all utilities -* The zutilsrc file:: The zutils configuration file +* Configuration:: The configuration file zutils.conf * Zcat:: Concatenating compressed files * Zcmp:: Comparing compressed files byte by byte * Zdiff:: Comparing compressed files line by line @@ -43,20 +43,22 @@ Zutils is a collection of utilities able to process any combination of compressed and uncompressed files transparently. If any file given, including standard input, is compressed, its decompressed content is used. Compressed files are decompressed on the fly; no temporary files are -created. +created. Data format is detected by its magic bytes, not by the file name +extension. These utilities are not wrapper scripts but safer and more efficient C++ programs. In particular the option '--recursive' is very efficient in those utilities supporting it. -The utilities provided are zcat, zcmp, zdiff, zgrep, ztest, and zupdate. +The utilities provided are 'zcat', 'zcmp', 'zdiff', 'zgrep', 'ztest', and +'zupdate'. The formats supported are bzip2, gzip, lzip, xz, and zstd. Zutils uses external compressors. The compressor to be used for each format is configurable at runtime. - zcat, zcmp, zdiff, and zgrep are improved replacements for the shell -scripts provided by GNU gzip. ztest is unique to zutils. zupdate is similar -to gzip's znew. + 'zcat', 'zcmp', 'zdiff', and 'zgrep' are improved replacements for the +shell scripts provided by GNU gzip. 'ztest' is unique to zutils. 'zupdate' +is similar to gzip's znew. NOTE: Bzip2 and lzip provide well-defined values of exit status, which makes them safe to use with zutils. Gzip and xz may return ambiguous warning @@ -94,7 +96,7 @@ Z zettabyte (10^21) | Zi zebibyte (2^70) Y yottabyte (10^24) | Yi yobibyte (2^80) -File: zutils.info, Node: Common options, Next: The zutilsrc file, Prev: Introduction, Up: Top +File: zutils.info, Node: Common options, Next: Configuration, Prev: Introduction, Up: Top 2 Common options **************** @@ -106,14 +108,17 @@ here. *Note Argument syntax: (arg_parser)Argument syntax. '-h' '--help' Print an informative help message describing the options and exit. - zgrep only supports the '--help' form of this option. + 'zgrep' only supports the '--help' form of this option. '-V' '--version' Print the version number on the standard output and exit. This version - number should be included in all bug reports. In verbose mode, zdiff - and zgrep print also the version of the diff or grep program used - respectively. + number should be included in all bug reports. In verbose mode, 'zdiff' + and 'zgrep' print also the version of the diff or grep program used + respectively. At verbosity level 1 (2 for 'zdiff' and 'zgrep') or + higher, print also the versions of the compressors used (perhaps + limited by option '--format'). (The compressors used must support the + option '-V' for this to work). '-M FORMAT_LIST' '--format=FORMAT_LIST' @@ -138,20 +143,19 @@ here. *Note Argument syntax: (arg_parser)Argument syntax. '-N' '--no-rcfile' - Don't read the runtime configuration file 'zutilsrc'. + Don't read the runtime configuration file 'zutils.conf'. '--bz2=COMMAND' '--gz=COMMAND' '--lz=COMMAND' '--xz=COMMAND' '--zst=COMMAND' - Set program to be used as (de)compressor for the corresponding format. + Set program to be used as decompressor for the corresponding format. COMMAND may include arguments. For example '--lz='plzip --threads=2''. - The program set with '--lz' is used for both compression and - decompression. The others are used only for decompression. The name of - the program can't begin with '-'. These options override the values - set in 'zutilsrc'. The compression program used must meet three - requirements: + 'zupdate' uses '--lz' for compression, not for decompression (*note + lz-compressor::). The name of the program can't begin with '-'. These + options override the values set in 'zutils.conf'. The compression + program used must meet three requirements: 1. When called with the option '-d' and without file names, it must read compressed data from the standard input and produce @@ -165,21 +169,23 @@ here. *Note Argument syntax: (arg_parser)Argument syntax. -File: zutils.info, Node: The zutilsrc file, Next: Zcat, Prev: Common options, Up: Top +File: zutils.info, Node: Configuration, Next: Zcat, Prev: Common options, Up: Top -3 The zutils configuration file 'zutilsrc' -****************************************** +3 The configuration file 'zutils.conf' +************************************** -'zutilsrc' is the runtime configuration file for zutils. In it you may +'zutils.conf' is the runtime configuration file for zutils. In it you may define the compressor name and options to be used for each format. -'zutilsrc' is optional; you don't need to install it in order to run zutils. +'zutils.conf' is optional; you don't need to install it in order to run +zutils. The compressors specified in the command line override those specified -in 'zutilsrc'. +in 'zutils.conf'. - You may copy the system 'zutilsrc' file '${sysconfdir}/zutilsrc' to -'$HOME/.zutilsrc' and customize these options as you like. The file syntax -is fairly obvious (and there are further instructions in it): + You may copy the system 'zutils.conf' file '${sysconfdir}/zutils.conf' +to '$XDG_CONFIG_HOME/zutils.conf' and customize these options as you like. +('XDG_CONFIG_HOME' defaults to '$HOME/.config'). The file syntax is fairly +obvious (and there are further instructions in it): 1. Any line beginning with '#' is a comment line. @@ -189,17 +195,17 @@ is fairly obvious (and there are further instructions in it): where <format> is one of 'bz2', 'gz', 'lz', 'xz', or 'zst'. -File: zutils.info, Node: Zcat, Next: Zcmp, Prev: The zutilsrc file, Up: Top +File: zutils.info, Node: Zcat, Next: Zcmp, Prev: Configuration, Up: Top 4 Zcat ****** -zcat copies each FILE argument to standard output in sequence. If any file -given is compressed, its decompressed content is copied. If a file given -does not exist, and its name does not end with one of the known extensions, -zcat tries the compressed file names corresponding to the formats -supported. If a file fails to decompress, zcat continues copying the rest -of the files. +'zcat' copies each FILE argument to standard output in sequence. If any +file given is compressed, its decompressed content is copied. If a file +given does not exist, and its name does not end with one of the known +extensions, 'zcat' tries the compressed file names corresponding to the +formats supported. If a file fails to decompress, 'zcat' continues copying +the rest of the files. If a file is specified as '-', data are read from standard input, decompressed if needed, and sent to standard output. Data read from @@ -209,13 +215,13 @@ same compressed format. If no files are specified, recursive searches examine the current working directory, and nonrecursive searches read standard input. - The format for running zcat is: + The format for running 'zcat' is: zcat [OPTIONS] [FILES] Exit status is 0 if no errors occurred, 1 otherwise. - zcat supports the following options: + 'zcat' supports the following options: '-A' '--show-all' @@ -240,10 +246,10 @@ Exit status is 0 if no errors occurred, 1 otherwise. '-O FORMAT' '--force-format=FORMAT' Force the compressed format given. Valid values for FORMAT are 'bz2', - 'gz', 'lz', 'xz', and 'zst'. If this option is used, the files are - passed to the corresponding decompressor without verifying their - format, and the exact file name must be given. Other names won't be - tried. + 'gz', 'lz', 'xz', 'zst', and 'un' for 'uncompressed'. If this option + is used, the files are passed to the corresponding decompressor (or + transmitted unmodified) without verifying their format, and the exact + file name must be given. Other names won't be tried. '-q' '--quiet' @@ -278,7 +284,8 @@ Exit status is 0 if no errors occurred, 1 otherwise. stands for "meta"). '--verbose' - Verbose mode. Show error messages. + Verbose mode. Show error messages. Repeating it increases the verbosity + level. *Note version::. @@ -287,19 +294,19 @@ File: zutils.info, Node: Zcmp, Next: Zdiff, Prev: Zcat, Up: Top 5 Zcmp ****** -zcmp compares two files and, if they differ, writes to standard output the -first byte and line number where they differ. Bytes and lines are numbered -starting with 1. A hyphen '-' used as a FILE argument means standard input. -If any file given is compressed, its decompressed content is used. -Compressed files are decompressed on the fly; no temporary files are -created. +'zcmp' compares two files and, if they differ, writes to standard output +the first byte and line number where they differ. Bytes and lines are +numbered starting with 1. A hyphen '-' used as a FILE argument means +standard input. If any file given is compressed, its decompressed content +is used. Compressed files are decompressed on the fly; no temporary files +are created. - The format for running zcmp is: + The format for running 'zcmp' is: zcmp [OPTIONS] FILE1 [FILE2] This compares FILE1 to FILE2. The standard input is used only if FILE1 or -FILE2 refers to standard input. If FILE2 is omitted zcmp tries the +FILE2 refers to standard input. If FILE2 is omitted 'zcmp' tries the following: - If FILE1 is compressed, compares its decompressed contents with the @@ -312,13 +319,19 @@ following: An exit status of 0 means no differences were found, 1 means some differences were found, and 2 means trouble. - zcmp supports the following options: + 'zcmp' supports the following options: '-b' '--print-bytes' - Print the differing bytes. Print control bytes as a '^' followed by a - letter, and precede bytes larger than 127 with 'M-' (which stands for - "meta"). + Print the values of the differing bytes (in octal by default) followed + by the bytes themselves in printable form. Print control bytes as a '^' + followed by a letter, and precede bytes larger than 127 with 'M-' + (which stands for "meta"). + +'-H' +'--hexadecimal' + Print the values of the differing bytes in hexadecimal instead of + octal. '-i SIZE' '--ignore-initial=SIZE' @@ -328,11 +341,9 @@ differences were found, and 2 means trouble. first input file and the first SIZE2 bytes of the second input file. '-l' -'-v' '--list' -'--verbose' - Print the byte numbers (in decimal) and values (in octal) of all - differing bytes. + Print the byte numbers (in decimal) and values (in octal by default) + of all differing bytes. Bytes are numbered starting with 1. '-n COUNT' '--bytes=COUNT' @@ -342,19 +353,50 @@ differences were found, and 2 means trouble. '--force-format=[FORMAT1][,FORMAT2]' Force the compressed formats given. Any of FORMAT1 or FORMAT2 may be omitted and the corresponding format will be automatically detected. - Valid values for FORMAT are 'bz2', 'gz', 'lz', 'xz', and 'zst'. If at - least one format is specified with this option, the file is passed to - the corresponding decompressor without verifying its format, and the - exact file names of both FILE1 and FILE2 must be given. Other names - won't be tried. + Valid values for FORMAT are 'bz2', 'gz', 'lz', 'xz', 'zst', and 'un' + for 'uncompressed'. If at least one format is specified with this + option, the file is passed to the corresponding decompressor (or + transmitted unmodified) without verifying its format, and the exact + file names of both FILE1 and FILE2 must be given. Other names won't be + tried. '-q' -'-s' '--quiet' '--silent' - Don't print anything; only return an exit status indicating whether the - files differ. + Suppress diagnostics written to standard error, even the + 'EOF on <name_of_shorter_file>' diagnostic. Byte differences are still + written to standard output. ('-q' produces no output except byte + differences). + +'-s' +'--script' + Write nothing to standard output or standard error when files differ, + not even the 'EOF on <name_of_shorter_file>' diagnostic; indicate + differing files through exit status only. Diagnostic messages are still + written to standard error when an error is encountered. ('-s' produces + no output except error messages). +'-v' +'--verbose' + Verbose mode. Undoes the effect of '--quiet'. Further -v's increase + the verbosity level. *Note version::. + + + Byte counts given as arguments to options may be expressed in decimal, +hexadecimal, or octal (using the same syntax as integer constants in C++), +and may be followed by a multiplier and an optional 'B' for "byte". + + Table of SI and binary prefixes (unit multipliers): + +Prefix Value | Prefix Value +k kilobyte (10^3 = 1000) | Ki kibibyte (2^10 = 1024) +M megabyte (10^6) | Mi mebibyte (2^20) +G gigabyte (10^9) | Gi gibibyte (2^30) +T terabyte (10^12) | Ti tebibyte (2^40) +P petabyte (10^15) | Pi pebibyte (2^50) +E exabyte (10^18) | Ei exbibyte (2^60) +Z zettabyte (10^21) | Zi zebibyte (2^70) +Y yottabyte (10^24) | Yi yobibyte (2^80) File: zutils.info, Node: Zdiff, Next: Zgrep, Prev: Zcmp, Up: Top @@ -362,19 +404,19 @@ File: zutils.info, Node: Zdiff, Next: Zgrep, Prev: Zcmp, Up: Top 6 Zdiff ******* -zdiff compares two files and, if they differ, writes to standard output the -differences line by line. A hyphen '-' used as a FILE argument means +'zdiff' compares two files and, if they differ, writes to standard output +the differences line by line. A hyphen '-' used as a FILE argument means standard input. If any file given is compressed, its decompressed content -is used. zdiff is a front end to the program diff and has the limitation +is used. 'zdiff' is a front end to the program diff and has the limitation that messages from diff refer to temporary file names instead of those specified. - The format for running zdiff is: + The format for running 'zdiff' is: zdiff [OPTIONS] FILE1 [FILE2] This compares FILE1 to FILE2. The standard input is used only if FILE1 or -FILE2 refers to standard input. If FILE2 is omitted zdiff tries the +FILE2 refers to standard input. If FILE2 is omitted 'zdiff' tries the following: - If FILE1 is compressed, compares its decompressed contents with the @@ -387,8 +429,8 @@ following: An exit status of 0 means no differences were found, 1 means some differences were found, and 2 means trouble. - zdiff supports the following options (some options only work if the diff -program used supports them): + 'zdiff' supports the following options (some options only work if the +diff program used supports them): '-a' '--text' @@ -425,11 +467,12 @@ program used supports them): '--force-format=[FORMAT1][,FORMAT2]' Force the compressed formats given. Any of FORMAT1 or FORMAT2 may be omitted and the corresponding format will be automatically detected. - Valid values for FORMAT are 'bz2', 'gz', 'lz', 'xz', and 'zst'. If at - least one format is specified with this option, the file is passed to - the corresponding decompressor without verifying its format, and the - exact file names of both FILE1 and FILE2 must be given. Other names - won't be tried. + Valid values for FORMAT are 'bz2', 'gz', 'lz', 'xz', 'zst', and 'un' + for 'uncompressed'. If at least one format is specified with this + option, the file is passed to the corresponding decompressor (or + transmitted unmodified) without verifying its format, and the exact + file names of both FILE1 and FILE2 must be given. Other names won't be + tried. '-p' '--show-c-function' @@ -461,7 +504,8 @@ program used supports them): '-v' '--verbose' When specified before '--version', print the version of the diff - program used. + program used. Further -v's increase the verbosity level. *Note + version::. '-w' '--ignore-all-space' @@ -483,12 +527,13 @@ File: zutils.info, Node: Zgrep, Next: Ztest, Prev: Zdiff, Up: Top 7 Zgrep ******* -zgrep is a front end to the program grep that allows transparent search on -any combination of compressed and uncompressed files. If any file given is -compressed, its decompressed content is used. If a file given does not -exist, and its name does not end with one of the known extensions, zgrep +'zgrep' is a front end to the program grep that allows transparent search +on any combination of compressed and uncompressed files. If any file given +is compressed, its decompressed content is used. If a file given does not +exist, and its name does not end with one of the known extensions, 'zgrep' tries the compressed file names corresponding to the formats supported. If -a file fails to decompress, zgrep continues searching the rest of the files. +a file fails to decompress, 'zgrep' continues searching the rest of the +files. If a file is specified as '-', data are read from standard input, decompressed if needed, and fed to grep. Data read from standard input must @@ -497,16 +542,23 @@ be of the same type; all uncompressed or all in the same compressed format. If no files are specified, recursive searches examine the current working directory, and nonrecursive searches read standard input. - The format for running zgrep is: + For efficiency reasons, 'zgrep' does not always read all its input. For +example, the shell command 'base64 -d foo | zgrep -q X' can cause 'zgrep' +to exit immediately after reading a line containing 'X', without bothering +to read the rest of its input data. This in turn can cause base64 to exit +with a nonzero status because base64 cannot write to its output pipe after +'zgrep' exits. + + The format for running 'zgrep' is: zgrep [OPTIONS] PATTERN [FILES] An exit status of 0 means at least one match was found, 1 means no matches were found, and 2 means trouble. - zgrep supports the following options (Some options only work if the grep -program used supports them. Options -h, -H, -r, -R, and -Z are managed by -zgrep and not passed to grep): + 'zgrep' supports the following options (Some options only work if the +grep program used supports them. Options -h, -H, -r, -R, and -Z are managed +by 'zgrep' and not passed to grep): '-a' '--text' @@ -577,11 +629,13 @@ zgrep and not passed to grep): '-l' '--files-with-matches' - Only print names of files containing at least one match. + Only print names of files containing at least one match. Stop reading + each file on the first match. '-L' '--files-without-match' - Only print names of files not containing any matches. + Only print names of files not containing any matches. Stop reading + each file on the first match. Note: option -L fails (prints wrong results, returns wrong status, and even hangs) when using GNU grep versions 3.2 to 3.4 inclusive because of a wrong change in the exit status of grep, which was reverted in @@ -609,10 +663,10 @@ zgrep and not passed to grep): '-O FORMAT' '--force-format=FORMAT' Force the compressed format given. Valid values for FORMAT are 'bz2', - 'gz', 'lz', 'xz', and 'zst'. If this option is used, the files are - passed to the corresponding decompressor without verifying their - format, and the exact file name must be given. Other names won't be - tried. + 'gz', 'lz', 'xz', 'zst', and 'un' for 'uncompressed'. If this option + is used, the files are passed to the corresponding decompressor (or + transmitted unmodified) without verifying their format, and the exact + file name must be given. Other names won't be tried. '-P' '--perl-regexp' @@ -655,7 +709,8 @@ zgrep and not passed to grep): '--verbose' Verbose mode. Show error messages. When specified before '--version', - print the version of the grep program used. + print the version of the grep program used. Repeating it increases the + verbosity level. *Note version::. '-w' '--word-regexp' @@ -680,14 +735,16 @@ File: zutils.info, Node: Ztest, Next: Zupdate, Prev: Zgrep, Up: Top 8 Ztest ******* -ztest verifies the integrity of the compressed files specified. -Uncompressed files are ignored. If a file is specified as '-', the -integrity of compressed data read from standard input is verified. Data -read from standard input must be all in the same compressed format. If a -file fails to decompress, does not exist, can't be opened, or is a -terminal, ztest continues verifying the rest of the files. A final -diagnostic is shown at verbosity level 1 or higher if any file fails the -test when testing multiple files. +'ztest' verifies the integrity of the compressed files specified. It also +warns if an uncompressed file has a compressed file name extension, or if a +compressed file has a wrong compressed extension. Uncompressed files are +otherwise ignored. If a file is specified as '-', the integrity of +compressed data read from standard input is verified. Data read from +standard input must be all in the same compressed format. If a file fails to +decompress, does not exist, can't be opened, or is a terminal, 'ztest' +continues verifying the rest of the files. A final diagnostic is shown at +verbosity level 1 or higher if any file fails the test when testing multiple +files. If no files are specified, recursive searches examine the current working directory, and nonrecursive searches read standard input. @@ -703,15 +760,16 @@ of the xz format specification allows xz decompressors to produce garbage output without issuing any warning. Therefore, xz files can't always be verified as reliably as files in the other formats can. - The format for running ztest is: + The format for running 'ztest' is: ztest [OPTIONS] [FILES] -The exit status is 0 if all compressed files verify OK, 1 if environmental -problems (file not found, invalid flags, I/O errors, etc), 2 if any -compressed file is corrupt or invalid. +Exit status is 0 if all compressed files verify OK, 1 if environmental +problems (file not found, invalid command line options, I/O errors, etc), 2 +if any compressed file is corrupt or invalid, or if any file has an +incorrect file name extension. - ztest supports the following options: + 'ztest' supports the following options: '-O FORMAT' '--force-format=FORMAT' @@ -738,8 +796,8 @@ compressed file is corrupt or invalid. '-v' '--verbose' - Verbose mode. Show the verify status for each file processed. - Further -v's increase the verbosity level. + Verbose mode. Show the verify status for each file processed. Further + -v's increase the verbosity level. *Note version::. @@ -748,12 +806,12 @@ File: zutils.info, Node: Zupdate, Next: Problems, Prev: Ztest, Up: Top 9 Zupdate ********* -zupdate recompresses files from bzip2, gzip, xz, and zstd formats to lzip +'zupdate' recompresses files from bzip2, gzip, xz, and zstd formats to lzip format. Each original is compared with the new file and then deleted. Only regular files with standard file name extensions are recompressed, other files are ignored. Compressed files are decompressed and then recompressed on the fly; no temporary files are created. If an error happens while -recompressing a file, zupdate exits immediately without recompressing the +recompressing a file, 'zupdate' exits immediately without recompressing the rest of the files. The lzip format is chosen as destination because it is the most appropriate for long-term data archiving. @@ -763,7 +821,7 @@ directory, and nonrecursive searches do nothing. If the lzip compressed version of a file already exists, the file is skipped unless the option '--force' is given. In this case, if the comparison with the existing lzip version fails, an error is returned and -the original file is not deleted. The operation of zupdate is meant to be +the original file is not deleted. The operation of 'zupdate' is meant to be safe and not cause any data loss. Therefore, existing lzip compressed files are never overwritten nor deleted. @@ -787,23 +845,40 @@ recompressing Slackware packages, for example. If the decompressor for the xz or zstd formats is not found, the corresponding files are ignored. - Recompressing a file is much like copying or moving it. Therefore zupdate -preserves the access and modification dates, permissions, and, if you have -appropriate privileges, ownership of the file just as 'cp -p' does. (If the -user ID or the group ID can't be duplicated, the file permission bits -S_ISUID and S_ISGID are cleared). + Recompressing a file is much like copying or moving it. Therefore +'zupdate' preserves the access and modification dates, permissions, and, if +you have appropriate privileges, ownership of the file just as 'cp -p' +does. (If the user ID or the group ID can't be duplicated, the file +permission bits S_ISUID and S_ISGID are cleared). - The format for running zupdate is: + The format for running 'zupdate' is: zupdate [OPTIONS] [FILES] Exit status is 0 if all the compressed files were successfully recompressed (if needed), compared, and deleted (if requested). 1 if a non-fatal error occurred (file not found or not regular, or has invalid format, or can't be -deleted). 2 if a fatal error occurred (compressor can't be run, or -comparison fails). - - zupdate supports the following options: +deleted). 2 if a fatal error occurred (invalid command line options, +compressor can't be run, or comparison fails). + + 'zupdate' supports the following options: + +'-d DIR' +'--destdir=DIR' + Write recompressed files to another directory, using DIR as base + directory, instead of writing them in the same directory as the + original files. In recursive mode, this is done by replacing each + directory specified in the command line with DIR to produce the + recompressed file names. For example, 'zupdate -r -d DIR ../a' + recompresses a file named '../a/b/c.gz' to 'DIR/b/c.lz'. Regular files + specified in the command line are recompressed directly into DIR. For + example, 'zupdate -d DIR ../a/b/c.gz' writes the recompressed file to + 'DIR/c.lz'. + + This option allows recompressing files from a read-only file system to + another place without the need to copy or link them to the destination + directory first. (Remember to use option '--keep' when recompressing + read-only files to avoid warnings about files that can't be deleted). '-e' '--expand-extensions' @@ -851,13 +926,26 @@ comparison fails). '-v' '--verbose' Verbose mode. Show the files being processed. A second '-v' also shows - the files being ignored. + the files being ignored and increases the verbosity level. *Note + version::. '-0 .. -9' - Set the compression level of lzip. By default zupdate passes '-9' to + Set the compression level of lzip. By default 'zupdate' passes '-9' to lzip. Custom compression options can be passed to lzip with the option '--lz'. For example '--lz='lzip -9 -s64MiB''. +'--lz=COMMAND' + Set compression command. COMMAND may include arguments. For example + '--lz='plzip --threads=2''. The name of the program can't begin with + '-'. This option overrides the value set in 'zutils.conf'. The + compression program used does not need to implement decompression + (*note compressor-requirements::), but it must implement at least the + compression level option '-9' and the option '-o FILE' to write the + compressed output to FILE. tarlz meets these requirements, and + therefore can be used to recompress POSIX tar archives by using a + command like 'zupdate --lz='tarlz -9 -z --no-solid' archive.tar.gz'. + *Note tarlz manual: (tarlz)Top. + File: zutils.info, Node: Problems, Next: Concept index, Prev: Zupdate, Up: Top @@ -893,24 +981,26 @@ Concept index * zgrep: Zgrep. (line 6) * ztest: Ztest. (line 6) * zupdate: Zupdate. (line 6) -* zutilsrc: The zutilsrc file. (line 6) +* zutils.conf: Configuration. (line 6) Tag Table: Node: Top217 -Node: Introduction1150 -Node: Common options3897 -Ref: compressor-requirements6134 -Node: The zutilsrc file6529 -Node: Zcat7497 -Node: Zcmp10072 -Node: Zdiff12573 -Node: Zgrep15623 -Node: Ztest21115 -Node: Zupdate23681 -Node: Problems28191 -Node: Concept index28725 +Node: Introduction1156 +Node: Common options4003 +Ref: version4489 +Ref: compressor-requirements6440 +Node: Configuration6835 +Node: Zcat7868 +Node: Zcmp10568 +Node: Zdiff14825 +Node: Zgrep18008 +Node: Ztest24116 +Node: Zupdate26915 +Ref: lz-compressor32442 +Node: Problems33143 +Node: Concept index33677 End Tag Table diff --git a/doc/zutils.texi b/doc/zutils.texi index 6324814..459d38d 100644 --- a/doc/zutils.texi +++ b/doc/zutils.texi @@ -6,8 +6,8 @@ @finalout @c %**end of header -@set UPDATED 12 April 2022 -@set VERSION 1.12-pre2 +@set UPDATED 5 December 2022 +@set VERSION 1.12-rc1 @dircategory Compression @direntry @@ -38,7 +38,7 @@ This manual is for Zutils (version @value{VERSION}, @value{UPDATED}). @menu * Introduction:: Purpose and features of zutils * Common options:: Options common to all utilities -* The zutilsrc file:: The zutils configuration file +* Configuration:: The configuration file zutils.conf * Zcat:: Concatenating compressed files * Zcmp:: Comparing compressed files byte by byte * Zdiff:: Comparing compressed files line by line @@ -66,21 +66,25 @@ is a collection of utilities able to process any combination of compressed and uncompressed files transparently. If any file given, including standard input, is compressed, its decompressed content is used. Compressed files are decompressed on the fly; no temporary files are -created. +created. Data format is detected by its magic bytes, not by the file name +extension. These utilities are not wrapper scripts but safer and more efficient C++ -programs. In particular the option @samp{--recursive} is very efficient in +programs. In particular the option @option{--recursive} is very efficient in those utilities supporting it. @noindent -The utilities provided are zcat, zcmp, zdiff, zgrep, ztest, and zupdate.@* -The formats supported are bzip2, gzip, lzip, xz, and zstd.@* +The utilities provided are @command{zcat}, @command{zcmp}, @command{zdiff}, +@command{zgrep}, @command{ztest}, and @command{zupdate}.@* +The formats supported are bzip2, gzip, +@uref{http://www.nongnu.org/lzip/lzip.html,,lzip}, xz, and zstd.@* Zutils uses external compressors. The compressor to be used for each format is configurable at runtime. -zcat, zcmp, zdiff, and zgrep are improved replacements for the shell scripts -provided by GNU gzip. ztest is unique to zutils. zupdate is similar to -gzip's znew. +@command{zcat}, @command{zcmp}, @command{zdiff}, and @command{zgrep} are +improved replacements for the shell scripts provided by GNU gzip. +@command{ztest} is unique to zutils. @command{zupdate} is similar to gzip's +znew. NOTE: Bzip2 and lzip provide well-defined values of exit status, which makes them safe to use with zutils. Gzip and xz may return ambiguous warning @@ -88,7 +92,7 @@ values, making them less reliable back ends for zutils. Zstd currently does not even document its exit status in its man page. @xref{compressor-requirements}. -FORMAT NOTE 1: The option @samp{--format} allows the processing of a subset +FORMAT NOTE 1: The option @option{--format} allows the processing of a subset of formats in recursive mode and when trying compressed file names. For example, use the following command to search for the string @samp{foo} in gzip and lzip files only: @@ -136,15 +140,19 @@ descriptions for each of the programs, they are described here. @table @code @item -h @itemx --help -Print an informative help message describing the options and exit. zgrep -only supports the @samp{--help} form of this option. +Print an informative help message describing the options and exit. +@command{zgrep} only supports the @option{--help} form of this option. +@anchor{version} @item -V @itemx --version Print the version number on the standard output and exit. This version number should be included in all bug reports. -In verbose mode, zdiff and zgrep print also the version of the diff or grep -program used respectively. +In verbose mode, @command{zdiff} and @command{zgrep} print also the version +of the diff or grep program used respectively. At verbosity level 1 (2 for +@command{zdiff} and @command{zgrep}) or higher, print also the versions of +the compressors used (perhaps limited by option @option{--format}). (The +compressors used must support the option @option{-V} for this to work). @item -M @var{format_list} @itemx --format=@var{format_list} @@ -171,29 +179,29 @@ extensions: @item -N @itemx --no-rcfile -Don't read the runtime configuration file @samp{zutilsrc}. +Don't read the runtime configuration file @file{zutils.conf}. @item --bz2=@var{command} @itemx --gz=@var{command} @itemx --lz=@var{command} @itemx --xz=@var{command} @itemx --zst=@var{command} -Set program to be used as (de)compressor for the corresponding format. +Set program to be used as decompressor for the corresponding format. @var{command} may include arguments. For example -@w{@samp{--lz='plzip --threads=2'}}. The program set with @samp{--lz} is -used for both compression and decompression. The others are used only for -decompression. The name of the program can't begin with @samp{-}. These -options override the values set in @file{zutilsrc}. The compression program -used must meet three requirements: +@w{@option{--lz='plzip --threads=2'}}. @command{zupdate} uses @option{--lz} +for compression, not for decompression (@pxref{lz-compressor}). The name of +the program can't begin with @samp{-}. These options override the values set +in @file{zutils.conf}. The compression program used must meet three +requirements: @anchor{compressor-requirements} @enumerate @item -When called with the option @samp{-d} and without file names, it must read +When called with the option @option{-d} and without file names, it must read compressed data from the standard input and produce decompressed data on the standard output. @item -If the option @samp{-q} is passed to zutils, the compression program must +If the option @option{-q} is passed to zutils, the compression program must also accept it. @item It must return 0 if no errors occurred, and a non-zero value otherwise. @@ -202,21 +210,22 @@ It must return 0 if no errors occurred, and a non-zero value otherwise. @end table -@node The zutilsrc file -@chapter The zutils configuration file 'zutilsrc' -@cindex zutilsrc +@node Configuration +@chapter The configuration file 'zutils.conf' +@cindex zutils.conf -@file{zutilsrc} is the runtime configuration file for zutils. In it you +@file{zutils.conf} is the runtime configuration file for zutils. In it you may define the compressor name and options to be used for each format. -@file{zutilsrc} is optional; you don't need to install it in order to run +@file{zutils.conf} is optional; you don't need to install it in order to run zutils. The compressors specified in the command line override those specified -in @file{zutilsrc}. +in @file{zutils.conf}. -You may copy the system @file{zutilsrc} file @file{$@{sysconfdir@}/zutilsrc} -to @file{$HOME/.zutilsrc} and customize these options as you like. The file -syntax is fairly obvious (and there are further instructions in it): +You may copy the system @file{zutils.conf} file @file{$@{sysconfdir@}/zutils.conf} +to @file{$XDG_CONFIG_HOME/zutils.conf} and customize these options as you like. +(@env{XDG_CONFIG_HOME} defaults to @file{$HOME/.config}). The file syntax is +fairly obvious (and there are further instructions in it): @enumerate @item @@ -236,12 +245,12 @@ where <format> is one of @samp{bz2}, @samp{gz}, @samp{lz}, @samp{xz}, or @chapter Zcat @cindex zcat -zcat copies each @var{file} argument to standard output in sequence. If any -file given is compressed, its decompressed content is copied. If a file -given does not exist, and its name does not end with one of the known -extensions, zcat tries the compressed file names corresponding to the -formats supported. If a file fails to decompress, zcat continues copying the -rest of the files. +@command{zcat} copies each @var{file} argument to standard output in +sequence. If any file given is compressed, its decompressed content is +copied. If a file given does not exist, and its name does not end with one +of the known extensions, @command{zcat} tries the compressed file names +corresponding to the formats supported. If a file fails to decompress, +@command{zcat} continues copying the rest of the files. If a file is specified as @samp{-}, data are read from standard input, decompressed if needed, and sent to standard output. Data read from @@ -251,7 +260,7 @@ same compressed format. If no files are specified, recursive searches examine the current working directory, and nonrecursive searches read standard input. -The format for running zcat is: +The format for running @command{zcat} is: @example zcat [@var{options}] [@var{files}] @@ -260,12 +269,12 @@ zcat [@var{options}] [@var{files}] @noindent Exit status is 0 if no errors occurred, 1 otherwise. -zcat supports the following options: +@command{zcat} supports the following options: @table @code @item -A @itemx --show-all -Equivalent to @samp{-vET}. +Equivalent to @option{-vET}. @item -b @itemx --number-nonblank @@ -273,7 +282,7 @@ Number all nonblank output lines, starting with 1. The line count is unlimited. @item -e -Equivalent to @samp{-vE}. +Equivalent to @option{-vE}. @item -E @itemx --show-ends @@ -286,10 +295,11 @@ Number all output lines, starting with 1. The line count is unlimited. @item -O @var{format} @itemx --force-format=@var{format} Force the compressed format given. Valid values for @var{format} are -@samp{bz2}, @samp{gz}, @samp{lz}, @samp{xz}, and @samp{zst}. If this option -is used, the files are passed to the corresponding decompressor without -verifying their format, and the exact file name must be given. Other names -won't be tried. +@samp{bz2}, @samp{gz}, @samp{lz}, @samp{xz}, @samp{zst}, and @samp{un} for +@samp{uncompressed}. If this option is used, the files are passed to the +corresponding decompressor (or transmitted unmodified) without verifying +their format, and the exact file name must be given. Other names won't be +tried. @item -q @itemx --quiet @@ -311,7 +321,7 @@ recursively, following all symbolic links. Replace multiple adjacent blank lines with a single blank line. @item -t -Equivalent to @samp{-vT}. +Equivalent to @option{-vT}. @item -T @itemx --show-tabs @@ -324,7 +334,8 @@ notation and precede characters larger than 127 with @samp{M-} (which stands for "meta"). @item --verbose -Verbose mode. Show error messages. +Verbose mode. Show error messages. Repeating it increases the verbosity +level. @xref{version}. @end table @@ -333,14 +344,14 @@ Verbose mode. Show error messages. @chapter Zcmp @cindex zcmp -zcmp compares two files and, if they differ, writes to standard output the -first byte and line number where they differ. Bytes and lines are numbered -starting with 1. A hyphen @samp{-} used as a @var{file} argument means -standard input. If any file given is compressed, its decompressed content is -used. Compressed files are decompressed on the fly; no temporary files are -created. +@command{zcmp} compares two files and, if they differ, writes to standard +output the first byte and line number where they differ. Bytes and lines are +numbered starting with 1. A hyphen @samp{-} used as a @var{file} argument +means standard input. If any file given is compressed, its decompressed +content is used. Compressed files are decompressed on the fly; no temporary +files are created. -The format for running zcmp is: +The format for running @command{zcmp} is: @example zcmp [@var{options}] @var{file1} [@var{file2}] @@ -349,7 +360,7 @@ zcmp [@var{options}] @var{file1} [@var{file2}] @noindent This compares @var{file1} to @var{file2}. The standard input is used only if @var{file1} or @var{file2} refers to standard input. If @var{file2} is -omitted zcmp tries the following: +omitted @command{zcmp} tries the following: @itemize - @item @@ -365,14 +376,19 @@ contents of @var{file1}.[lz|bz2|gz|zst|xz] (the first one that is found). An exit status of 0 means no differences were found, 1 means some differences were found, and 2 means trouble. -zcmp supports the following options: +@command{zcmp} supports the following options: @table @code @item -b @itemx --print-bytes -Print the differing bytes. Print control bytes as a @samp{^} followed by -a letter, and precede bytes larger than 127 with @samp{M-} (which stands -for "meta"). +Print the values of the differing bytes (in octal by default) followed by +the bytes themselves in printable form. Print control bytes as a @samp{^} +followed by a letter, and precede bytes larger than 127 with @samp{M-} +(which stands for "meta"). + +@item -H +@itemx --hexadecimal +Print the values of the differing bytes in hexadecimal instead of octal. @item -i @var{size} @itemx --ignore-initial=@var{size} @@ -383,11 +399,9 @@ first @var{size1} bytes of the first input file and the first @var{size2} bytes of the second input file. @item -l -@itemx -v @itemx --list -@itemx --verbose -Print the byte numbers (in decimal) and values (in octal) of all -differing bytes. +Print the byte numbers (in decimal) and values (in octal by default) of all +differing bytes. Bytes are numbered starting with 1. @item -n @var{count} @itemx --bytes=@var{count} @@ -398,33 +412,66 @@ Compare at most @var{count} input bytes. Force the compressed formats given. Any of @var{format1} or @var{format2} may be omitted and the corresponding format will be automatically detected. Valid values for @var{format} are @samp{bz2}, @samp{gz}, @samp{lz}, -@samp{xz}, and @samp{zst}. If at least one format is specified with this -option, the file is passed to the corresponding decompressor without -verifying its format, and the exact file names of both @var{file1} and -@var{file2} must be given. Other names won't be tried. +@samp{xz}, @samp{zst}, and @samp{un} for @samp{uncompressed}. If at least +one format is specified with this option, the file is passed to the +corresponding decompressor (or transmitted unmodified) without verifying its +format, and the exact file names of both @var{file1} and @var{file2} must be +given. Other names won't be tried. @item -q -@itemx -s @itemx --quiet @itemx --silent -Don't print anything; only return an exit status indicating whether the -files differ. +Suppress diagnostics written to standard error, even the +@w{@samp{EOF on <name_of_shorter_file>}} diagnostic. Byte differences are +still written to standard output. (@option{-q} produces no output except +byte differences). + +@item -s +@itemx --script +Write nothing to standard output or standard error when files differ, not +even the @w{@samp{EOF on <name_of_shorter_file>}} diagnostic; indicate +differing files through exit status only. Diagnostic messages are still +written to standard error when an error is encountered. (@option{-s} +produces no output except error messages). + +@item -v +@itemx --verbose +Verbose mode. Undoes the effect of @option{--quiet}. Further -v's increase +the verbosity level. @xref{version}. @end table +Byte counts given as arguments to options may be expressed in decimal, +hexadecimal, or octal (using the same syntax as integer constants in C++), +and may be followed by a multiplier and an optional @samp{B} for "byte". + +Table of SI and binary prefixes (unit multipliers): + +@multitable {Prefix} {kilobyte (10^3 = 1000)} {|} {Prefix} {kibibyte (2^10 = 1024)} +@item Prefix @tab Value @tab | @tab Prefix @tab Value +@item k @tab kilobyte (10^3 = 1000) @tab | @tab Ki @tab kibibyte (2^10 = 1024) +@item M @tab megabyte (10^6) @tab | @tab Mi @tab mebibyte (2^20) +@item G @tab gigabyte (10^9) @tab | @tab Gi @tab gibibyte (2^30) +@item T @tab terabyte (10^12) @tab | @tab Ti @tab tebibyte (2^40) +@item P @tab petabyte (10^15) @tab | @tab Pi @tab pebibyte (2^50) +@item E @tab exabyte (10^18) @tab | @tab Ei @tab exbibyte (2^60) +@item Z @tab zettabyte (10^21) @tab | @tab Zi @tab zebibyte (2^70) +@item Y @tab yottabyte (10^24) @tab | @tab Yi @tab yobibyte (2^80) +@end multitable + @node Zdiff @chapter Zdiff @cindex zdiff -zdiff compares two files and, if they differ, writes to standard output the -differences line by line. A hyphen @samp{-} used as a @var{file} argument -means standard input. If any file given is compressed, its decompressed -content is used. zdiff is a front end to the program diff and has the -limitation that messages from diff refer to temporary file names instead of -those specified. +@command{zdiff} compares two files and, if they differ, writes to standard +output the differences line by line. A hyphen @samp{-} used as a @var{file} +argument means standard input. If any file given is compressed, its +decompressed content is used. @command{zdiff} is a front end to the program +diff and has the limitation that messages from diff refer to temporary file +names instead of those specified. -The format for running zdiff is: +The format for running @command{zdiff} is: @example zdiff [@var{options}] @var{file1} [@var{file2}] @@ -433,7 +480,7 @@ zdiff [@var{options}] @var{file1} [@var{file2}] @noindent This compares @var{file1} to @var{file2}. The standard input is used only if @var{file1} or @var{file2} refers to standard input. If @var{file2} is -omitted zdiff tries the following: +omitted @command{zdiff} tries the following: @itemize - @item @@ -449,8 +496,8 @@ contents of @var{file1}.[lz|bz2|gz|zst|xz] (the first one that is found). An exit status of 0 means no differences were found, 1 means some differences were found, and 2 means trouble. -zdiff supports the following options (some options only work if the diff -program used supports them): +@command{zdiff} supports the following options (some options only work if +the diff program used supports them): @table @code @item -a @@ -465,7 +512,7 @@ Ignore changes in the amount of white space. @itemx --ignore-blank-lines Ignore changes whose lines are all blank. -@itemx -c +@item -c Use the context output format. @item -C @var{n} @@ -489,10 +536,11 @@ Ignore case differences in file contents. Force the compressed formats given. Any of @var{format1} or @var{format2} may be omitted and the corresponding format will be automatically detected. Valid values for @var{format} are @samp{bz2}, @samp{gz}, @samp{lz}, -@samp{xz}, and @samp{zst}. If at least one format is specified with this -option, the file is passed to the corresponding decompressor without -verifying its format, and the exact file names of both @var{file1} and -@var{file2} must be given. Other names won't be tried. +@samp{xz}, @samp{zst}, and @samp{un} for @samp{uncompressed}. If at least +one format is specified with this option, the file is passed to the +corresponding decompressor (or transmitted unmodified) without verifying its +format, and the exact file names of both @var{file1} and @var{file2} must be +given. Other names won't be tried. @item -p @itemx --show-c-function @@ -523,8 +571,8 @@ Same as -u but use @var{n} lines of context. @item -v @itemx --verbose -When specified before @samp{--version}, print the version of the diff -program used. +When specified before @option{--version}, print the version of the diff +program used. Further -v's increase the verbosity level. @xref{version}. @item -w @itemx --ignore-all-space @@ -546,12 +594,12 @@ Use the side by side output format. @chapter Zgrep @cindex zgrep -zgrep is a front end to the program grep that allows transparent search -on any combination of compressed and uncompressed files. If any file -given is compressed, its decompressed content is used. If a file given -does not exist, and its name does not end with one of the known -extensions, zgrep tries the compressed file names corresponding to the -formats supported. If a file fails to decompress, zgrep continues +@command{zgrep} is a front end to the program grep that allows transparent +search on any combination of compressed and uncompressed files. If any file +given is compressed, its decompressed content is used. If a file given does +not exist, and its name does not end with one of the known extensions, +@command{zgrep} tries the compressed file names corresponding to the formats +supported. If a file fails to decompress, @command{zgrep} continues searching the rest of the files. If a file is specified as @samp{-}, data are read from standard input, @@ -562,7 +610,14 @@ compressed format. If no files are specified, recursive searches examine the current working directory, and nonrecursive searches read standard input. -The format for running zgrep is: +For efficiency reasons, @command{zgrep} does not always read all its input. +For example, the shell command @w{@samp{base64 -d foo | zgrep -q X}} can +cause @command{zgrep} to exit immediately after reading a line containing +@samp{X}, without bothering to read the rest of its input data. This in turn +can cause base64 to exit with a nonzero status because base64 cannot write +to its output pipe after @command{zgrep} exits. + +The format for running @command{zgrep} is: @example zgrep [@var{options}] @var{pattern} [@var{files}] @@ -572,9 +627,9 @@ zgrep [@var{options}] @var{pattern} [@var{files}] An exit status of 0 means at least one match was found, 1 means no matches were found, and 2 means trouble. -zgrep supports the following options (Some options only work if the grep -program used supports them. Options -h, -H, -r, -R, and -Z are managed by -zgrep and not passed to grep): +@command{zgrep} supports the following options (Some options only work if +the grep program used supports them. Options -h, -H, -r, -R, and -Z are +managed by @command{zgrep} and not passed to grep): @table @code @item -a @@ -616,9 +671,9 @@ Interpret @var{pattern} as an extended regular expression (ERE). @item -f @var{file} @itemx --file=@var{file} Obtain patterns from @var{file}, one per line.@* -When searching in several files at once, command substitution can be -used with @samp{-e} to read @var{file} only once, for example if -@var{file} is not a regular file: +When searching in several files at once, command substitution can be used +with @option{-e} to read @var{file} only once, for example if @var{file} is +not a regular file: @w{@samp{zgrep -e "$(cat @var{file})" file1.lz file2.gz}} @item -F @@ -648,11 +703,13 @@ Ignore binary files. @item -l @itemx --files-with-matches -Only print names of files containing at least one match. +Only print names of files containing at least one match. Stop reading each +file on the first match. @item -L @itemx --files-without-match -Only print names of files not containing any matches.@* +Only print names of files not containing any matches. Stop reading each file +on the first match.@* Note: option -L fails (prints wrong results, returns wrong status, and even hangs) when using GNU grep versions 3.2 to 3.4 inclusive because of a wrong change in the exit status of grep, which was reverted in GNU grep 3.5. @@ -679,10 +736,11 @@ Show only the part of matching lines that actually matches @var{pattern}. @item -O @var{format} @itemx --force-format=@var{format} Force the compressed format given. Valid values for @var{format} are -@samp{bz2}, @samp{gz}, @samp{lz}, @samp{xz}, and @samp{zst}. If this option -is used, the files are passed to the corresponding decompressor without -verifying their format, and the exact file name must be given. Other names -won't be tried. +@samp{bz2}, @samp{gz}, @samp{lz}, @samp{xz}, @samp{zst}, and @samp{un} for +@samp{uncompressed}. If this option is used, the files are passed to the +corresponding decompressor (or transmitted unmodified) without verifying +their format, and the exact file name must be given. Other names won't be +tried. @item -P @itemx --perl-regexp @@ -724,8 +782,9 @@ Use binary I/O on platforms affected by the bug known as "text mode I/O". Select non-matching lines. @item --verbose -Verbose mode. Show error messages. When specified before @samp{--version}, -print the version of the grep program used. +Verbose mode. Show error messages. When specified before @option{--version}, +print the version of the grep program used. Repeating it increases the +verbosity level. @xref{version}. @item -w @itemx --word-regexp @@ -738,10 +797,10 @@ Match only whole lines. @item -Z @itemx --null Output a zero byte (the ASCII NUL character) instead of the character that -normally follows a file name. For example, 'zgrep -lZ' outputs a zero byte -after each file name instead of the usual newline. This option makes the -output unambiguous, even in the presence of file names containing unusual -characters like newlines. +normally follows a file name. For example, @w{@samp{zgrep -lZ}} outputs a +zero byte after each file name instead of the usual newline. This option +makes the output unambiguous, even in the presence of file names containing +unusual characters like newlines. @end table @@ -750,14 +809,16 @@ characters like newlines. @chapter Ztest @cindex ztest -ztest verifies the integrity of the compressed files specified. -Uncompressed files are ignored. If a file is specified as @samp{-}, the -integrity of compressed data read from standard input is verified. Data -read from standard input must be all in the same compressed format. If -a file fails to decompress, does not exist, can't be opened, or is a -terminal, ztest continues verifying the rest of the files. A final -diagnostic is shown at verbosity level 1 or higher if any file fails the -test when testing multiple files. +@command{ztest} verifies the integrity of the compressed files specified. It +also warns if an uncompressed file has a compressed file name extension, or +if a compressed file has a wrong compressed extension. Uncompressed files +are otherwise ignored. If a file is specified as @samp{-}, the integrity of +compressed data read from standard input is verified. Data read from +standard input must be all in the same compressed format. If a file fails to +decompress, does not exist, can't be opened, or is a terminal, @command{ztest} +continues verifying the rest of the files. A final diagnostic is shown at +verbosity level 1 or higher if any file fails the test when testing multiple +files. If no files are specified, recursive searches examine the current working directory, and nonrecursive searches read standard input. @@ -776,18 +837,19 @@ warning. Therefore, xz files can't always be verified as reliably as files in the other formats can. @c We can only hope that xz is soon abandoned. -The format for running ztest is: +The format for running @command{ztest} is: @example ztest [@var{options}] [@var{files}] @end example @noindent -The exit status is 0 if all compressed files verify OK, 1 if -environmental problems (file not found, invalid flags, I/O errors, etc), -2 if any compressed file is corrupt or invalid. +Exit status is 0 if all compressed files verify OK, 1 if environmental +problems (file not found, invalid command line options, I/O errors, etc), +2 if any compressed file is corrupt or invalid, or if any file has an +incorrect file name extension. -ztest supports the following options: +@command{ztest} supports the following options: @table @code @item -O @var{format} @@ -815,8 +877,8 @@ recursively, following all symbolic links. @item -v @itemx --verbose -Verbose mode. Show the verify status for each file processed.@* -Further -v's increase the verbosity level. +Verbose mode. Show the verify status for each file processed. Further -v's +increase the verbosity level. @xref{version}. @end table @@ -825,30 +887,30 @@ Further -v's increase the verbosity level. @chapter Zupdate @cindex zupdate -zupdate recompresses files from bzip2, gzip, xz, and zstd formats to lzip -format. Each original is compared with the new file and then deleted. Only -regular files with standard file name extensions are recompressed, other -files are ignored. Compressed files are decompressed and then recompressed -on the fly; no temporary files are created. If an error happens while -recompressing a file, zupdate exits immediately without recompressing the -rest of the files. The lzip format is chosen as destination because it is -the most appropriate for long-term data archiving. +@command{zupdate} recompresses files from bzip2, gzip, xz, and zstd formats +to lzip format. Each original is compared with the new file and then +deleted. Only regular files with standard file name extensions are +recompressed, other files are ignored. Compressed files are decompressed and +then recompressed on the fly; no temporary files are created. If an error +happens while recompressing a file, @command{zupdate} exits immediately +without recompressing the rest of the files. The lzip format is chosen as +destination because it is the most appropriate for long-term data archiving. If no files are specified, recursive searches examine the current working directory, and nonrecursive searches do nothing. -If the lzip compressed version of a file already exists, the file is -skipped unless the option @samp{--force} is given. In this case, if the -comparison with the existing lzip version fails, an error is returned -and the original file is not deleted. The operation of zupdate is meant -to be safe and not cause any data loss. Therefore, existing lzip -compressed files are never overwritten nor deleted. +If the lzip compressed version of a file already exists, the file is skipped +unless the option @option{--force} is given. In this case, if the comparison +with the existing lzip version fails, an error is returned and the original +file is not deleted. The operation of @command{zupdate} is meant to be safe +and not cause any data loss. Therefore, existing lzip compressed files are +never overwritten nor deleted. Recompressing files from a read-only file system to another place can be done by first linking the files from the destination directory and then compressing the links: @w{@samp{ln -s /src/foo.gz . && zupdate foo.gz}} -Combining the options @samp{--force} and @samp{--keep}, as in +Combining the options @option{--force} and @option{--keep}, as in @w{@samp{zupdate -f -k *.gz}}, verifies that there are no differences between each pair of files in a multiformat set of files. @@ -857,20 +919,20 @@ The names of the original files must have one of the following extensions:@* recompressed to @samp{.lz};@* @samp{.tbz}, @samp{.tbz2}, @samp{.tgz}, @samp{.txz}, or @samp{.tzst}, which are recompressed to @samp{.tlz}.@* -Keeping the combined extensions (@samp{.tgz} --> @samp{.tlz}) may be useful -when recompressing Slackware packages, for example. +Keeping the combined extensions @w{(@samp{.tgz} --> @samp{.tlz})} may be +useful when recompressing Slackware packages, for example. Bzip2, gzip, and lzip are the primary formats. Xz and zstd are optional. If the decompressor for the xz or zstd formats is not found, the corresponding files are ignored. -Recompressing a file is much like copying or moving it. Therefore zupdate -preserves the access and modification dates, permissions, and, if you have -appropriate privileges, ownership of the file just as @w{@samp{cp -p}} does. -(If the user ID or the group ID can't be duplicated, the file permission -bits S_ISUID and S_ISGID are cleared). +Recompressing a file is much like copying or moving it. Therefore +@command{zupdate} preserves the access and modification dates, permissions, +and, if you have appropriate privileges, ownership of the file just as +@w{@samp{cp -p}} does. (If the user ID or the group ID can't be duplicated, +the file permission bits S_ISUID and S_ISGID are cleared). -The format for running zupdate is: +The format for running @command{zupdate} is: @example zupdate [@var{options}] [@var{files}] @@ -880,12 +942,29 @@ zupdate [@var{options}] [@var{files}] Exit status is 0 if all the compressed files were successfully recompressed (if needed), compared, and deleted (if requested). 1 if a non-fatal error occurred (file not found or not regular, or has invalid format, or can't be -deleted). 2 if a fatal error occurred (compressor can't be run, or -comparison fails). +deleted). 2 if a fatal error occurred (invalid command line options, +compressor can't be run, or comparison fails). -zupdate supports the following options: +@command{zupdate} supports the following options: @table @code +@item -d @var{dir} +@itemx --destdir=@var{dir} +Write recompressed files to another directory, using @var{dir} as base +directory, instead of writing them in the same directory as the original +files. In recursive mode, this is done by replacing each directory specified +in the command line with @var{dir} to produce the recompressed file names. +For example, @w{@samp{zupdate -r -d @var{dir} ../a}} recompresses a file +named @file{../a/b/c.gz} to @file{@var{dir}/b/c.lz}. Regular files specified +in the command line are recompressed directly into @var{dir}. For example, +@w{@samp{zupdate -d @var{dir} ../a/b/c.gz}} writes the recompressed file to +@file{@var{dir}/c.lz}. + +This option allows recompressing files from a read-only file system to +another place without the need to copy or link them to the destination +directory first. (Remember to use option @option{--keep} when recompressing +read-only files to avoid warnings about files that can't be deleted). + @item -e @itemx --expand-extensions Expand combined file name extensions; recompress @samp{.tbz}, @samp{.tbz2}, @@ -894,7 +973,7 @@ Expand combined file name extensions; recompress @samp{.tbz}, @samp{.tbz2}, @item -f @itemx --force Don't skip a file for which a lzip compressed version already exists. -@samp{--force} compares the content of the input file with the content +@option{--force} compares the content of the input file with the content of the existing lzip file and deletes the input file if both contents are identical. @@ -908,10 +987,10 @@ Keep (don't delete) the input file after comparing it with the lzip file. @item -l @itemx --lzip-verbose -Pass one option @samp{-v} to the lzip compressor so that it shows the +Pass one option @option{-v} to the lzip compressor so that it shows the compression ratio for each file processed. Using lzip 1.15 or newer, a -second @samp{-l} shows the progress of compression. Use it together with -@samp{-v} to see the name of the file. +second @option{-l} shows the progress of compression. Use it together with +@option{-v} to see the name of the file. @item -q @itemx --quiet @@ -930,13 +1009,30 @@ recursively, following all symbolic links. @item -v @itemx --verbose -Verbose mode. Show the files being processed. A second @samp{-v} also -shows the files being ignored. +Verbose mode. Show the files being processed. A second @option{-v} also shows +the files being ignored and increases the verbosity level. @xref{version}. @item -0 .. -9 -Set the compression level of lzip. By default zupdate passes @samp{-9} to -lzip. Custom compression options can be passed to lzip with the option -@samp{--lz}. For example @w{@samp{--lz='lzip -9 -s64MiB'}}. +Set the compression level of lzip. By default @command{zupdate} passes +@option{-9} to lzip. Custom compression options can be passed to lzip with +the option @option{--lz}. For example @w{@option{--lz='lzip -9 -s64MiB'}}. + +@anchor{lz-compressor} +@item --lz=@var{command} +Set compression command. @var{command} may include arguments. For example +@w{@option{--lz='plzip --threads=2'}}. The name of the program can't begin +with @samp{-}. This option overrides the value set in @file{zutils.conf}. +The compression program used does not need to implement decompression +(@pxref{compressor-requirements}), but it must implement at least the +compression level option @option{-9} and the option @w{@option{-o @var{file}}} +to write the compressed output to @var{file}. +@uref{http://www.nongnu.org/lzip/manual/tarlz_manual.html,,tarlz} meets +these requirements, and therefore can be used to recompress POSIX tar +archives by using a command like +@w{@samp{zupdate --lz='tarlz -9 -z --no-solid' archive.tar.gz}}. +@ifnothtml +@xref{Top,tarlz manual,,tarlz}. +@end ifnothtml @end table |