Merging upstream version 1.9.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
3e7d50525b
commit
13941d3cbe
30 changed files with 1188 additions and 1060 deletions
109
ChangeLog
109
ChangeLog
|
@ -1,9 +1,25 @@
|
|||
2020-06-27 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
* Version 1.9 released.
|
||||
* zcmp.cc zdiff.cc: Read standard input only if requested.
|
||||
* zdiff.cc (main): Pass options '-W' and '-y' to diff.
|
||||
* zutils.cc (test_format): Detect bzip2 and lzip files better.
|
||||
* ztest.cc (main): Continue testing if any input file is a terminal.
|
||||
If verbosity >= 1, print number of files that failed the test.
|
||||
* zcat.cc zgrep.cc ztest.cc (main): Check return value of close( infd ).
|
||||
* zutils.cc (good_status): Ignore trailing data remaining in feeder.
|
||||
* zupdate.cc (zupdate_file): Support new and old lzip option '-o'.
|
||||
Keep combined extensions: tgz, tbz, tbz2, txz --> tlz.
|
||||
Quote file names in zcmp_command to allow file names with spaces.
|
||||
* *.cc (main): Set a valid invocation_name even if argc == 0.
|
||||
* zutils.texi: Improve descriptions of zcat, zcmp, and zdiff.
|
||||
|
||||
2019-01-01 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
* Version 1.8 released.
|
||||
* zcat.cc: Fixed a buffer overflow on outbuf when '-v' is used.
|
||||
* zcat.cc: Fix a buffer overflow on outbuf when '-v' is used.
|
||||
* zcat.cc (cat): A canary byte has been added to outbuf.
|
||||
* Added new option '-R, --dereference-recursive'.
|
||||
* New option '-R, --dereference-recursive'.
|
||||
* Option '-r, --recursive' now skips symlinks.
|
||||
* If no files and recursive, examine current working directory.
|
||||
* recursive.cc (test_full_name): Detect directory loops.
|
||||
|
@ -11,21 +27,21 @@
|
|||
* recursive.cc: Remove extra trailing slashes from directory args.
|
||||
* zcatgrep.cc (open_instream): Show correct errno.
|
||||
* zutils.cc (good_status): Wait for killed child.
|
||||
* Test and document continuation or exit of zcat, zgrep, ztest
|
||||
* Test and document continuation or exit of zcat, zgrep, ztest,
|
||||
and zupdate in case of error.
|
||||
* configure: Accept appending to CXXFLAGS, 'CXXFLAGS+=OPTIONS'.
|
||||
|
||||
2018-02-13 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
* Version 1.7 released.
|
||||
* zgrep.cc (main): Pass '--color' option to grep.
|
||||
* check.sh: Added new tests for zgrep.
|
||||
* zgrep.cc (main): Pass option '--color' to grep.
|
||||
* check.sh: Add new tests for zgrep.
|
||||
|
||||
2017-04-05 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
* Version 1.6 released.
|
||||
* zcmp.cc: Accept 'B' suffix in '--ignore-initial=1kB:1234B'.
|
||||
* zutils.cc (feed_data): Show input filename in error messages.
|
||||
* zutils.cc (feed_data): Show input file name in error messages.
|
||||
|
||||
2016-05-15 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
|
@ -41,124 +57,123 @@
|
|||
|
||||
* Version 1.4 released.
|
||||
* Option '--format' has been renamed to '-O, --force-format'.
|
||||
* Added new option '-M, --format=<list>' to all utilities.
|
||||
* Add new option '-M, --format=<list>' to all utilities.
|
||||
* zgrep.cc (main): Pass '-e' to grep if pattern begins with '-'.
|
||||
* Makefile.in: Added new targets 'install*-compress'.
|
||||
* Makefile.in: New targets 'install*-compress'.
|
||||
|
||||
2014-08-30 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
* Version 1.3 released.
|
||||
* check.sh: Fixed two values of expected exit status.
|
||||
* zutils.texi: Documented that '--format' does not verify format.
|
||||
* Added two missing #includes.
|
||||
* License changed to GPL version 2 or later.
|
||||
* check.sh: Fix two values of expected exit status.
|
||||
* zutils.texi: Document that '--format' does not verify format.
|
||||
* Add two missing #includes.
|
||||
* Change license to GPL version 2 or later.
|
||||
|
||||
2014-02-01 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
* Version 1.2 released.
|
||||
* Added new utility; zupdate.
|
||||
* Removed zutils executable. Utils are now independent executables.
|
||||
* zgrep.cc: Fixed the exit status returned on error.
|
||||
* zutils.texinfo: Renamed to zutils.texi.
|
||||
* New utility; zupdate.
|
||||
* Remove zutils executable. Utils are now independent executables.
|
||||
* zgrep.cc: Fix the exit status returned on error.
|
||||
* zutils.texinfo: Rename to zutils.texi.
|
||||
|
||||
2013-08-02 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
* Version 1.1 released.
|
||||
* Added options '--bz2', '--gz', '--lz' and '--xz' to all utilities.
|
||||
* Added runtime configuration file 'zutilsrc'.
|
||||
* Add options '--bz2', '--gz', '--lz', and '--xz' to all utilities.
|
||||
* Add runtime configuration file 'zutilsrc'.
|
||||
* New function 'good_status' checks exit status of all children.
|
||||
* Fixed all uses of decompressed/uncompressed in the documentation.
|
||||
* Fix all uses of decompressed/uncompressed in the documentation.
|
||||
|
||||
2013-05-31 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
* Version 1.0 released.
|
||||
* Added new option '--format' to all utilities.
|
||||
* Add new option '--format' to all utilities.
|
||||
* main.cc (main): Make 'grep_show_name' tri-state so that file
|
||||
name is no prefixed to output by default when searching one
|
||||
file and '--recursive' has not been selected.
|
||||
* Zgrep: Fixed output of option '-L' (it behaved like '-l').
|
||||
* zcmp.cc: Fixed deadlock when '-n' option is used.
|
||||
* zdiff.cc (set_data_feeder): Call compressor with option "-q"
|
||||
* Zgrep: Fix output of option '-L' (it behaved like '-l').
|
||||
* zcmp.cc: Fix deadlock when option '-n' is used.
|
||||
* zdiff.cc (set_data_feeder): Call compressor with option '-q'
|
||||
only if verbosity < 0.
|
||||
* zutils.cc (set_data_feeder): Likewise.
|
||||
* Changed quote characters in messages as advised by GNU Standards.
|
||||
* Change quote characters in messages as advised by GNU Standards.
|
||||
* configure: Options now accept a separate argument.
|
||||
* configure: 'datadir' renamed to 'datarootdir'.
|
||||
* Makefile.in: Added new target 'install-bin'.
|
||||
Rename 'datadir' to 'datarootdir'. Ignore environment variables.
|
||||
* Makefile.in: New target 'install-bin'.
|
||||
* Use 'setmode' instead of '_setmode' on Windows and OS/2.
|
||||
* zcat.cc (Line_number): Fixed a portability issue with Solaris 9.
|
||||
* zcat.cc (Line_number): Fix a portability issue with Solaris 9.
|
||||
* INSTALL: Document installing zutils along with GNU gzip.
|
||||
|
||||
2011-01-11 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||
|
||||
* Version 0.9 released.
|
||||
* configure: Added new options 'DIFF' and 'GREP'.
|
||||
* zcmp.cc: Fixed deadlock when files differ.
|
||||
* zgrep.cc: Fixed deadlock when binary file matches.
|
||||
* configure: New options 'DIFF' and 'GREP'.
|
||||
* zcmp.cc: Fix deadlock when files differ.
|
||||
* zgrep.cc: Fix deadlock when binary file matches.
|
||||
|
||||
2010-11-15 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||
|
||||
* Version 0.8 released.
|
||||
* main.cc: Added new options '--zcat', '--zgrep' and '--ztest'.
|
||||
* main.cc: New options '--zcat', '--zgrep', and '--ztest'.
|
||||
* zcat.cc: New file implementing zcat+cat functionality in C++.
|
||||
* zcmp.cc: New file implementing zcmp+cmp functionality in C++.
|
||||
* doc/zcmp.1: New file.
|
||||
* zcmp.in: Removed.
|
||||
* Remove files zcmp.in, zdiff.in.
|
||||
* zdiff.cc: New file implementing zdiff functionality in C++.
|
||||
* zdiff.in: Removed.
|
||||
* zgrep.cc: New file implementing zgrep functionality in C++.
|
||||
* All mentions to zegrep and zfgrep have been removed from the
|
||||
documentation because egrep and fgrep are deprecated.
|
||||
* ztest.cc: New file implementing ztest functionality in C++.
|
||||
* Makefile.in: Added quotes to directory names.
|
||||
* Makefile.in: Add quotes to directory names.
|
||||
* check.sh: Use 'test.txt' instead of 'COPYING' for testing.
|
||||
* Removed environment safeguards from configure as requested by
|
||||
* Remove environment safeguards from configure as requested by
|
||||
Richard Stallman. Now environment variables affect configure.
|
||||
|
||||
2009-10-21 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||
|
||||
* Version 0.7 released.
|
||||
* Added new utility; ztest.
|
||||
* zcat.in: Added new option '--recursive'.
|
||||
* New utility; ztest.
|
||||
* zcat.in: New option '-r, --recursive'.
|
||||
|
||||
2009-10-05 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||
|
||||
* Version 0.6 released.
|
||||
* zcat.in, zgrep.in: Removed again default compressor. Format of
|
||||
* zcat.in, zgrep.in: Remove again default compressor. Format of
|
||||
data read from stdin is now automatically detected.
|
||||
* Makefile.in: Added '--name' option to help2man invocation.
|
||||
* Makefile.in: Add option '--name' to help2man invocation.
|
||||
|
||||
2009-10-01 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||
|
||||
* Version 0.5 released.
|
||||
* zcat.in, zgrep.in: Read again data from stdin.
|
||||
* Added again default compressor for stdin only.
|
||||
* Add again default compressor for stdin only.
|
||||
|
||||
2009-09-17 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||
|
||||
* Version 0.4 released.
|
||||
* Added two new utilities; zegrep and zfgrep.
|
||||
* Added zutils executable which recognizes file formats.
|
||||
* Add two new utilities; zegrep and zfgrep.
|
||||
* Add zutils executable which recognizes file formats.
|
||||
|
||||
2009-08-28 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||
|
||||
* Version 0.3 released.
|
||||
* Removed default compressor.
|
||||
* Remove default compressor.
|
||||
* zcat.in, zgrep.in: Don't read data from stdin.
|
||||
* Updated home page and mailing list addresses.
|
||||
* Update home page and mailing list addresses.
|
||||
|
||||
2009-08-13 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||
|
||||
* Version 0.2 released.
|
||||
* Added support for xz.
|
||||
* Add support for xz.
|
||||
|
||||
2009-08-07 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||
|
||||
* Version 0.1 released.
|
||||
|
||||
|
||||
Copyright (C) 2009-2019 Antonio Diaz Diaz.
|
||||
Copyright (C) 2009-2020 Antonio Diaz Diaz.
|
||||
|
||||
This file is a collection of facts, and thus it is not copyrightable,
|
||||
but just in case, you have unlimited permission to copy, distribute and
|
||||
but just in case, you have unlimited permission to copy, distribute, and
|
||||
modify it.
|
||||
|
|
22
INSTALL
22
INSTALL
|
@ -1,7 +1,7 @@
|
|||
Requirements
|
||||
------------
|
||||
You will need a C++ compiler.
|
||||
I use gcc 5.3.0 and 4.1.2, but the code should compile with any standards
|
||||
You will need a C++11 compiler. (gcc 3.3.6 or newer is recommended).
|
||||
I use gcc 6.1.0 and 4.1.2, but the code should compile with any standards
|
||||
compliant compiler.
|
||||
Gcc is available at http://gcc.gnu.org.
|
||||
|
||||
|
@ -44,21 +44,21 @@ the main archive.
|
|||
documentation.
|
||||
|
||||
Or type 'make install-compress', which additionally compresses the
|
||||
info manual and the man pages after installation. (Installing
|
||||
compressed docs may become the default in the future).
|
||||
info manual and the man pages after installation.
|
||||
(Installing compressed docs may become the default in the future).
|
||||
|
||||
You can install only the programs, the info manual or the man pages by
|
||||
typing 'make install-bin', 'make install-info' or 'make install-man'
|
||||
You can install only the programs, the info manual, or the man pages by
|
||||
typing 'make install-bin', 'make install-info', or 'make install-man'
|
||||
respectively.
|
||||
|
||||
|
||||
Another way
|
||||
-----------
|
||||
You can also compile zutils into a separate directory.
|
||||
To do this, you must use a version of 'make' that supports the 'VPATH'
|
||||
variable, such as GNU 'make'. 'cd' to the directory where you want the
|
||||
To do this, you must use a version of 'make' that supports the variable
|
||||
'VPATH', such as GNU 'make'. 'cd' to the directory where you want the
|
||||
object files and executables to go and run the 'configure' script.
|
||||
'configure' automatically checks for the source code in '.', in '..' and
|
||||
'configure' automatically checks for the source code in '.', in '..', and
|
||||
in the directory that 'configure' is in.
|
||||
|
||||
'configure' recognizes the option '--srcdir=DIR' to control where to
|
||||
|
@ -69,7 +69,7 @@ After running 'configure', you can run 'make' and 'make install' as
|
|||
explained above.
|
||||
|
||||
|
||||
Copyright (C) 2009-2019 Antonio Diaz Diaz.
|
||||
Copyright (C) 2009-2020 Antonio Diaz Diaz.
|
||||
|
||||
This file is free documentation: you have unlimited permission to copy,
|
||||
distribute and modify it.
|
||||
distribute, and modify it.
|
||||
|
|
|
@ -135,8 +135,8 @@ install-bin : all
|
|||
$(INSTALL_PROGRAM) ./ztest "$(DESTDIR)$(bindir)/ztest"
|
||||
$(INSTALL_PROGRAM) ./zupdate "$(DESTDIR)$(bindir)/zupdate"
|
||||
if [ ! -e "$(DESTDIR)$(sysconfdir)/$(pkgname)rc" ] ; then \
|
||||
if [ ! -d "$(DESTDIR)$(sysconfdir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(sysconfdir)" ; fi ; \
|
||||
$(INSTALL_DATA) $(VPATH)/$(pkgname)rc "$(DESTDIR)$(sysconfdir)/$(pkgname)rc" ; \
|
||||
if [ ! -d "$(DESTDIR)$(sysconfdir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(sysconfdir)" ; fi ; \
|
||||
$(INSTALL_DATA) $(VPATH)/$(pkgname)rc "$(DESTDIR)$(sysconfdir)/$(pkgname)rc" ; \
|
||||
fi
|
||||
|
||||
install-bin-strip : all
|
||||
|
@ -147,7 +147,7 @@ install-info :
|
|||
-rm -f "$(DESTDIR)$(infodir)/$(pkgname).info"*
|
||||
$(INSTALL_DATA) $(VPATH)/doc/$(pkgname).info "$(DESTDIR)$(infodir)/$(pkgname).info"
|
||||
-if $(CAN_RUN_INSTALLINFO) ; then \
|
||||
install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$(pkgname).info" ; \
|
||||
install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$(pkgname).info" ; \
|
||||
fi
|
||||
|
||||
install-info-compress : install-info
|
||||
|
@ -191,7 +191,7 @@ uninstall-bin :
|
|||
|
||||
uninstall-info :
|
||||
-if $(CAN_RUN_INSTALLINFO) ; then \
|
||||
install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$(pkgname).info" ; \
|
||||
install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$(pkgname).info" ; \
|
||||
fi
|
||||
-rm -f "$(DESTDIR)$(infodir)/$(pkgname).info"*
|
||||
|
||||
|
|
52
NEWS
52
NEWS
|
@ -1,38 +1,36 @@
|
|||
Changes in version 1.8:
|
||||
Changes in version 1.9:
|
||||
|
||||
A buffer overflow has been fixed in zcat which happened sometimes when
|
||||
the '-v, --show-nonprinting' option was used (or indirectly enabled).
|
||||
A canary byte has been added to the output buffer to prevent the buffer
|
||||
overflow from happening again.
|
||||
zcmp anf zdiff now meet the POSIX requirement for cmp and diff that the
|
||||
standard input shall be used only if the file1 or file2 operand refers to
|
||||
standard input.
|
||||
|
||||
The option '-R, --dereference-recursive', which recursively follows
|
||||
symbolic links, has been added to zcat, zgrep, ztest and zupdate.
|
||||
zdiff now passes the options '-W' and '-y' to diff. (But it only works if
|
||||
the diff program used supports them).
|
||||
|
||||
The option '-r, --recursive' now skips symlinks that are encountered
|
||||
recursively.
|
||||
Bzip2 and lzip files are now detected better.
|
||||
('echo LZIP | zcat' and 'echo BZh5 | zcat' no longer return an error).
|
||||
|
||||
If no files are given to zcat, zgrep, ztest and zupdate, a recursive
|
||||
search will now examine the current working directory.
|
||||
ztest now continues checking the rest of the files if any input file is a
|
||||
terminal.
|
||||
|
||||
Recursive directory loops are now detected.
|
||||
'ztest -v' now prints the number of files that failed the test (like lzip).
|
||||
|
||||
zcat and zgrep now ignore directories given in the command line if
|
||||
'--recursive' is not specified, instead of reporting an error.
|
||||
zcat, zgrep, and ztest now check for errors when closing the input file in
|
||||
addition to checking when closing the input from the decompressor.
|
||||
|
||||
Extra trailing slashes are now removed from directories given in the
|
||||
command line before recursing into them.
|
||||
Trailing data remaining in the data feeder to the decompressor are now
|
||||
correctly ignored.
|
||||
|
||||
zcat and zgrep now show the right error when they can't open an input
|
||||
file instead of showing "No such file or directory".
|
||||
zupdate has been modified to support the new behavior of lzip 1.22's option
|
||||
'-o' while retaining:
|
||||
perfect backwards compatibility with older versions of lzip down to 1.20,
|
||||
good backwards compatibility with older versions of lzip down to 1.11,
|
||||
acceptable backwards compatibility with older versions of lzip down to 1.4.
|
||||
|
||||
Killed decompressors are now waited for, preventing failure caused by
|
||||
too many open pipes.
|
||||
zupdate now keeps combined extensions: tgz, tbz, tbz2, txz --> tlz.
|
||||
This is useful when recompressing Slackware packages, for example.
|
||||
|
||||
Test and document that if a file fails to decompress, zcat, zgrep and
|
||||
ztest continue processing the rest of the files.
|
||||
zupdate now puts single quotes around file names when calling zcmp to allow
|
||||
file names with spaces. (But putting spaces in file names is a bad idea).
|
||||
|
||||
Test and document that if an error happens while recompressing a file,
|
||||
zupdate exits immediately without recompressing the rest of the files.
|
||||
|
||||
The configure script now accepts appending options to CXXFLAGS using the
|
||||
syntax 'CXXFLAGS+=OPTIONS'.
|
||||
The descriptions of zcat, zcmp, and zdiff have been improved.
|
||||
|
|
44
README
44
README
|
@ -1,46 +1,46 @@
|
|||
Description
|
||||
|
||||
Zutils is a collection of utilities able to process any combination of
|
||||
compressed and uncompressed files transparently. If any given file,
|
||||
including standard input, is compressed, its decompressed content is
|
||||
used. Compressed files are decompressed on the fly; no temporary files
|
||||
are created.
|
||||
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.
|
||||
|
||||
These utilities are not wrapper scripts but safer and more efficient C++
|
||||
programs. In particular the '--recursive' option is very efficient in
|
||||
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 formats supported are bzip2, gzip, lzip and xz.
|
||||
Zutils uses external compressors. The compressor to be used for each
|
||||
format is configurable at runtime.
|
||||
The utilities provided are zcat, zcmp, zdiff, zgrep, ztest, and zupdate.
|
||||
The formats supported are bzip2, gzip, lzip, and xz.
|
||||
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 values, making them less reliable back ends for zutils.
|
||||
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
|
||||
values, making them less reliable back ends for zutils.
|
||||
|
||||
FORMAT NOTE 1: The '--format' option allows the processing of a subset
|
||||
FORMAT NOTE 1: The option '--format' allows the processing of a subset
|
||||
of formats in recursive mode and when trying compressed file names:
|
||||
'zgrep foo -r --format=bz2,lz somedir somefile.tar'.
|
||||
|
||||
FORMAT NOTE 2: If the '--force-format' option is given, the files are
|
||||
FORMAT NOTE 2: If the option '--force-format' is given, the files are
|
||||
passed to the corresponding decompressor without verifying their format,
|
||||
allowing for example the processing of compress'd (.Z) files with gzip:
|
||||
'zcmp --force-format=gz file.Z file.lz'.
|
||||
|
||||
LANGUAGE NOTE: Uncompressed = not compressed = plain data; it may never
|
||||
have been compressed. Decompressed is used to refer to data which have
|
||||
undergone the process of decompression.
|
||||
LANGUAGE NOTE: Uncompressed = not compressed = plain data; it may never have
|
||||
been compressed. Decompressed is used to refer to data which have undergone
|
||||
the process of decompression.
|
||||
|
||||
|
||||
Copyright (C) 2009-2019 Antonio Diaz Diaz.
|
||||
Copyright (C) 2009-2020 Antonio Diaz Diaz.
|
||||
|
||||
This file is free documentation: you have unlimited permission to copy,
|
||||
distribute and modify it.
|
||||
distribute, and modify it.
|
||||
|
||||
The file Makefile.in is a data file used by configure to produce the
|
||||
Makefile. It has the same copyright owner and permissions that configure
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
/* Arg_parser - POSIX/GNU command line argument parser. (C++ version)
|
||||
Copyright (C) 2006-2019 Antonio Diaz Diaz.
|
||||
/* Arg_parser - POSIX/GNU command line argument parser. (C++ version)
|
||||
Copyright (C) 2006-2020 Antonio Diaz Diaz.
|
||||
|
||||
This library is free software. Redistribution and use in source and
|
||||
binary forms, with or without modification, are permitted provided
|
||||
that the following conditions are met:
|
||||
This library is free software. Redistribution and use in source and
|
||||
binary forms, with or without modification, are permitted provided
|
||||
that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions, and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions, and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
|
@ -167,7 +167,7 @@ Arg_parser::Arg_parser( const int argc, const char * const argv[],
|
|||
else non_options.push_back( argv[argind++] );
|
||||
}
|
||||
}
|
||||
if( error_.size() ) data.clear();
|
||||
if( !error_.empty() ) data.clear();
|
||||
else
|
||||
{
|
||||
for( unsigned i = 0; i < non_options.size(); ++i )
|
||||
|
@ -190,7 +190,7 @@ Arg_parser::Arg_parser( const char * const opt, const char * const arg,
|
|||
{ if( opt[2] ) parse_long_option( opt, arg, options, argind ); }
|
||||
else
|
||||
parse_short_option( opt, arg, options, argind );
|
||||
if( error_.size() ) data.clear();
|
||||
if( !error_.empty() ) data.clear();
|
||||
}
|
||||
else data.push_back( Record( opt ) );
|
||||
}
|
||||
|
|
69
arg_parser.h
69
arg_parser.h
|
@ -1,43 +1,43 @@
|
|||
/* Arg_parser - POSIX/GNU command line argument parser. (C++ version)
|
||||
Copyright (C) 2006-2019 Antonio Diaz Diaz.
|
||||
/* Arg_parser - POSIX/GNU command line argument parser. (C++ version)
|
||||
Copyright (C) 2006-2020 Antonio Diaz Diaz.
|
||||
|
||||
This library is free software. Redistribution and use in source and
|
||||
binary forms, with or without modification, are permitted provided
|
||||
that the following conditions are met:
|
||||
This library is free software. Redistribution and use in source and
|
||||
binary forms, with or without modification, are permitted provided
|
||||
that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions, and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions, and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* Arg_parser reads the arguments in 'argv' and creates a number of
|
||||
option codes, option arguments and non-option arguments.
|
||||
/* Arg_parser reads the arguments in 'argv' and creates a number of
|
||||
option codes, option arguments, and non-option arguments.
|
||||
|
||||
In case of error, 'error' returns a non-empty error message.
|
||||
In case of error, 'error' returns a non-empty error message.
|
||||
|
||||
'options' is an array of 'struct Option' terminated by an element
|
||||
containing a code which is zero. A null name means a short-only
|
||||
option. A code value outside the unsigned char range means a
|
||||
long-only option.
|
||||
'options' is an array of 'struct Option' terminated by an element
|
||||
containing a code which is zero. A null name means a short-only
|
||||
option. A code value outside the unsigned char range means a
|
||||
long-only option.
|
||||
|
||||
Arg_parser normally makes it appear as if all the option arguments
|
||||
were specified before all the non-option arguments for the purposes
|
||||
of parsing, even if the user of your program intermixed option and
|
||||
non-option arguments. If you want the arguments in the exact order
|
||||
the user typed them, call 'Arg_parser' with 'in_order' = true.
|
||||
Arg_parser normally makes it appear as if all the option arguments
|
||||
were specified before all the non-option arguments for the purposes
|
||||
of parsing, even if the user of your program intermixed option and
|
||||
non-option arguments. If you want the arguments in the exact order
|
||||
the user typed them, call 'Arg_parser' with 'in_order' = true.
|
||||
|
||||
The argument '--' terminates all options; any following arguments are
|
||||
treated as non-option arguments, even if they begin with a hyphen.
|
||||
The argument '--' terminates all options; any following arguments are
|
||||
treated as non-option arguments, even if they begin with a hyphen.
|
||||
|
||||
The syntax for optional option arguments is '-<short_option><argument>'
|
||||
(without whitespace), or '--<long_option>=<argument>'.
|
||||
The syntax for optional option arguments is '-<short_option><argument>'
|
||||
(without whitespace), or '--<long_option>=<argument>'.
|
||||
*/
|
||||
|
||||
class Arg_parser
|
||||
|
@ -61,6 +61,7 @@ private:
|
|||
explicit Record( const char * const arg ) : code( 0 ), argument( arg ) {}
|
||||
};
|
||||
|
||||
const std::string empty_arg;
|
||||
std::string error_;
|
||||
std::vector< Record > data;
|
||||
|
||||
|
@ -73,17 +74,17 @@ public:
|
|||
Arg_parser( const int argc, const char * const argv[],
|
||||
const Option options[], const bool in_order = false );
|
||||
|
||||
// Restricted constructor. Parses a single token and argument (if any)
|
||||
// Restricted constructor. Parses a single token and argument (if any).
|
||||
Arg_parser( const char * const opt, const char * const arg,
|
||||
const Option options[] );
|
||||
|
||||
const std::string & error() const { return error_; }
|
||||
|
||||
// The number of arguments parsed (may be different from argc)
|
||||
// The number of arguments parsed. May be different from argc.
|
||||
int arguments() const { return data.size(); }
|
||||
|
||||
// If code( i ) is 0, argument( i ) is a non-option.
|
||||
// Else argument( i ) is the option's argument (or empty).
|
||||
/* If code( i ) is 0, argument( i ) is a non-option.
|
||||
Else argument( i ) is the option's argument (or empty). */
|
||||
int code( const int i ) const
|
||||
{
|
||||
if( i >= 0 && i < arguments() ) return data[i].code;
|
||||
|
@ -93,6 +94,6 @@ public:
|
|||
const std::string & argument( const int i ) const
|
||||
{
|
||||
if( i >= 0 && i < arguments() ) return data[i].argument;
|
||||
else return error_;
|
||||
else return empty_arg;
|
||||
}
|
||||
};
|
||||
|
|
25
configure
vendored
25
configure
vendored
|
@ -1,12 +1,12 @@
|
|||
#! /bin/sh
|
||||
# configure script for Zutils - Utilities dealing with compressed files
|
||||
# Copyright (C) 2009-2019 Antonio Diaz Diaz.
|
||||
# Copyright (C) 2009-2020 Antonio Diaz Diaz.
|
||||
#
|
||||
# This configure script is free software: you have unlimited permission
|
||||
# to copy, distribute and modify it.
|
||||
# to copy, distribute, and modify it.
|
||||
|
||||
pkgname=zutils
|
||||
pkgversion=1.8
|
||||
pkgversion=1.9
|
||||
srctrigger=doc/${pkgname}.texi
|
||||
|
||||
# clear some things potentially inherited from environment.
|
||||
|
@ -28,11 +28,7 @@ DIFF=diff
|
|||
GREP=grep
|
||||
|
||||
# checking whether we are using GNU C++.
|
||||
/bin/sh -c "${CXX} --version" > /dev/null 2>&1 ||
|
||||
{
|
||||
CXX=c++
|
||||
CXXFLAGS=-O2
|
||||
}
|
||||
/bin/sh -c "${CXX} --version" > /dev/null 2>&1 || { CXX=c++ ; CXXFLAGS=-O2 ; }
|
||||
|
||||
# Loop over all args
|
||||
args=
|
||||
|
@ -44,11 +40,12 @@ while [ $# != 0 ] ; do
|
|||
shift
|
||||
|
||||
# Add the argument quoted to args
|
||||
args="${args} \"${option}\""
|
||||
if [ -z "${args}" ] ; then args="\"${option}\""
|
||||
else args="${args} \"${option}\"" ; fi
|
||||
|
||||
# Split out the argument for options that take them
|
||||
case ${option} in
|
||||
*=*) optarg=`echo ${option} | sed -e 's,^[^=]*=,,;s,/$,,'` ;;
|
||||
*=*) optarg=`echo "${option}" | sed -e 's,^[^=]*=,,;s,/$,,'` ;;
|
||||
esac
|
||||
|
||||
# Process the options
|
||||
|
@ -134,7 +131,7 @@ if [ -z "${srcdir}" ] ; then
|
|||
if [ ! -r "${srcdir}/${srctrigger}" ] ; then srcdir=.. ; fi
|
||||
if [ ! -r "${srcdir}/${srctrigger}" ] ; then
|
||||
## the sed command below emulates the dirname command
|
||||
srcdir=`echo $0 | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
srcdir=`echo "$0" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -157,7 +154,7 @@ if [ -z "${no_create}" ] ; then
|
|||
# Run this file to recreate the current configuration.
|
||||
#
|
||||
# This script is free software: you have unlimited permission
|
||||
# to copy, distribute and modify it.
|
||||
# to copy, distribute, and modify it.
|
||||
|
||||
exec /bin/sh $0 ${args} --no-create
|
||||
EOF
|
||||
|
@ -182,11 +179,11 @@ echo "GREP = ${GREP}"
|
|||
rm -f Makefile
|
||||
cat > Makefile << EOF
|
||||
# Makefile for Zutils - Utilities dealing with compressed files
|
||||
# Copyright (C) 2009-2019 Antonio Diaz Diaz.
|
||||
# Copyright (C) 2009-2020 Antonio Diaz Diaz.
|
||||
# This file was generated automatically by configure. Don't edit.
|
||||
#
|
||||
# This Makefile is free software: you have unlimited permission
|
||||
# to copy, distribute and modify it.
|
||||
# to copy, distribute, and modify it.
|
||||
|
||||
pkgname = ${pkgname}
|
||||
pkgversion = ${pkgversion}
|
||||
|
|
22
doc/zcat.1
22
doc/zcat.1
|
@ -1,27 +1,29 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
||||
.TH ZCAT "1" "January 2019" "zcat (zutils) 1.8" "User Commands"
|
||||
.TH ZCAT "1" "June 2020" "zcat (zutils) 1.9" "User Commands"
|
||||
.SH NAME
|
||||
zcat \- decompress and concatenate files to standard output
|
||||
.SH SYNOPSIS
|
||||
.B zcat
|
||||
[\fI\,options\/\fR] [\fI\,files\/\fR]
|
||||
.SH DESCRIPTION
|
||||
Zcat copies each given file to standard output. If any given file is
|
||||
compressed, its decompressed content is used. If a given file 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.
|
||||
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.
|
||||
.PP
|
||||
If a file is specified as '\-', data are read from standard input,
|
||||
decompressed if needed, and sent to standard output. Data read from
|
||||
standard input must be of the same type; all uncompressed or all in the
|
||||
same compression format.
|
||||
same compressed format.
|
||||
.PP
|
||||
If no files are specified, recursive searches examine the current
|
||||
working directory, and nonrecursive searches read standard input.
|
||||
.PP
|
||||
The formats supported are bzip2, gzip, lzip and xz.
|
||||
The formats supported are bzip2, gzip, lzip, and xz.
|
||||
.PP
|
||||
Exit status is 0 if no errors occurred, non\-zero otherwise.
|
||||
Exit status is 0 if no errors occurred, 1 otherwise.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
|
@ -52,7 +54,7 @@ number all output lines
|
|||
don't read runtime configuration file
|
||||
.TP
|
||||
\fB\-O\fR, \fB\-\-force\-format=\fR<fmt>
|
||||
force given format (bz2, gz, lz, xz)
|
||||
force the format given (bz2, gz, lz, xz)
|
||||
.TP
|
||||
\fB\-q\fR, \fB\-\-quiet\fR
|
||||
suppress all messages
|
||||
|
@ -94,7 +96,7 @@ Report bugs to zutils\-bug@nongnu.org
|
|||
.br
|
||||
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2019 Antonio Diaz Diaz.
|
||||
Copyright \(co 2020 Antonio Diaz Diaz.
|
||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||
.br
|
||||
This is free software: you are free to change and redistribute it.
|
||||
|
|
28
doc/zcmp.1
28
doc/zcmp.1
|
@ -1,31 +1,29 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
||||
.TH ZCMP "1" "January 2019" "zcmp (zutils) 1.8" "User Commands"
|
||||
.TH ZCMP "1" "June 2020" "zcmp (zutils) 1.9" "User Commands"
|
||||
.SH NAME
|
||||
zcmp \- decompress and compare two files byte by byte
|
||||
.SH SYNOPSIS
|
||||
.B zcmp
|
||||
[\fI\,options\/\fR] \fI\,file1 \/\fR[\fI\,file2\/\fR]
|
||||
.SH DESCRIPTION
|
||||
Zcmp compares two files ('\-' means standard input), and if they differ,
|
||||
tells the first byte and line number where they differ. Bytes and lines
|
||||
are numbered starting with 1. If any given file 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.
|
||||
.PP
|
||||
The formats supported are bzip2, gzip, lzip and xz.
|
||||
The formats supported are bzip2, gzip, lzip, and xz.
|
||||
.PP
|
||||
Zcmp compares file1 to file2. If file2 is omitted zcmp tries the
|
||||
zcmp 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
|
||||
following:
|
||||
.IP
|
||||
1. If file1 is compressed, compares its decompressed contents with
|
||||
\- If file1 is compressed, compares its decompressed contents with
|
||||
the corresponding uncompressed file (the name of file1 with the
|
||||
extension removed).
|
||||
.IP
|
||||
2. If file1 is uncompressed, compares it with the decompressed
|
||||
\- If file1 is uncompressed, compares it with the decompressed
|
||||
contents of file1.[lz|bz2|gz|xz] (the first one that is found).
|
||||
.IP
|
||||
3. If no suitable file is found, compares file1 with data read from
|
||||
standard input.
|
||||
.PP
|
||||
Exit status is 0 if inputs are identical, 1 if different, 2 if trouble.
|
||||
.SH OPTIONS
|
||||
|
@ -55,7 +53,7 @@ compare at most <n> bytes
|
|||
don't read runtime configuration file
|
||||
.TP
|
||||
\fB\-O\fR, \fB\-\-force\-format\fR=\fI\,[\/\fR<f1>][,<f2>]
|
||||
force given formats (bz2, gz, lz, xz)
|
||||
force the formats given (bz2, gz, lz, xz)
|
||||
.TP
|
||||
\fB\-q\fR, \fB\-\-quiet\fR
|
||||
suppress all messages
|
||||
|
@ -85,7 +83,7 @@ Report bugs to zutils\-bug@nongnu.org
|
|||
.br
|
||||
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2019 Antonio Diaz Diaz.
|
||||
Copyright \(co 2020 Antonio Diaz Diaz.
|
||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||
.br
|
||||
This is free software: you are free to change and redistribute it.
|
||||
|
|
35
doc/zdiff.1
35
doc/zdiff.1
|
@ -1,33 +1,32 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
||||
.TH ZDIFF "1" "January 2019" "zdiff (zutils) 1.8" "User Commands"
|
||||
.TH ZDIFF "1" "June 2020" "zdiff (zutils) 1.9" "User Commands"
|
||||
.SH NAME
|
||||
zdiff \- decompress and compare two files line by line
|
||||
.SH SYNOPSIS
|
||||
.B zdiff
|
||||
[\fI\,options\/\fR] \fI\,file1 \/\fR[\fI\,file2\/\fR]
|
||||
.SH DESCRIPTION
|
||||
Zdiff compares two files ('\-' means standard input), and if they
|
||||
differ, shows the differences line by line. If any given file is
|
||||
compressed, its decompressed content is used. Zdiff is a front end to
|
||||
the diff program and has the limitation that messages from diff refer to
|
||||
temporary filenames instead of those specified.
|
||||
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 that messages
|
||||
from diff refer to temporary file names instead of those specified.
|
||||
.PP
|
||||
The formats supported are bzip2, gzip, lzip and xz.
|
||||
The formats supported are bzip2, gzip, lzip, and xz.
|
||||
.PP
|
||||
Zdiff compares file1 to file2. If file2 is omitted zdiff tries the
|
||||
zdiff 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
|
||||
following:
|
||||
.IP
|
||||
1. If file1 is compressed, compares its decompressed contents with
|
||||
\- If file1 is compressed, compares its decompressed contents with
|
||||
the corresponding uncompressed file (the name of file1 with the
|
||||
extension removed).
|
||||
.IP
|
||||
2. If file1 is uncompressed, compares it with the decompressed
|
||||
\- If file1 is uncompressed, compares it with the decompressed
|
||||
contents of file1.[lz|bz2|gz|xz] (the first one that is found).
|
||||
.IP
|
||||
3. If no suitable file is found, compares file1 with data read from
|
||||
standard input.
|
||||
.PP
|
||||
Exit status is 0 if inputs are identical, 1 if different, 2 if trouble.
|
||||
Some options only work if the diff program used supports them.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
|
@ -67,7 +66,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 given formats (bz2, gz, lz, xz)
|
||||
force the formats given (bz2, gz, lz, xz)
|
||||
.TP
|
||||
\fB\-p\fR, \fB\-\-show\-c\-function\fR
|
||||
show which C function each change is in
|
||||
|
@ -93,6 +92,12 @@ same as \fB\-u\fR but use <n> lines of context
|
|||
\fB\-w\fR, \fB\-\-ignore\-all\-space\fR
|
||||
ignore all white space
|
||||
.TP
|
||||
\fB\-W\fR, \fB\-\-width=\fR<n>
|
||||
output at most <n> print columns
|
||||
.TP
|
||||
\fB\-y\fR, \fB\-\-side\-by\-side\fR
|
||||
output in two columns
|
||||
.TP
|
||||
\fB\-\-bz2=\fR<command>
|
||||
set compressor and options for bzip2 format
|
||||
.TP
|
||||
|
@ -109,7 +114,7 @@ Report bugs to zutils\-bug@nongnu.org
|
|||
.br
|
||||
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2019 Antonio Diaz Diaz.
|
||||
Copyright \(co 2020 Antonio Diaz Diaz.
|
||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||
.br
|
||||
This is free software: you are free to change and redistribute it.
|
||||
|
|
20
doc/zgrep.1
20
doc/zgrep.1
|
@ -1,29 +1,31 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
||||
.TH ZGREP "1" "January 2019" "zgrep (zutils) 1.8" "User Commands"
|
||||
.TH ZGREP "1" "June 2020" "zgrep (zutils) 1.9" "User Commands"
|
||||
.SH NAME
|
||||
zgrep \- search compressed files for a regular expression
|
||||
.SH SYNOPSIS
|
||||
.B zgrep
|
||||
[\fI\,options\/\fR] \fI\,<pattern> \/\fR[\fI\,files\/\fR]
|
||||
.SH DESCRIPTION
|
||||
Zgrep is a front end to the grep program that allows transparent search
|
||||
on any combination of compressed and uncompressed files. If any given
|
||||
file is compressed, its decompressed content is used. If a given file
|
||||
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.
|
||||
formats supported. If a file fails to decompress, zgrep continues
|
||||
searching the rest of the files.
|
||||
.PP
|
||||
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 be of the same type; all uncompressed or all in the same
|
||||
compression format.
|
||||
compressed format.
|
||||
.PP
|
||||
If no files are specified, recursive searches examine the current
|
||||
working directory, and nonrecursive searches read standard input.
|
||||
.PP
|
||||
The formats supported are bzip2, gzip, lzip and xz.
|
||||
The formats supported are bzip2, gzip, lzip, and xz.
|
||||
.PP
|
||||
Exit status is 0 if match, 1 if no match, 2 if trouble.
|
||||
Some options only work if the grep program used supports them.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-\-help\fR
|
||||
|
@ -99,7 +101,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 given format (bz2, gz, lz, xz)
|
||||
force the format given (bz2, gz, lz, xz)
|
||||
.TP
|
||||
\fB\-q\fR, \fB\-\-quiet\fR
|
||||
suppress all messages
|
||||
|
@ -144,7 +146,7 @@ Report bugs to zutils\-bug@nongnu.org
|
|||
.br
|
||||
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2019 Antonio Diaz Diaz.
|
||||
Copyright \(co 2020 Antonio Diaz Diaz.
|
||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||
.br
|
||||
This is free software: you are free to change and redistribute it.
|
||||
|
|
16
doc/ztest.1
16
doc/ztest.1
|
@ -1,20 +1,24 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
||||
.TH ZTEST "1" "January 2019" "ztest (zutils) 1.8" "User Commands"
|
||||
.TH ZTEST "1" "June 2020" "ztest (zutils) 1.9" "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 specified compressed files.
|
||||
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 compression format.
|
||||
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.
|
||||
.PP
|
||||
The formats supported are bzip2, gzip, lzip and xz.
|
||||
The formats supported are bzip2, gzip, lzip, and xz.
|
||||
.PP
|
||||
Note that error detection in the xz format is broken. First, some xz
|
||||
files lack integrity information. Second, not all xz decompressors can
|
||||
|
@ -41,7 +45,7 @@ process only the formats in <list>
|
|||
don't read runtime configuration file
|
||||
.TP
|
||||
\fB\-O\fR, \fB\-\-force\-format=\fR<fmt>
|
||||
force given format (bz2, gz, lz, xz)
|
||||
force the format given (bz2, gz, lz, xz)
|
||||
.TP
|
||||
\fB\-q\fR, \fB\-\-quiet\fR
|
||||
suppress all messages
|
||||
|
@ -71,7 +75,7 @@ Report bugs to zutils\-bug@nongnu.org
|
|||
.br
|
||||
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2019 Antonio Diaz Diaz.
|
||||
Copyright \(co 2020 Antonio Diaz Diaz.
|
||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||
.br
|
||||
This is free software: you are free to change and redistribute it.
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
||||
.TH ZUPDATE "1" "January 2019" "zupdate (zutils) 1.8" "User Commands"
|
||||
.TH ZUPDATE "1" "June 2020" "zupdate (zutils) 1.9" "User Commands"
|
||||
.SH NAME
|
||||
zupdate \- recompress bzip2, gzip, xz files to lzip format
|
||||
.SH SYNOPSIS
|
||||
.B zupdate
|
||||
[\fI\,options\/\fR] [\fI\,files\/\fR]
|
||||
.SH DESCRIPTION
|
||||
Zupdate recompresses files from bzip2, gzip, and xz formats to lzip
|
||||
zupdate recompresses files from bzip2, gzip, and xz 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
|
||||
|
@ -18,15 +18,18 @@ If no files are specified, recursive searches examine the current
|
|||
working directory, and nonrecursive searches do nothing.
|
||||
.PP
|
||||
If the lzip compressed version of a file already exists, the file is
|
||||
skipped unless the '\-\-force' option is given. In this case, if the
|
||||
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 safe and not produce any data loss. Therefore, existing lzip
|
||||
to be safe and not cause any data loss. Therefore, existing lzip
|
||||
compressed files are never overwritten nor deleted.
|
||||
.PP
|
||||
Exit status is 0 if all the compressed files were successfully
|
||||
recompressed (if needed), compared and deleted (if requested). Non\-zero
|
||||
otherwise.
|
||||
The names of the original files must have one of the following extensions:
|
||||
\&'.bz2', '.gz', and '.xz' are recompressed to '.lz'.
|
||||
\&'.tbz', '.tbz2', '.tgz', and '.txz' are recompressed to '.tlz'.
|
||||
.PP
|
||||
Exit status is 0 if all the compressed files were successfully recompressed
|
||||
(if needed), compared, and deleted (if requested). Non\-zero otherwise.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
|
@ -42,7 +45,7 @@ don't skip a file even if the .lz exists
|
|||
keep (don't delete) input files
|
||||
.TP
|
||||
\fB\-l\fR, \fB\-\-lzip\-verbose\fR
|
||||
pass a \fB\-v\fR option to the lzip compressor
|
||||
pass one option \fB\-v\fR to the lzip compressor
|
||||
.TP
|
||||
\fB\-M\fR, \fB\-\-format=\fR<list>
|
||||
process only the formats in <list>
|
||||
|
@ -81,7 +84,7 @@ Report bugs to zutils\-bug@nongnu.org
|
|||
.br
|
||||
Zutils home page: http://www.nongnu.org/zutils/zutils.html
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2019 Antonio Diaz Diaz.
|
||||
Copyright \(co 2020 Antonio Diaz Diaz.
|
||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||
.br
|
||||
This is free software: you are free to change and redistribute it.
|
||||
|
|
531
doc/zutils.info
531
doc/zutils.info
|
@ -1,5 +1,4 @@
|
|||
This is zutils.info, produced by makeinfo version 4.13+ from
|
||||
zutils.texi.
|
||||
This is zutils.info, produced by makeinfo version 4.13+ from zutils.texi.
|
||||
|
||||
INFO-DIR-SECTION Data Compression
|
||||
START-INFO-DIR-ENTRY
|
||||
|
@ -12,7 +11,7 @@ File: zutils.info, Node: Top, Next: Introduction, Up: (dir)
|
|||
Zutils Manual
|
||||
*************
|
||||
|
||||
This manual is for Zutils (version 1.8, 1 January 2019).
|
||||
This manual is for Zutils (version 1.9, 27 June 2020).
|
||||
|
||||
* Menu:
|
||||
|
||||
|
@ -29,10 +28,10 @@ This manual is for Zutils (version 1.8, 1 January 2019).
|
|||
* Concept index:: Index of concepts
|
||||
|
||||
|
||||
Copyright (C) 2009-2019 Antonio Diaz Diaz.
|
||||
Copyright (C) 2009-2020 Antonio Diaz Diaz.
|
||||
|
||||
This manual is free documentation: you have unlimited permission to
|
||||
copy, distribute and modify it.
|
||||
This manual is free documentation: you have unlimited permission to copy,
|
||||
distribute, and modify it.
|
||||
|
||||
|
||||
File: zutils.info, Node: Introduction, Next: Common options, Prev: Top, Up: Top
|
||||
|
@ -41,45 +40,45 @@ File: zutils.info, Node: Introduction, Next: Common options, Prev: Top, Up:
|
|||
**************
|
||||
|
||||
Zutils is a collection of utilities able to process any combination of
|
||||
compressed and uncompressed files transparently. If any given file,
|
||||
including standard input, is compressed, its decompressed content is
|
||||
used. Compressed files are decompressed on the fly; no temporary files
|
||||
are created.
|
||||
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.
|
||||
|
||||
These utilities are not wrapper scripts but safer and more efficient
|
||||
C++ programs. In particular the '--recursive' option is very efficient
|
||||
in those utilities supporting it.
|
||||
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 formats supported are bzip2, gzip, lzip and xz.
|
||||
Zutils uses external compressors. The compressor to be used for each
|
||||
format is configurable at runtime.
|
||||
The utilities provided are zcat, zcmp, zdiff, zgrep, ztest, and zupdate.
|
||||
The formats supported are bzip2, gzip, lzip, and xz.
|
||||
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.
|
||||
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 values, making them less reliable back ends for
|
||||
zutils. *Note compressor-requirements::.
|
||||
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
|
||||
values, making them less reliable back ends for zutils. *Note
|
||||
compressor-requirements::.
|
||||
|
||||
FORMAT NOTE 1: The '--format' option allows the processing of a
|
||||
subset of formats in recursive mode and when trying compressed file
|
||||
names: 'zgrep foo -r --format=bz2,lz somedir somefile.tar'.
|
||||
FORMAT NOTE 1: The option '--format' allows the processing of a subset
|
||||
of formats in recursive mode and when trying compressed file names:
|
||||
'zgrep foo -r --format=bz2,lz somedir somefile.tar'.
|
||||
|
||||
FORMAT NOTE 2: If the '--force-format' option is given, the files
|
||||
are passed to the corresponding decompressor without verifying their
|
||||
format, allowing for example the processing of compress'd (.Z) files
|
||||
with gzip: 'zcmp --force-format=gz file.Z file.lz'.
|
||||
FORMAT NOTE 2: If the option '--force-format' is given, the files are
|
||||
passed to the corresponding decompressor without verifying their format,
|
||||
allowing for example the processing of compress'd (.Z) files with gzip:
|
||||
'zcmp --force-format=gz file.Z file.lz'.
|
||||
|
||||
LANGUAGE NOTE: Uncompressed = not compressed = plain data; it may
|
||||
never have been compressed. Decompressed is used to refer to data which
|
||||
have undergone the process of decompression.
|
||||
LANGUAGE NOTE: Uncompressed = not compressed = plain data; it may never
|
||||
have been compressed. Decompressed is used to refer to data which have
|
||||
undergone the process of decompression.
|
||||
|
||||
|
||||
Numbers given as arguments to options (positions, sizes) may be
|
||||
followed by a multiplier and an optional 'B' for "byte".
|
||||
Numbers given as arguments to options (positions, sizes) may be followed
|
||||
by a multiplier and an optional 'B' for "byte".
|
||||
|
||||
Table of SI and binary prefixes (unit multipliers):
|
||||
|
||||
|
@ -99,9 +98,9 @@ File: zutils.info, Node: Common options, Next: The zutilsrc file, Prev: Intro
|
|||
2 Common options
|
||||
****************
|
||||
|
||||
The following options are available in all the utilities. Rather than
|
||||
writing identical descriptions for each of the programs, they are
|
||||
described here.
|
||||
The following options: are available in all the utilities. Rather than
|
||||
writing identical descriptions for each of the programs, they are described
|
||||
here. *Note Argument syntax: (arg_parser)Argument syntax.
|
||||
|
||||
'-h'
|
||||
'--help'
|
||||
|
@ -110,19 +109,19 @@ described here.
|
|||
|
||||
'-V'
|
||||
'--version'
|
||||
Print the version number on the standard output and exit. This
|
||||
version number should be included in all bug reports.
|
||||
Print the version number on the standard output and exit. This version
|
||||
number should be included in all bug reports.
|
||||
|
||||
'-M FORMAT_LIST'
|
||||
'--format=FORMAT_LIST'
|
||||
Process only the formats listed in the comma-separated
|
||||
FORMAT_LIST. Valid formats are 'bz2', 'gz', 'lz', 'xz' and 'un'
|
||||
for 'uncompressed', meaning "any file name without a known
|
||||
extension". This option excludes files based on extension, instead
|
||||
of format, because it is more efficient. The exclusion only
|
||||
applies to names generated automatically (for example when adding
|
||||
extensions to a file name or when operating recursively on
|
||||
directories). Files given in the command line are always processed.
|
||||
Process only the formats listed in the comma-separated FORMAT_LIST.
|
||||
Valid formats are 'bz2', 'gz', 'lz', 'xz', and 'un' for
|
||||
'uncompressed', meaning "any file name without a known extension".
|
||||
This option excludes files based on extension, instead of format,
|
||||
because it is more efficient. The exclusion only applies to names
|
||||
generated automatically (for example when adding extensions to a file
|
||||
name or when operating recursively on directories). Files given in the
|
||||
command line are always processed.
|
||||
|
||||
Each format in FORMAT_LIST enables file names with the following
|
||||
extensions:
|
||||
|
@ -141,17 +140,20 @@ described here.
|
|||
'--gz=COMMAND'
|
||||
'--lz=COMMAND'
|
||||
'--xz=COMMAND'
|
||||
Set program (may include arguments) to be used as (de)compressor
|
||||
for the given format. 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:
|
||||
Set program to be used as (de)compressor 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 other three 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:
|
||||
|
||||
1. When called with the '-d' option, it must read compressed
|
||||
data from the standard input and produce decompressed data on
|
||||
the standard output.
|
||||
1. When called with the option '-d', it must read compressed data
|
||||
from the standard input and produce decompressed data on the
|
||||
standard output.
|
||||
|
||||
2. If the '-q' option is passed to zutils, the compression
|
||||
program must also accept it.
|
||||
2. If the option '-q' is passed to zutils, the compression program
|
||||
must also accept it.
|
||||
|
||||
3. It must return 0 if no errors occurred, and a non-zero value
|
||||
otherwise.
|
||||
|
@ -164,23 +166,23 @@ File: zutils.info, Node: The zutilsrc file, Next: Zcat, Prev: Common options,
|
|||
*******************
|
||||
|
||||
'zutilsrc' is the runtime configuration file for zutils. In it you may
|
||||
define the compressor name and options to be used for each format. The
|
||||
'zutilsrc' file is optional; you don't need to install it in order to
|
||||
run zutils.
|
||||
define the compressor name and options to be used for each format. The
|
||||
'zutilsrc' file 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 the 'zutilsrc' file.
|
||||
The compressors specified in the command line override those specified
|
||||
in the 'zutilsrc' file.
|
||||
|
||||
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):
|
||||
'$HOME/.zutilsrc' and customize these options as you like. The file syntax
|
||||
is fairly obvious (and there are further instructions in it):
|
||||
|
||||
1. Any line beginning with '#' is a comment line.
|
||||
|
||||
2. Each non-comment line defines the command to be used for the given
|
||||
format, with the syntax:
|
||||
2. Each non-comment line defines the command to be used for the
|
||||
corresponding format, with the syntax:
|
||||
<format> = <compressor> [options]
|
||||
where <format> is one of 'bz2', 'gz', 'lz' or 'xz'.
|
||||
where <format> is one of 'bz2', 'gz', 'lz', or 'xz'.
|
||||
|
||||
|
||||
File: zutils.info, Node: Zcat, Next: Zcmp, Prev: The zutilsrc file, Up: Top
|
||||
|
@ -188,26 +190,26 @@ File: zutils.info, Node: Zcat, Next: Zcmp, Prev: The zutilsrc file, Up: Top
|
|||
4 Zcat
|
||||
******
|
||||
|
||||
zcat copies each given file to standard output. If any given file is
|
||||
compressed, its decompressed content is used. If a given file 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
|
||||
standard input must be of the same type; all uncompressed or all in the
|
||||
same compression format.
|
||||
same compressed format.
|
||||
|
||||
If no files are specified, recursive searches examine the current
|
||||
working directory, and nonrecursive searches read standard input.
|
||||
If no files are specified, recursive searches examine the current working
|
||||
directory, and nonrecursive searches read standard input.
|
||||
|
||||
The format for running zcat is:
|
||||
|
||||
zcat [OPTIONS] [FILES]
|
||||
|
||||
Exit status is 0 if no errors occurred, non-zero otherwise.
|
||||
Exit status is 0 if no errors occurred, 1 otherwise.
|
||||
|
||||
zcat supports the following options:
|
||||
|
||||
|
@ -217,8 +219,8 @@ Exit status is 0 if no errors occurred, non-zero otherwise.
|
|||
|
||||
'-b'
|
||||
'--number-nonblank'
|
||||
Number all nonblank output lines, starting with 1. The line count
|
||||
is unlimited.
|
||||
Number all nonblank output lines, starting with 1. The line count is
|
||||
unlimited.
|
||||
|
||||
'-e'
|
||||
Equivalent to '-vE'.
|
||||
|
@ -229,16 +231,14 @@ Exit status is 0 if no errors occurred, non-zero otherwise.
|
|||
|
||||
'-n'
|
||||
'--number'
|
||||
Number all output lines, starting with 1. The line count is
|
||||
unlimited.
|
||||
Number all output lines, starting with 1. The line count is unlimited.
|
||||
|
||||
'-O FORMAT'
|
||||
'--force-format=FORMAT'
|
||||
Force the given compression format. Valid values for FORMAT are
|
||||
'bz2', 'gz', 'lz' and 'xz'. 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.
|
||||
Force the compressed format given. Valid values for FORMAT are 'bz2',
|
||||
'gz', 'lz', and 'xz'. 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.
|
||||
|
||||
'-q'
|
||||
'--quiet'
|
||||
|
@ -247,8 +247,8 @@ Exit status is 0 if no errors occurred, non-zero otherwise.
|
|||
'-r'
|
||||
'--recursive'
|
||||
For each directory operand, read and process all files in that
|
||||
directory, recursively. Follow symbolic links in the command line,
|
||||
but skip symlinks that are encountered recursively.
|
||||
directory, recursively. Follow symbolic links given in the command
|
||||
line, but skip symbolic links that are encountered recursively.
|
||||
|
||||
'-R'
|
||||
'--dereference-recursive'
|
||||
|
@ -282,28 +282,27 @@ File: zutils.info, Node: Zcmp, Next: Zdiff, Prev: Zcat, Up: Top
|
|||
5 Zcmp
|
||||
******
|
||||
|
||||
zcmp compares two files ('-' means standard input), and if they differ,
|
||||
tells the first byte and line number where they differ. Bytes and lines
|
||||
are numbered starting with 1. If any given file 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:
|
||||
|
||||
zcmp [OPTIONS] FILE1 [FILE2]
|
||||
|
||||
This compares FILE1 to FILE2. If FILE2 is omitted zcmp tries the
|
||||
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
|
||||
following:
|
||||
|
||||
1. If FILE1 is compressed, compares its decompressed contents with
|
||||
the corresponding uncompressed file (the name of FILE1 with the
|
||||
extension removed).
|
||||
- If FILE1 is compressed, compares its decompressed contents with the
|
||||
corresponding uncompressed file (the name of FILE1 with the extension
|
||||
removed).
|
||||
|
||||
2. If FILE1 is uncompressed, compares it with the decompressed
|
||||
contents of FILE1.[lz|bz2|gz|xz] (the first one that is found).
|
||||
|
||||
3. If no suitable file is found, compares FILE1 with data read from
|
||||
standard input.
|
||||
- If FILE1 is uncompressed, compares it with the decompressed contents
|
||||
of FILE1.[lz|bz2|gz|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.
|
||||
|
@ -312,17 +311,16 @@ differences were found, and 2 means trouble.
|
|||
|
||||
'-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 differing bytes. Print control bytes as a '^' followed by a
|
||||
letter, and precede bytes larger than 127 with 'M-' (which stands for
|
||||
"meta").
|
||||
|
||||
'-i SIZE'
|
||||
'--ignore-initial=SIZE'
|
||||
Ignore any differences in the first SIZE bytes of the input files.
|
||||
Treat files with fewer than SIZE bytes as if they were empty. If
|
||||
SIZE is in the form 'SIZE1:SIZE2', ignore the first SIZE1 bytes of
|
||||
the first input file and the first SIZE2 bytes of the second input
|
||||
file.
|
||||
Treat files with fewer than SIZE bytes as if they were empty. If SIZE
|
||||
is in the form 'SIZE1:SIZE2', ignore the first SIZE1 bytes of the
|
||||
first input file and the first SIZE2 bytes of the second input file.
|
||||
|
||||
'-l'
|
||||
'-v'
|
||||
|
@ -337,20 +335,20 @@ differences were found, and 2 means trouble.
|
|||
|
||||
'-O [FORMAT1][,FORMAT2]'
|
||||
'--force-format=[FORMAT1][,FORMAT2]'
|
||||
Force the given compression formats. Any of FORMAT1 or FORMAT2 may
|
||||
be omitted and the corresponding format will be automatically
|
||||
detected. Valid values for FORMAT are 'bz2', 'gz', 'lz' and 'xz'.
|
||||
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.
|
||||
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', and 'xz'. 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.
|
||||
|
||||
'-q'
|
||||
'-s'
|
||||
'--quiet'
|
||||
'--silent'
|
||||
Don't print anything; only return an exit status indicating
|
||||
whether the files differ.
|
||||
Don't print anything; only return an exit status indicating whether the
|
||||
files differ.
|
||||
|
||||
|
||||
|
||||
|
@ -359,34 +357,33 @@ File: zutils.info, Node: Zdiff, Next: Zgrep, Prev: Zcmp, Up: Top
|
|||
6 Zdiff
|
||||
*******
|
||||
|
||||
zdiff compares two files ('-' means standard input), and if they
|
||||
differ, shows the differences line by line. If any given file is
|
||||
compressed, its decompressed content is used. zdiff is a front end to
|
||||
the diff program and has the limitation that messages from diff refer to
|
||||
temporary file names instead of those specified.
|
||||
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
|
||||
that messages from diff refer to temporary file names instead of those
|
||||
specified.
|
||||
|
||||
The format for running zdiff is:
|
||||
|
||||
zdiff [OPTIONS] FILE1 [FILE2]
|
||||
|
||||
This compares FILE1 to FILE2. If FILE2 is omitted zdiff tries the
|
||||
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
|
||||
following:
|
||||
|
||||
1. If FILE1 is compressed, compares its decompressed contents with
|
||||
the corresponding uncompressed file (the name of FILE1 with the
|
||||
extension removed).
|
||||
- If FILE1 is compressed, compares its decompressed contents with the
|
||||
corresponding uncompressed file (the name of FILE1 with the extension
|
||||
removed).
|
||||
|
||||
2. If FILE1 is uncompressed, compares it with the decompressed
|
||||
contents of FILE1.[lz|bz2|gz|xz] (the first one that is found).
|
||||
|
||||
3. If no suitable file is found, compares FILE1 with data read from
|
||||
standard input.
|
||||
- If FILE1 is uncompressed, compares it with the decompressed contents
|
||||
of FILE1.[lz|bz2|gz|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):
|
||||
zdiff supports the following options (some options only work if the diff
|
||||
program used supports them):
|
||||
|
||||
'-a'
|
||||
'--text'
|
||||
|
@ -421,13 +418,13 @@ diff program used supports them):
|
|||
|
||||
'-O [FORMAT1][,FORMAT2]'
|
||||
'--force-format=[FORMAT1][,FORMAT2]'
|
||||
Force the given compression formats. Any of FORMAT1 or FORMAT2 may
|
||||
be omitted and the corresponding format will be automatically
|
||||
detected. Valid values for FORMAT are 'bz2', 'gz', 'lz' and 'xz'.
|
||||
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.
|
||||
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', and 'xz'. 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.
|
||||
|
||||
'-p'
|
||||
'--show-c-function'
|
||||
|
@ -467,31 +464,29 @@ File: zutils.info, Node: Zgrep, Next: Ztest, Prev: Zdiff, Up: Top
|
|||
7 Zgrep
|
||||
*******
|
||||
|
||||
zgrep is a front end to the grep program that allows transparent search
|
||||
on any combination of compressed and uncompressed files. If any given
|
||||
file is compressed, its decompressed content is used. If a given file
|
||||
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.
|
||||
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.
|
||||
|
||||
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 be of the same type; all uncompressed or all in the same
|
||||
compression format.
|
||||
decompressed if needed, and fed to grep. Data read from standard input must
|
||||
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.
|
||||
If no files are specified, recursive searches examine the current working
|
||||
directory, and nonrecursive searches read standard input.
|
||||
|
||||
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.
|
||||
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):
|
||||
zgrep supports the following options (some options only work if the grep
|
||||
program used supports them):
|
||||
|
||||
'-a'
|
||||
'--text'
|
||||
|
@ -518,7 +513,7 @@ grep program used supports them):
|
|||
Print N lines of output context.
|
||||
|
||||
'--color[=WHEN]'
|
||||
Show matched strings in color. WHEN is 'never', 'always' or 'auto'.
|
||||
Show matched strings in color. WHEN is 'never', 'always', or 'auto'.
|
||||
|
||||
'-e PATTERN'
|
||||
'--regexp=PATTERN'
|
||||
|
@ -531,9 +526,9 @@ grep program used supports them):
|
|||
'-f FILE'
|
||||
'--file=FILE'
|
||||
Obtain patterns from FILE, one per line.
|
||||
When searching in several files at once, command substitution can
|
||||
be used with '-e' to read FILE only once, for example if FILE is
|
||||
not a regular file: 'zgrep -e "$(cat FILE)" file1.lz file2.gz'
|
||||
When searching in several files at once, command substitution can be
|
||||
used with '-e' to read FILE only once, for example if FILE is not a
|
||||
regular file: 'zgrep -e "$(cat FILE)" file1.lz file2.gz'
|
||||
|
||||
'-F'
|
||||
'--fixed-strings'
|
||||
|
@ -541,8 +536,8 @@ grep program used supports them):
|
|||
|
||||
'-h'
|
||||
'--no-filename'
|
||||
Suppress the prefixing of file names on output when multiple files
|
||||
are searched.
|
||||
Suppress the prefixing of file names on output when multiple files are
|
||||
searched.
|
||||
|
||||
'-H'
|
||||
'--with-filename'
|
||||
|
@ -577,22 +572,21 @@ grep program used supports them):
|
|||
|
||||
'-O FORMAT'
|
||||
'--force-format=FORMAT'
|
||||
Force the given compression format. Valid values for FORMAT are
|
||||
'bz2', 'gz', 'lz' and 'xz'. 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.
|
||||
Force the compressed format given. Valid values for FORMAT are 'bz2',
|
||||
'gz', 'lz', and 'xz'. 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.
|
||||
|
||||
'-q'
|
||||
'--quiet'
|
||||
Suppress all messages. Exit immediately with zero status if any
|
||||
match is found, even if an error was detected.
|
||||
Suppress all messages. Exit immediately with zero status if any match
|
||||
is found, even if an error was detected.
|
||||
|
||||
'-r'
|
||||
'--recursive'
|
||||
For each directory operand, read and process all files in that
|
||||
directory, recursively. Follow symbolic links in the command line,
|
||||
but skip symlinks that are encountered recursively.
|
||||
directory, recursively. Follow symbolic links given in the command
|
||||
line, but skip symbolic links that are encountered recursively.
|
||||
|
||||
'-R'
|
||||
'--dereference-recursive'
|
||||
|
@ -625,42 +619,43 @@ File: zutils.info, Node: Ztest, Next: Zupdate, Prev: Zgrep, Up: Top
|
|||
8 Ztest
|
||||
*******
|
||||
|
||||
ztest verifies the integrity of the specified compressed files.
|
||||
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 compression format. If
|
||||
a file fails to decompress, ztest continues verifying the rest of the
|
||||
files.
|
||||
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.
|
||||
If no files are specified, recursive searches examine the current working
|
||||
directory, and nonrecursive searches read standard input.
|
||||
|
||||
Note that error detection in the xz format is broken. First, some xz
|
||||
files lack integrity information. Second, not all xz decompressors can
|
||||
verify the integrity of all xz files. Third, section 2.1.1.2 'Stream
|
||||
Flags' 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.
|
||||
verify the integrity of all xz files. Third, section 2.1.1.2 'Stream Flags'
|
||||
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:
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
ztest supports the following options:
|
||||
|
||||
'-O FORMAT'
|
||||
'--force-format=FORMAT'
|
||||
Force the given compression format. Valid values for FORMAT are
|
||||
'bz2', 'gz', 'lz' and 'xz'. If this option is used, the files are
|
||||
passed to the corresponding decompressor without verifying their
|
||||
format, and any files in a format that the decompressor can't
|
||||
understand will fail. For example, '--force-format=gz' can test
|
||||
gzipped (.gz) and compress'd (.Z) files if the compressor used is
|
||||
GNU gzip.
|
||||
Force the compressed format given. Valid values for FORMAT are 'bz2',
|
||||
'gz', 'lz', and 'xz'. If this option is used, the files are passed to
|
||||
the corresponding decompressor without verifying their format, and any
|
||||
files in a format that the decompressor can't understand will fail.
|
||||
For example, '--force-format=gz' can test gzipped (.gz) and compress'd
|
||||
(.Z) files if the compressor used is GNU gzip.
|
||||
|
||||
'-q'
|
||||
'--quiet'
|
||||
|
@ -669,8 +664,8 @@ environmental problems (file not found, invalid flags, I/O errors, etc),
|
|||
'-r'
|
||||
'--recursive'
|
||||
For each directory operand, read and process all files in that
|
||||
directory, recursively. Follow symbolic links in the command line,
|
||||
but skip symlinks that are encountered recursively.
|
||||
directory, recursively. Follow symbolic links given in the command
|
||||
line, but skip symbolic links that are encountered recursively.
|
||||
|
||||
'-R'
|
||||
'--dereference-recursive'
|
||||
|
@ -689,68 +684,69 @@ File: zutils.info, Node: Zupdate, Next: Problems, Prev: Ztest, Up: Top
|
|||
9 Zupdate
|
||||
*********
|
||||
|
||||
zupdate recompresses files from bzip2, gzip, and xz 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.
|
||||
zupdate recompresses files from bzip2, gzip, and xz 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.
|
||||
|
||||
If no files are specified, recursive searches examine the current
|
||||
working directory, and nonrecursive searches do nothing.
|
||||
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 '--force' option 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 produce any data loss. Therefore, existing lzip
|
||||
compressed files are never overwritten nor deleted.
|
||||
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
|
||||
safe and not cause any data loss. Therefore, existing lzip compressed files
|
||||
are never overwritten nor deleted.
|
||||
|
||||
Combining the '--force' and '--keep' options, as in
|
||||
'zupdate -f -k *.gz', verifies that there are no differences between
|
||||
each pair of files in a multiformat set of files.
|
||||
Combining the options '--force' and '--keep', as in
|
||||
'zupdate -f -k *.gz', verifies that there are no differences between each
|
||||
pair of files in a multiformat set of files.
|
||||
|
||||
The names of the original files must have one of the following
|
||||
extensions: '.bz2', '.tbz', '.tbz2', '.gz', '.tgz', '.xz', '.txz'. The
|
||||
files produced have the extensions '.lz' or '.tar.lz'.
|
||||
extensions:
|
||||
'.bz2', '.gz', and '.xz' are recompressed to '.lz'.
|
||||
'.tbz', '.tbz2', '.tgz', and '.txz' are recompressed to '.tlz'.
|
||||
Keeping the combined extensions ('.tgz' -> '.tlz') may be useful when
|
||||
recompressing Slackware packages, for example.
|
||||
|
||||
Recompressing a file is much like copying or moving it; therefore
|
||||
zupdate preserves the access and modification dates, permissions, and,
|
||||
when possible, 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, when
|
||||
possible, 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:
|
||||
|
||||
zupdate [OPTIONS] [FILES]
|
||||
|
||||
Exit status is 0 if all the compressed files were successfully
|
||||
recompressed (if needed), compared and deleted (if requested). Non-zero
|
||||
otherwise.
|
||||
Exit status is 0 if all the compressed files were successfully recompressed
|
||||
(if needed), compared, and deleted (if requested). Non-zero otherwise.
|
||||
|
||||
zupdate supports the following options:
|
||||
|
||||
'-f'
|
||||
'--force'
|
||||
Don't skip a file for which a lzip compressed version already
|
||||
exists. '--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.
|
||||
Don't skip a file for which a lzip compressed version already exists.
|
||||
'--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.
|
||||
|
||||
'-k'
|
||||
'--keep'
|
||||
Keep (don't delete) the input file after comparing it with the
|
||||
lzip file.
|
||||
Keep (don't delete) the input file after comparing it with the lzip
|
||||
file.
|
||||
|
||||
'-l'
|
||||
'--lzip-verbose'
|
||||
Pass a '-v' option to the lzip compressor so that it shows the
|
||||
compression ratio for each file processed. Using lzip 1.15 and
|
||||
newer, a second '-l' shows the progress of compression. Use it
|
||||
together with '-v' to see the name of the file.
|
||||
Pass one 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 '-l' shows the progress of compression. Use it together with
|
||||
'-v' to see the name of the file.
|
||||
|
||||
'-q'
|
||||
'--quiet'
|
||||
|
@ -759,8 +755,8 @@ otherwise.
|
|||
'-r'
|
||||
'--recursive'
|
||||
For each directory operand, read and process all files in that
|
||||
directory, recursively. Follow symbolic links in the command line,
|
||||
but skip symlinks that are encountered recursively.
|
||||
directory, recursively. Follow symbolic links given in the command
|
||||
line, but skip symbolic links that are encountered recursively.
|
||||
|
||||
'-R'
|
||||
'--dereference-recursive'
|
||||
|
@ -769,12 +765,13 @@ otherwise.
|
|||
|
||||
'-v'
|
||||
'--verbose'
|
||||
Verbose mode. Show the files being processed. A second '-v' also
|
||||
shows the files being ignored.
|
||||
Verbose mode. Show the files being processed. A second '-v' also shows
|
||||
the files being ignored.
|
||||
|
||||
'-0 .. -9'
|
||||
Set the compression level of lzip. By default zupdate passes '-9'
|
||||
to lzip.
|
||||
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''.
|
||||
|
||||
|
||||
|
||||
|
@ -783,14 +780,14 @@ File: zutils.info, Node: Problems, Next: Concept index, Prev: Zupdate, Up: T
|
|||
10 Reporting bugs
|
||||
*****************
|
||||
|
||||
There are probably bugs in zutils. There are certainly errors and
|
||||
omissions in this manual. If you report them, they will get fixed. If
|
||||
you don't, no one will ever know about them and they will remain unfixed
|
||||
for all eternity, if not longer.
|
||||
There are probably bugs in zutils. There are certainly errors and omissions
|
||||
in this manual. If you report them, they will get fixed. If you don't, no
|
||||
one will ever know about them and they will remain unfixed for all
|
||||
eternity, if not longer.
|
||||
|
||||
If you find a bug in zutils, please send electronic mail to
|
||||
<zutils-bug@nongnu.org>. Include the version number, which you can find
|
||||
by running 'zupdate --version'.
|
||||
<zutils-bug@nongnu.org>. Include the version number, which you can find by
|
||||
running 'zupdate --version'.
|
||||
|
||||
|
||||
File: zutils.info, Node: Concept index, Prev: Problems, Up: Top
|
||||
|
@ -801,34 +798,34 @@ Concept index
|
|||
|