From 50c0d5bace5875eb0a3c4c7aafa564244e46e59c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 8 Nov 2015 05:31:16 +0100 Subject: Merging upstream version 1.2. Signed-off-by: Daniel Baumann --- ChangeLog | 15 +- INSTALL | 14 +- Makefile.in | 14 +- NEWS | 8 +- README | 2 +- arg_parser.cc | 2 +- arg_parser.h | 2 +- configure | 8 +- doc/zcat.1 | 4 +- doc/zcmp.1 | 4 +- doc/zdiff.1 | 4 +- doc/zgrep.1 | 4 +- doc/ztest.1 | 4 +- doc/zupdate.1 | 12 +- doc/zutils.info | 44 ++-- doc/zutils.texi | 745 +++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/zutils.texinfo | 744 ---------------------------------------------------- rc.cc | 4 +- rc.h | 2 +- recursive.cc | 2 +- testsuite/check.sh | 6 +- zcat.cc | 2 +- zcmp.cc | 2 +- zcmpdiff.cc | 4 +- zdiff.cc | 2 +- zgrep.cc | 2 +- ztest.cc | 4 +- zupdate.cc | 22 +- zutils.cc | 6 +- zutils.h | 2 +- 30 files changed, 846 insertions(+), 844 deletions(-) create mode 100644 doc/zutils.texi delete mode 100644 doc/zutils.texinfo diff --git a/ChangeLog b/ChangeLog index aa10218..e0c4658 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,10 @@ -2013-10-11 Antonio Diaz Diaz +2014-02-01 Antonio Diaz Diaz - * Version 1.2-pre3 released. + * Version 1.2 released. + * Added new utility; zupdate. * Removed zutils executable. Utils are now independent executables. - * zupdate.cc: Added new option '-k, --keep'. - * zupdate.cc: Ignore xz files if xz compressor is not installed. * zgrep.cc: Fixed the exit status returned on error. - -2013-09-04 Antonio Diaz Diaz - - * Version 1.2-pre2 released. - * Added new utility; zupdate. + * zutils.texinfo: Renamed to zutils.texi. 2013-08-02 Antonio Diaz Diaz @@ -107,7 +102,7 @@ * Version 0.1 released. -Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. +Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 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 diff --git a/INSTALL b/INSTALL index 19febd5..8201b47 100644 --- a/INSTALL +++ b/INSTALL @@ -49,12 +49,12 @@ the main archive. 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 object files -and executables to go and run the 'configure' script. 'configure' -automatically checks for the source code in '.', in '..' and in the -directory that 'configure' is in. +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 +object files and executables to go and run the 'configure' script. +'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 look for the sources. Usually 'configure' can determine that directory @@ -64,7 +64,7 @@ After running 'configure', you can run 'make' and 'make install' as explained above. -Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. +Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This file is free documentation: you have unlimited permission to copy, distribute and modify it. diff --git a/Makefile.in b/Makefile.in index 98d2f24..478c039 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,9 +1,9 @@ DISTNAME = $(pkgname)-$(pkgversion) INSTALL = install -INSTALL_PROGRAM = $(INSTALL) -p -m 755 -INSTALL_SCRIPT = $(INSTALL) -p -m 755 -INSTALL_DATA = $(INSTALL) -p -m 644 +INSTALL_PROGRAM = $(INSTALL) -m 755 +INSTALL_SCRIPT = $(INSTALL) -m 755 +INSTALL_DATA = $(INSTALL) -m 644 INSTALL_DIR = $(INSTALL) -d -m 755 SHELL = /bin/sh @@ -80,8 +80,8 @@ doc : info man info : $(VPATH)/doc/$(pkgname).info -$(VPATH)/doc/$(pkgname).info : $(VPATH)/doc/$(pkgname).texinfo - cd $(VPATH)/doc && makeinfo $(pkgname).texinfo +$(VPATH)/doc/$(pkgname).info : $(VPATH)/doc/$(pkgname).texi + cd $(VPATH)/doc && makeinfo $(pkgname).texi man : $(VPATH)/doc/zcat.1 $(VPATH)/doc/zcmp.1 $(VPATH)/doc/zdiff.1 \ $(VPATH)/doc/zgrep.1 $(VPATH)/doc/ztest.1 $(VPATH)/doc/zupdate.1 @@ -177,7 +177,7 @@ uninstall-man : dist : doc ln -sf $(VPATH) $(DISTNAME) - tar -cvf $(DISTNAME).tar \ + tar -Hustar --owner=root --group=root -cvf $(DISTNAME).tar \ $(DISTNAME)/AUTHORS \ $(DISTNAME)/COPYING \ $(DISTNAME)/ChangeLog \ @@ -188,7 +188,7 @@ dist : doc $(DISTNAME)/configure \ $(DISTNAME)/doc/*.1 \ $(DISTNAME)/doc/$(pkgname).info \ - $(DISTNAME)/doc/$(pkgname).texinfo \ + $(DISTNAME)/doc/$(pkgname).texi \ $(DISTNAME)/testsuite/check.sh \ $(DISTNAME)/testsuite/test.txt \ $(DISTNAME)/testsuite/test.txt.tar \ diff --git a/NEWS b/NEWS index 682e97b..6ce4d66 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,11 @@ Changes in version 1.2: -The zutils executable has been removed. All utilities are now -independent executables. - The new utility zupdate, which recompresses bzip2, gzip and xz files to lzip format, has been added. +The zutils executable has been removed. All utilities are now +independent executables. + The exit status of zgrep should now be identical to that of grep. + +"zutils.texinfo" has been renamed to "zutils.texi". diff --git a/README b/README index 1142876..5b327d8 100644 --- a/README +++ b/README @@ -27,7 +27,7 @@ have been compressed. Decompressed is used to refer to data which has undergone the process of decompression. -Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. +Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This file is free documentation: you have unlimited permission to copy, distribute and modify it. diff --git a/arg_parser.cc b/arg_parser.cc index 5cb98a9..7d98ffe 100644 --- a/arg_parser.cc +++ b/arg_parser.cc @@ -1,5 +1,5 @@ /* Arg_parser - POSIX/GNU command line argument parser. (C++ version) - Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 + Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This library is free software: you can redistribute it and/or modify diff --git a/arg_parser.h b/arg_parser.h index 5248cb1..8d0d5b3 100644 --- a/arg_parser.h +++ b/arg_parser.h @@ -1,5 +1,5 @@ /* Arg_parser - POSIX/GNU command line argument parser. (C++ version) - Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 + Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This library is free software: you can redistribute it and/or modify diff --git a/configure b/configure index cf9c582..bcf101f 100755 --- a/configure +++ b/configure @@ -1,13 +1,13 @@ #! /bin/sh # configure script for Zutils - Utilities dealing with compressed files -# Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. +# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. # # This configure script is free software: you have unlimited permission # to copy, distribute and modify it. pkgname=zutils -pkgversion=1.2-pre3 -srctrigger=doc/${pkgname}.texinfo +pkgversion=1.2 +srctrigger=doc/${pkgname}.texi # clear some things potentially inherited from environment. LC_ALL=C @@ -177,7 +177,7 @@ echo "GREP = ${GREP}" rm -f Makefile cat > Makefile << EOF # Makefile for Zutils - Utilities dealing with compressed files -# Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. +# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. # This file was generated automatically by configure. Do not edit. # # This Makefile is free software: you have unlimited permission diff --git a/doc/zcat.1 b/doc/zcat.1 index 1ceda79..2a94f76 100644 --- a/doc/zcat.1 +++ b/doc/zcat.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH ZCAT "1" "October 2013" "Zcat (zutils) 1.2-pre3" "User Commands" +.TH ZCAT "1" "February 2014" "Zcat (zutils) 1.2" "User Commands" .SH NAME Zcat \- decompress and concatenate files to standard output .SH SYNOPSIS @@ -84,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 2013 Antonio Diaz Diaz. +Copyright \(co 2014 Antonio Diaz Diaz. License GPLv3+: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. diff --git a/doc/zcmp.1 b/doc/zcmp.1 index f07b725..ec03656 100644 --- a/doc/zcmp.1 +++ b/doc/zcmp.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH ZCMP "1" "October 2013" "Zcmp (zutils) 1.2-pre3" "User Commands" +.TH ZCMP "1" "February 2014" "Zcmp (zutils) 1.2" "User Commands" .SH NAME Zcmp \- decompress and compare two files byte by byte .SH SYNOPSIS @@ -82,7 +82,7 @@ Report bugs to zutils\-bug@nongnu.org .br Zutils home page: http://www.nongnu.org/zutils/zutils.html .SH COPYRIGHT -Copyright \(co 2013 Antonio Diaz Diaz. +Copyright \(co 2014 Antonio Diaz Diaz. License GPLv3+: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. diff --git a/doc/zdiff.1 b/doc/zdiff.1 index ce89018..d41ee59 100644 --- a/doc/zdiff.1 +++ b/doc/zdiff.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH ZDIFF "1" "October 2013" "Zdiff (zutils) 1.2-pre3" "User Commands" +.TH ZDIFF "1" "February 2014" "Zdiff (zutils) 1.2" "User Commands" .SH NAME Zdiff \- decompress and compare two files line by line .SH SYNOPSIS @@ -109,7 +109,7 @@ Report bugs to zutils\-bug@nongnu.org .br Zutils home page: http://www.nongnu.org/zutils/zutils.html .SH COPYRIGHT -Copyright \(co 2013 Antonio Diaz Diaz. +Copyright \(co 2014 Antonio Diaz Diaz. License GPLv3+: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. diff --git a/doc/zgrep.1 b/doc/zgrep.1 index 8041fe0..8adecee 100644 --- a/doc/zgrep.1 +++ b/doc/zgrep.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH ZGREP "1" "October 2013" "Zgrep (zutils) 1.2-pre3" "User Commands" +.TH ZGREP "1" "February 2014" "Zgrep (zutils) 1.2" "User Commands" .SH NAME Zgrep \- search compressed files for a regular expression .SH SYNOPSIS @@ -127,7 +127,7 @@ Report bugs to zutils\-bug@nongnu.org .br Zutils home page: http://www.nongnu.org/zutils/zutils.html .SH COPYRIGHT -Copyright \(co 2013 Antonio Diaz Diaz. +Copyright \(co 2014 Antonio Diaz Diaz. License GPLv3+: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. diff --git a/doc/ztest.1 b/doc/ztest.1 index cdf40f5..77758c1 100644 --- a/doc/ztest.1 +++ b/doc/ztest.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH ZTEST "1" "October 2013" "Ztest (zutils) 1.2-pre3" "User Commands" +.TH ZTEST "1" "February 2014" "Ztest (zutils) 1.2" "User Commands" .SH NAME Ztest \- verify integrity of compressed files .SH SYNOPSIS @@ -58,7 +58,7 @@ Report bugs to zutils\-bug@nongnu.org .br Zutils home page: http://www.nongnu.org/zutils/zutils.html .SH COPYRIGHT -Copyright \(co 2013 Antonio Diaz Diaz. +Copyright \(co 2014 Antonio Diaz Diaz. License GPLv3+: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. diff --git a/doc/zupdate.1 b/doc/zupdate.1 index 63696ac..f534870 100644 --- a/doc/zupdate.1 +++ b/doc/zupdate.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH ZUPDATE "1" "October 2013" "Zupdate (zutils) 1.2-pre3" "User Commands" +.TH ZUPDATE "1" "February 2014" "Zupdate (zutils) 1.2" "User Commands" .SH NAME Zupdate \- recompress bzip2, gzip, xz files to lzip files .SH SYNOPSIS @@ -17,10 +17,10 @@ appropriate for long\-term data archiving. .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 -comparison 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. +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. .PP Exit status is 0 if all the compressed files were successfully recompressed (if needed), compared and deleted. Non\-zero otherwise. @@ -72,7 +72,7 @@ Report bugs to zutils\-bug@nongnu.org .br Zutils home page: http://www.nongnu.org/zutils/zutils.html .SH COPYRIGHT -Copyright \(co 2013 Antonio Diaz Diaz. +Copyright \(co 2014 Antonio Diaz Diaz. License GPLv3+: GNU GPL version 3 or later .br This is free software: you are free to change and redistribute it. diff --git a/doc/zutils.info b/doc/zutils.info index 59c7af2..d075c8d 100644 --- a/doc/zutils.info +++ b/doc/zutils.info @@ -1,5 +1,5 @@ This is zutils.info, produced by makeinfo version 4.13+ from -zutils.texinfo. +zutils.texi. INFO-DIR-SECTION Data Compression START-INFO-DIR-ENTRY @@ -12,7 +12,7 @@ File: zutils.info, Node: Top, Next: Introduction, Up: (dir) Zutils Manual ************* -This manual is for Zutils (version 1.2-pre3, 11 October 2013). +This manual is for Zutils (version 1.2, 1 February 2014). * Menu: @@ -29,7 +29,7 @@ This manual is for Zutils (version 1.2-pre3, 11 October 2013). * Concept index:: Index of concepts - Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. + Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This manual is free documentation: you have unlimited permission to copy, distribute and modify it. @@ -607,10 +607,10 @@ long-term data archiving. 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 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. +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. The names of the original files must have one of the following extensions: '.bz2', '.tbz', '.tbz2', '.gz', '.tgz', '.xz', '.txz'. The @@ -629,8 +629,8 @@ recompressed (if needed), compared and deleted. Non-zero otherwise. '--force' Do not skip a file for which a lzip compressed version already exists. '--force' compares the content of the input file with the - content of the lzip file and deletes the input file if both - contents are identical. + content of the existing lzip file and deletes the input file if + both contents are identical. '-k' '--keep' @@ -675,7 +675,7 @@ for all eternity, if not longer. If you find a bug in zutils, please send electronic mail to . Include the version number, which you can find -by running 'zcmp --version'. +by running 'zupdate --version'.  File: zutils.info, Node: Concept index, Prev: Problems, Up: Top @@ -701,18 +701,18 @@ Concept index  Tag Table: -Node: Top225 -Node: Introduction1156 -Node: Common options3259 -Node: The zutilsrc file4508 -Node: Zcat5434 -Node: Zcmp7356 -Node: Zdiff9680 -Node: Zgrep12183 -Node: Ztest15151 -Node: Zupdate16375 -Node: Problems18708 -Node: Concept index19239 +Node: Top222 +Node: Introduction1154 +Node: Common options3257 +Node: The zutilsrc file4506 +Node: Zcat5432 +Node: Zcmp7354 +Node: Zdiff9678 +Node: Zgrep12181 +Node: Ztest15149 +Node: Zupdate16373 +Node: Problems18746 +Node: Concept index19280  End Tag Table diff --git a/doc/zutils.texi b/doc/zutils.texi new file mode 100644 index 0000000..09237d2 --- /dev/null +++ b/doc/zutils.texi @@ -0,0 +1,745 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename zutils.info +@documentencoding ISO-8859-15 +@settitle Zutils Manual +@finalout +@c %**end of header + +@set UPDATED 1 February 2014 +@set VERSION 1.2 + +@dircategory Data Compression +@direntry +* Zutils: (zutils). Utilities dealing with compressed files +@end direntry + + +@ifnothtml +@titlepage +@title Zutils +@subtitle Utilities dealing with compressed files +@subtitle for Zutils version @value{VERSION}, @value{UPDATED} +@author by Antonio Diaz Diaz + +@page +@vskip 0pt plus 1filll +@end titlepage + +@contents +@end ifnothtml + +@node Top +@top + +This manual is for Zutils (version @value{VERSION}, @value{UPDATED}). + +@menu +* Introduction:: Purpose and features of zutils +* Common options:: Common options +* The zutilsrc file:: The zutils configuration file +* Zcat:: Concatenating compressed files +* Zcmp:: Comparing compressed files byte by byte +* Zdiff:: Comparing compressed files line by line +* Zgrep:: Searching inside compressed files +* Ztest:: Testing integrity of compressed files +* Zupdate:: Recompressing files to lzip format +* Problems:: Reporting bugs +* Concept index:: Index of concepts +@end menu + +@sp 1 +Copyright @copyright{} 2009, 2010, 2011, 2012, 2013, 2014 +Antonio Diaz Diaz. + +This manual is free documentation: you have unlimited permission +to copy, distribute and modify it. + + +@node Introduction +@chapter Introduction +@cindex introduction + +Zutils is a collection of utilities able to deal with 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. + +These utilities are not wrapper scripts but safer and more efficient C++ +programs. In particular the @samp{--recursive} option is very efficient +in those utilities supporting it. + +@noindent +The provided utilities are zcat, zcmp, zdiff, zgrep, ztest and zupdate.@* +The supported formats are bzip2, gzip, lzip and xz.@* +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 with 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. + +LANGUAGE NOTE: Uncompressed = not compressed = plain data; it may never +have been compressed. Decompressed is used to refer to data which has +undergone the process of decompression. + +@sp 1 +Numbers given as arguments to options (positions, sizes) 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 Common options +@chapter Common options +@cindex 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. + +@table @samp +@item -h +@itemx --help +Print an informative help message describing the options and exit. Zgrep +only supports the @samp{--help} form of this option. + +@item -V +@itemx --version +Print the version number on the standard output and exit. + +@item -N +@itemx --no-rcfile +Don't read the runtime configuration file @samp{zutilsrc}. + +@item --bz2=@var{command} +@itemx --gz=@var{command} +@itemx --lz=@var{command} +@itemx --xz=@var{command} +Set program (may include arguments) to be used as (de)compressor for the +given format. These options override the values set in @file{zutilsrc}. +The compression program used must meet three requirements: + +@enumerate +@item +When called with the @samp{-d} option, it must read compressed data from +the standard input and produce decompressed data on the standard output. +@item +If the @samp{-q} option 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. +@end enumerate + +@end table + + +@node The zutilsrc file +@chapter The zutilsrc file +@cindex the zutilsrc file + +@file{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 @file{zutilsrc} file is optional; you do not need to install it in +order to run zutils. + +The compressors specified in the command line override those specified +in the @file{zutilsrc} file. + +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): + +@enumerate +@item +Any line beginning with @samp{#} is a comment line. +@item +Each non-comment line defines the command to be used for the given +format, with the syntax: +@example + = [options] +@end example +where is one of @samp{bz2}, @samp{gz}, @samp{lz} or @samp{xz}. +@end enumerate + + +@node Zcat +@chapter Zcat +@cindex zcat + +Zcat copies each given file (@samp{-} means standard input), 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 supported formats. + +If no files are specified, data is 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. + +The format for running zcat is: + +@example +zcat [@var{options}] [@var{files}] +@end example + +@noindent +Exit status is 0 if no errors occurred, non-zero otherwise. + +Zcat supports the following options: + +@table @samp +@item -A +@itemx --show-all +Equivalent to @samp{-vET}. + +@item -b +@itemx --number-nonblank +Number all nonblank output lines, starting with 1. The line count is +unlimited. + +@item -e +Equivalent to @samp{-vE}. + +@item -E +@itemx --show-ends +Print a @samp{$} after the end of each line. + +@item --format=@var{fmt} +Force the given compression format. Valid values for @var{fmt} are +@samp{bz2}, @samp{gz}, @samp{lz} and @samp{xz}. If this option is used, +the exact file name must be given. Other names won't be tried. + +@item -n +@itemx --number +Number all output lines, starting with 1. The line count is unlimited. + +@item -q +@itemx --quiet +Quiet operation. Suppress all messages. + +@item -r +@itemx --recursive +Operate recursively on directories. + +@item -s +@itemx --squeeze-blank +Replace multiple adjacent blank lines with a single blank line. + +@item -t +Equivalent to @samp{-vT}. + +@item -T +@itemx --show-tabs +Print TAB characters as @samp{^I}. + +@item -v +@itemx --show-nonprinting +Print control characters except for LF (newline) and TAB using @samp{^} +notation and precede characters larger than 127 with @samp{M-} (which +stands for "meta"). + +@item --verbose +Verbose mode. Show error messages. + +@end table + + +@node Zcmp +@chapter Zcmp +@cindex zcmp + +Zcmp compares two files (@samp{-} 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. + +The format for running zcmp is: + +@example +zcmp [@var{options}] @var{file1} [@var{file2}] +@end example + +@noindent +This compares @var{file1} to @var{file2}. If @var{file2} is omitted zcmp +tries the following: + +@enumerate +@item +If @var{file1} is compressed, compares its decompressed contents with +the corresponding uncompressed file (the name of @var{file1} with the +extension removed). +@item +If @var{file1} is uncompressed, compares it with the decompressed +contents of @var{file1}.[lz|bz2|gz|xz] (the first one that is found). +@item +If no suitable file is found, compares @var{file1} with data read from +standard input. +@end enumerate + +@noindent +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: + +@table @samp +@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"). + +@item --format=[@var{fmt1}][,@var{fmt2}] +Force the given compression formats. Any of @var{fmt1} or @var{fmt2} may +be omitted and the corresponding format will be automatically detected. +Valid values for @var{fmt} are @samp{bz2}, @samp{gz}, @samp{lz} and +@samp{xz}. If at least one format is specified with this option, the +exact file names of both @var{file1} and @var{file2} must be given. +Other names won't be tried. + +@item -i @var{size} +@itemx --ignore-initial=@var{size} +Ignore any differences in the first @var{size} bytes of the input files. +Treat files with fewer than @var{size} bytes as if they were empty. If +@var{size} is in the form @samp{@var{size1},@var{size2}}, ignore the +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. + +@item -n @var{count} +@itemx --bytes=@var{count} +Compare at most @var{count} input bytes. + +@item -q +@itemx -s +@itemx --quiet +@itemx --silent +Do not print anything; only return an exit status indicating whether the +files differ. + +@end table + + +@node Zdiff +@chapter Zdiff +@cindex zdiff + +Zdiff compares two files (@samp{-} 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. + +The format for running zdiff is: + +@example +zdiff [@var{options}] @var{file1} [@var{file2}] +@end example + +@noindent +This compares @var{file1} to @var{file2}. If @var{file2} is omitted +zdiff tries the following: + +@enumerate +@item +If @var{file1} is compressed, compares its decompressed contents with +the corresponding uncompressed file (the name of @var{file1} with the +extension removed). +@item +If @var{file1} is uncompressed, compares it with the decompressed +contents of @var{file1}.[lz|bz2|gz|xz] (the first one that is found). +@item +If no suitable file is found, compares @var{file1} with data read from +standard input. +@end enumerate + +@noindent +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: + +@table @samp +@item -a +@itemx --text +Treat all files as text. + +@item -b +@itemx --ignore-space-change +Ignore changes in the amount of white space. + +@item -B +@itemx --ignore-blank-lines +Ignore changes whose lines are all blank. + +@itemx -c +Use the context output format. + +@item -C @var{n} +@itemx --context=@var{n} +Same as -c but use @var{n} lines of context. + +@item -d +@itemx --minimal +Try hard to find a smaller set of changes. + +@item -E +@itemx --ignore-tab-expansion +Ignore changes due to tab expansion. + +@item --format=[@var{fmt1}][,@var{fmt2}] +Force the given compression formats. Any of @var{fmt1} or @var{fmt2} may +be omitted and the corresponding format will be automatically detected. +Valid values for @var{fmt} are @samp{bz2}, @samp{gz}, @samp{lz} and +@samp{xz}. If at least one format is specified with this option, the +exact file names of both @var{file1} and @var{file2} must be given. +Other names won't be tried. + +@item -i +@itemx --ignore-case +Ignore case differences in file contents. + +@item -p +@itemx --show-c-function +Show which C function each change is in. + +@item -q +@itemx --brief +Output only whether files differ. + +@item -s +@itemx --report-identical-files +Report when two files are identical. + +@item -t +@itemx --expand-tabs +Expand tabs to spaces in output. + +@item -T +@itemx --initial-tab +Make tabs line up by prepending a tab. + +@item -u +Use the unified output format. + +@item -U @var{n} +@itemx --unified=@var{n} +Same as -u but use @var{n} lines of context. + +@item -w +@itemx --ignore-all-space +Ignore all white space. + +@end table + + +@node Zgrep +@chapter Zgrep +@cindex 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 +supported formats. + +If no files are specified, data is 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. + +The format for running zgrep is: + +@example +zgrep [@var{options}] @var{pattern} [@var{files}] +@end example + +@noindent +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: + +@table @samp +@item -a +@itemx --text +Treat all files as text. + +@item -A @var{n} +@itemx --after-context=@var{n} +Print @var{n} lines of trailing context. + +@item -b +@itemx --byte-offset +Print the byte offset of each line. + +@item -B @var{n} +@itemx --before-context=@var{n} +Print @var{n} lines of leading context. + +@item -c +@itemx --count +Only print a count of matching lines per file. + +@item -C @var{n} +@itemx --context=@var{n} +Print @var{n} lines of output context. + +@item -e @var{pattern} +@itemx --regexp=@var{pattern} +Use @var{pattern} as the pattern to match. + +@item -E +@itemx --extended-regexp +Treat @var{pattern} as an extended regular expression. + +@item -f @var{file} +@itemx --file=@var{file} +Obtain patterns from @var{file}, one per line. + +@item -F +@itemx --fixed-strings +Treat @var{pattern} as a set of newline-separated strings. + +@item --format=@var{fmt} +Force the given compression format. Valid values for @var{fmt} are +@samp{bz2}, @samp{gz}, @samp{lz} and @samp{xz}. If this option is used, +the exact file name must be given. Other names won't be tried. + +@item -h +@itemx --no-filename +Suppress the prefixing of filenames on output when multiple files are +searched. + +@item -H +@itemx --with-filename +Print the filename for each match. + +@item -i +@itemx --ignore-case +Ignore case distinctions. + +@item -I +Ignore binary files. + +@item -l +@itemx --files-with-matches +Only print names of files containing at least one match. + +@item -L +@itemx --files-without-match +Only print names of files not containing any matches. + +@item -m @var{n} +@itemx --max-count=@var{n} +Stop after @var{n} matches. + +@item -n +@itemx --line-number +Prefix each matched line with its line number in the input file. + +@item -o +@itemx --only-matching +Show only the part of matching lines that actually matches @var{pattern}. + +@item -q +@itemx --quiet +Suppress all messages. Exit immediately with zero status if any match is +found, even if an error was detected. + +@item -r +@itemx --recursive +Operate recursively on directories. + +@item -s +@itemx --no-messages +Suppress error messages about nonexistent or unreadable files. + +@item -v +@itemx --invert-match +Select non-matching lines. + +@item --verbose +Verbose mode. Show error messages. + +@item -w +@itemx --word-regexp +Match only whole words. + +@item -x +@itemx --line-regexp +Match only whole lines. + +@end table + + +@node Ztest +@chapter Ztest +@cindex ztest + +Ztest verifies the integrity of the specified compressed files. +Uncompressed files are ignored. If no files are specified, the integrity +of compressed data read from standard input is verified. Data read from +standard input must be all in the same compression format. + +Note that some xz files lack integrity information, and therefore can't +be verified as reliably as the other formats can. + +The format for running 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. + +Ztest supports the following options: + +@table @samp +@item --format=@var{fmt} +Force the given compression format. Valid values for @var{fmt} are +@samp{bz2}, @samp{gz}, @samp{lz} and @samp{xz}. If this option is used, +all files not in the given format will fail. + +@item -q +@itemx --quiet +Quiet operation. Suppress all messages. + +@item -r +@itemx --recursive +Operate recursively on directories. + +@item -v +@itemx --verbose +Verbose mode. Show the verify status for each file processed.@* +Further -v's increase the verbosity level. + +@end table + + +@node Zupdate +@chapter Zupdate +@cindex zupdate + +Zupdate recompresses files from bzip2, gzip, and xz formats to lzip +format. The originals are compared with the new files 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. The lzip format +is chosen as destination because it is by far the most appropriate for +long-term data archiving. + +If the lzip compressed version of a file already exists, the file is +skipped unless the @samp{--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. + +The names of the original files must have one of the following +extensions: @samp{.bz2}, @samp{.tbz}, @samp{.tbz2}, @samp{.gz}, +@samp{.tgz}, @samp{.xz}, @samp{.txz}. The files produced have the +extensions @samp{.lz} or @samp{.tar.lz}. + +The format for running zupdate is: + +@example +zupdate [@var{options}] [@var{files}] +@end example + +@noindent +Exit status is 0 if all the compressed files were successfully +recompressed (if needed), compared and deleted. Non-zero otherwise. + +Zupdate supports the following options: + +@table @samp +@item -f +@itemx --force +Do not skip a file for which a lzip compressed version already exists. +@samp{--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. + +@item -k +@itemx --keep +Keep (don't delete) the input file after comparing it with the lzip file. + +@item -l +@itemx --lzip-verbose +Pass a @samp{-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 @samp{-l} shows the progress of compression. Use it together with +@samp{-v} to see the name of the file. + +@item -q +@itemx --quiet +Quiet operation. Suppress all messages. + +@item -r +@itemx --recursive +Operate recursively on directories. + +@item -v +@itemx --verbose +Verbose mode. Show the files being processed. A second @samp{-v} also +shows the files being ignored. + +@item -0 .. -9 +Set the compression level of lzip. By default zupdate passes @samp{-9} +to lzip. + +@end table + + +@node Problems +@chapter Reporting bugs +@cindex bugs +@cindex getting help + +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 +@email{zutils-bug@@nongnu.org}. Include the version number, which you can +find by running @w{@samp{zupdate --version}}. + + +@node Concept index +@unnumbered Concept index + +@printindex cp + +@bye diff --git a/doc/zutils.texinfo b/doc/zutils.texinfo deleted file mode 100644 index e39b51f..0000000 --- a/doc/zutils.texinfo +++ /dev/null @@ -1,744 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c %**start of header -@setfilename zutils.info -@documentencoding ISO-8859-15 -@settitle Zutils Manual -@finalout -@c %**end of header - -@set UPDATED 11 October 2013 -@set VERSION 1.2-pre3 - -@dircategory Data Compression -@direntry -* Zutils: (zutils). Utilities dealing with compressed files -@end direntry - - -@ifnothtml -@titlepage -@title Zutils -@subtitle Utilities dealing with compressed files -@subtitle for Zutils version @value{VERSION}, @value{UPDATED} -@author by Antonio Diaz Diaz - -@page -@vskip 0pt plus 1filll -@end titlepage - -@contents -@end ifnothtml - -@node Top -@top - -This manual is for Zutils (version @value{VERSION}, @value{UPDATED}). - -@menu -* Introduction:: Purpose and features of zutils -* Common options:: Common options -* The zutilsrc file:: The zutils configuration file -* Zcat:: Concatenating compressed files -* Zcmp:: Comparing compressed files byte by byte -* Zdiff:: Comparing compressed files line by line -* Zgrep:: Searching inside compressed files -* Ztest:: Testing integrity of compressed files -* Zupdate:: Recompressing files to lzip format -* Problems:: Reporting bugs -* Concept index:: Index of concepts -@end menu - -@sp 1 -Copyright @copyright{} 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. - -This manual is free documentation: you have unlimited permission -to copy, distribute and modify it. - - -@node Introduction -@chapter Introduction -@cindex introduction - -Zutils is a collection of utilities able to deal with 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. - -These utilities are not wrapper scripts but safer and more efficient C++ -programs. In particular the @samp{--recursive} option is very efficient -in those utilities supporting it. - -@noindent -The provided utilities are zcat, zcmp, zdiff, zgrep, ztest and zupdate.@* -The supported formats are bzip2, gzip, lzip and xz.@* -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 with 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. - -LANGUAGE NOTE: Uncompressed = not compressed = plain data; it may never -have been compressed. Decompressed is used to refer to data which has -undergone the process of decompression. - -@sp 1 -Numbers given as arguments to options (positions, sizes) 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 Common options -@chapter Common options -@cindex 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. - -@table @samp -@item -h -@itemx --help -Print an informative help message describing the options and exit. Zgrep -only supports the @samp{--help} form of this option. - -@item -V -@itemx --version -Print the version number on the standard output and exit. - -@item -N -@itemx --no-rcfile -Don't read the runtime configuration file @samp{zutilsrc}. - -@item --bz2=@var{command} -@itemx --gz=@var{command} -@itemx --lz=@var{command} -@itemx --xz=@var{command} -Set program (may include arguments) to be used as (de)compressor for the -given format. These options override the values set in @file{zutilsrc}. -The compression program used must meet three requirements: - -@enumerate -@item -When called with the @samp{-d} option, it must read compressed data from -the standard input and produce decompressed data on the standard output. -@item -If the @samp{-q} option 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. -@end enumerate - -@end table - - -@node The zutilsrc file -@chapter The zutilsrc file -@cindex the zutilsrc file - -@file{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 @file{zutilsrc} file is optional; you do not need to install it in -order to run zutils. - -The compressors specified in the command line override those specified -in the @file{zutilsrc} file. - -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): - -@enumerate -@item -Any line beginning with @samp{#} is a comment line. -@item -Each non-comment line defines the command to be used for the given -format, with the syntax: -@example - = [options] -@end example -where is one of @samp{bz2}, @samp{gz}, @samp{lz} or @samp{xz}. -@end enumerate - - -@node Zcat -@chapter Zcat -@cindex zcat - -Zcat copies each given file (@samp{-} means standard input), 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 supported formats. - -If no files are specified, data is 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. - -The format for running zcat is: - -@example -zcat [@var{options}] [@var{files}] -@end example - -@noindent -Exit status is 0 if no errors occurred, non-zero otherwise. - -Zcat supports the following options: - -@table @samp -@item -A -@itemx --show-all -Equivalent to @samp{-vET}. - -@item -b -@itemx --number-nonblank -Number all nonblank output lines, starting with 1. The line count is -unlimited. - -@item -e -Equivalent to @samp{-vE}. - -@item -E -@itemx --show-ends -Print a @samp{$} after the end of each line. - -@item --format=@var{fmt} -Force the given compression format. Valid values for @var{fmt} are -@samp{bz2}, @samp{gz}, @samp{lz} and @samp{xz}. If this option is used, -the exact file name must be given. Other names won't be tried. - -@item -n -@itemx --number -Number all output lines, starting with 1. The line count is unlimited. - -@item -q -@itemx --quiet -Quiet operation. Suppress all messages. - -@item -r -@itemx --recursive -Operate recursively on directories. - -@item -s -@itemx --squeeze-blank -Replace multiple adjacent blank lines with a single blank line. - -@item -t -Equivalent to @samp{-vT}. - -@item -T -@itemx --show-tabs -Print TAB characters as @samp{^I}. - -@item -v -@itemx --show-nonprinting -Print control characters except for LF (newline) and TAB using @samp{^} -notation and precede characters larger than 127 with @samp{M-} (which -stands for "meta"). - -@item --verbose -Verbose mode. Show error messages. - -@end table - - -@node Zcmp -@chapter Zcmp -@cindex zcmp - -Zcmp compares two files (@samp{-} 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. - -The format for running zcmp is: - -@example -zcmp [@var{options}] @var{file1} [@var{file2}] -@end example - -@noindent -This compares @var{file1} to @var{file2}. If @var{file2} is omitted zcmp -tries the following: - -@enumerate -@item -If @var{file1} is compressed, compares its decompressed contents with -the corresponding uncompressed file (the name of @var{file1} with the -extension removed). -@item -If @var{file1} is uncompressed, compares it with the decompressed -contents of @var{file1}.[lz|bz2|gz|xz] (the first one that is found). -@item -If no suitable file is found, compares @var{file1} with data read from -standard input. -@end enumerate - -@noindent -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: - -@table @samp -@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"). - -@item --format=[@var{fmt1}][,@var{fmt2}] -Force the given compression formats. Any of @var{fmt1} or @var{fmt2} may -be omitted and the corresponding format will be automatically detected. -Valid values for @var{fmt} are @samp{bz2}, @samp{gz}, @samp{lz} and -@samp{xz}. If at least one format is specified with this option, the -exact file names of both @var{file1} and @var{file2} must be given. -Other names won't be tried. - -@item -i @var{size} -@itemx --ignore-initial=@var{size} -Ignore any differences in the first @var{size} bytes of the input files. -Treat files with fewer than @var{size} bytes as if they were empty. If -@var{size} is in the form @samp{@var{size1},@var{size2}}, ignore the -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. - -@item -n @var{count} -@itemx --bytes=@var{count} -Compare at most @var{count} input bytes. - -@item -q -@itemx -s -@itemx --quiet -@itemx --silent -Do not print anything; only return an exit status indicating whether the -files differ. - -@end table - - -@node Zdiff -@chapter Zdiff -@cindex zdiff - -Zdiff compares two files (@samp{-} 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. - -The format for running zdiff is: - -@example -zdiff [@var{options}] @var{file1} [@var{file2}] -@end example - -@noindent -This compares @var{file1} to @var{file2}. If @var{file2} is omitted -zdiff tries the following: - -@enumerate -@item -If @var{file1} is compressed, compares its decompressed contents with -the corresponding uncompressed file (the name of @var{file1} with the -extension removed). -@item -If @var{file1} is uncompressed, compares it with the decompressed -contents of @var{file1}.[lz|bz2|gz|xz] (the first one that is found). -@item -If no suitable file is found, compares @var{file1} with data read from -standard input. -@end enumerate - -@noindent -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: - -@table @samp -@item -a -@itemx --text -Treat all files as text. - -@item -b -@itemx --ignore-space-change -Ignore changes in the amount of white space. - -@item -B -@itemx --ignore-blank-lines -Ignore changes whose lines are all blank. - -@itemx -c -Use the context output format. - -@item -C @var{n} -@itemx --context=@var{n} -Same as -c but use @var{n} lines of context. - -@item -d -@itemx --minimal -Try hard to find a smaller set of changes. - -@item -E -@itemx --ignore-tab-expansion -Ignore changes due to tab expansion. - -@item --format=[@var{fmt1}][,@var{fmt2}] -Force the given compression formats. Any of @var{fmt1} or @var{fmt2} may -be omitted and the corresponding format will be automatically detected. -Valid values for @var{fmt} are @samp{bz2}, @samp{gz}, @samp{lz} and -@samp{xz}. If at least one format is specified with this option, the -exact file names of both @var{file1} and @var{file2} must be given. -Other names won't be tried. - -@item -i -@itemx --ignore-case -Ignore case differences in file contents. - -@item -p -@itemx --show-c-function -Show which C function each change is in. - -@item -q -@itemx --brief -Output only whether files differ. - -@item -s -@itemx --report-identical-files -Report when two files are identical. - -@item -t -@itemx --expand-tabs -Expand tabs to spaces in output. - -@item -T -@itemx --initial-tab -Make tabs line up by prepending a tab. - -@item -u -Use the unified output format. - -@item -U @var{n} -@itemx --unified=@var{n} -Same as -u but use @var{n} lines of context. - -@item -w -@itemx --ignore-all-space -Ignore all white space. - -@end table - - -@node Zgrep -@chapter Zgrep -@cindex 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 -supported formats. - -If no files are specified, data is 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. - -The format for running zgrep is: - -@example -zgrep [@var{options}] @var{pattern} [@var{files}] -@end example - -@noindent -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: - -@table @samp -@item -a -@itemx --text -Treat all files as text. - -@item -A @var{n} -@itemx --after-context=@var{n} -Print @var{n} lines of trailing context. - -@item -b -@itemx --byte-offset -Print the byte offset of each line. - -@item -B @var{n} -@itemx --before-context=@var{n} -Print @var{n} lines of leading context. - -@item -c -@itemx --count -Only print a count of matching lines per file. - -@item -C @var{n} -@itemx --context=@var{n} -Print @var{n} lines of output context. - -@item -e @var{pattern} -@itemx --regexp=@var{pattern} -Use @var{pattern} as the pattern to match. - -@item -E -@itemx --extended-regexp -Treat @var{pattern} as an extended regular expression. - -@item -f @var{file} -@itemx --file=@var{file} -Obtain patterns from @var{file}, one per line. - -@item -F -@itemx --fixed-strings -Treat @var{pattern} as a set of newline-separated strings. - -@item --format=@var{fmt} -Force the given compression format. Valid values for @var{fmt} are -@samp{bz2}, @samp{gz}, @samp{lz} and @samp{xz}. If this option is used, -the exact file name must be given. Other names won't be tried. - -@item -h -@itemx --no-filename -Suppress the prefixing of filenames on output when multiple files are -searched. - -@item -H -@itemx --with-filename -Print the filename for each match. - -@item -i -@itemx --ignore-case -Ignore case distinctions. - -@item -I -Ignore binary files. - -@item -l -@itemx --files-with-matches -Only print names of files containing at least one match. - -@item -L -@itemx --files-without-match -Only print names of files not containing any matches. - -@item -m @var{n} -@itemx --max-count=@var{n} -Stop after @var{n} matches. - -@item -n -@itemx --line-number -Prefix each matched line with its line number in the input file. - -@item -o -@itemx --only-matching -Show only the part of matching lines that actually matches @var{pattern}. - -@item -q -@itemx --quiet -Suppress all messages. Exit immediately with zero status if any match is -found, even if an error was detected. - -@item -r -@itemx --recursive -Operate recursively on directories. - -@item -s -@itemx --no-messages -Suppress error messages about nonexistent or unreadable files. - -@item -v -@itemx --invert-match -Select non-matching lines. - -@item --verbose -Verbose mode. Show error messages. - -@item -w -@itemx --word-regexp -Match only whole words. - -@item -x -@itemx --line-regexp -Match only whole lines. - -@end table - - -@node Ztest -@chapter Ztest -@cindex ztest - -Ztest verifies the integrity of the specified compressed files. -Uncompressed files are ignored. If no files are specified, the integrity -of compressed data read from standard input is verified. Data read from -standard input must be all in the same compression format. - -Note that some xz files lack integrity information, and therefore can't -be verified as reliably as the other formats can. - -The format for running 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. - -Ztest supports the following options: - -@table @samp -@item --format=@var{fmt} -Force the given compression format. Valid values for @var{fmt} are -@samp{bz2}, @samp{gz}, @samp{lz} and @samp{xz}. If this option is used, -all files not in the given format will fail. - -@item -q -@itemx --quiet -Quiet operation. Suppress all messages. - -@item -r -@itemx --recursive -Operate recursively on directories. - -@item -v -@itemx --verbose -Verbose mode. Show the verify status for each file processed.@* -Further -v's increase the verbosity level. - -@end table - - -@node Zupdate -@chapter Zupdate -@cindex zupdate - -Zupdate recompresses files from bzip2, gzip, and xz formats to lzip -format. The originals are compared with the new files 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. The lzip format -is chosen as destination because it is by far the most appropriate for -long-term data archiving. - -If the lzip compressed version of a file already exists, the file is -skipped unless the @samp{--force} option is given. In this case, if the -comparison 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. - -The names of the original files must have one of the following -extensions: @samp{.bz2}, @samp{.tbz}, @samp{.tbz2}, @samp{.gz}, -@samp{.tgz}, @samp{.xz}, @samp{.txz}. The files produced have the -extensions @samp{.lz} or @samp{.tar.lz}. - -The format for running zupdate is: - -@example -zupdate [@var{options}] [@var{files}] -@end example - -@noindent -Exit status is 0 if all the compressed files were successfully -recompressed (if needed), compared and deleted. Non-zero otherwise. - -Zupdate supports the following options: - -@table @samp -@item -f -@itemx --force -Do not skip a file for which a lzip compressed version already exists. -@samp{--force} compares the content of the input file with the content -of the lzip file and deletes the input file if both contents are -identical. - -@item -k -@itemx --keep -Keep (don't delete) the input file after comparing it with the lzip file. - -@item -l -@itemx --lzip-verbose -Pass a @samp{-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 @samp{-l} shows the progress of compression. Use it together with -@samp{-v} to see the name of the file. - -@item -q -@itemx --quiet -Quiet operation. Suppress all messages. - -@item -r -@itemx --recursive -Operate recursively on directories. - -@item -v -@itemx --verbose -Verbose mode. Show the files being processed. A second @samp{-v} also -shows the files being ignored. - -@item -0 .. -9 -Set the compression level of lzip. By default zupdate passes @samp{-9} -to lzip. - -@end table - - -@node Problems -@chapter Reporting bugs -@cindex bugs -@cindex getting help - -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 -@email{zutils-bug@@nongnu.org}. Include the version number, which you can -find by running @w{@samp{zcmp --version}}. - - -@node Concept index -@unnumbered Concept index - -@printindex cp - -@bye diff --git a/rc.cc b/rc.cc index 3d991fc..0c6f2d4 100644 --- a/rc.cc +++ b/rc.cc @@ -1,5 +1,5 @@ /* Zutils - Utilities dealing with compressed files - Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. + Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ int verbosity = 0; namespace { const char * const config_file_name = "zutilsrc"; -const char * const program_year = "2013"; +const char * const program_year = "2014"; std::string compressor_names[num_formats] = { "bzip2", "gzip", "lzip", "xz" }; // default compressor names diff --git a/rc.h b/rc.h index 9c28e9c..9c8a319 100644 --- a/rc.h +++ b/rc.h @@ -1,5 +1,5 @@ /* Zutils - Utilities dealing with compressed files - Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. + Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/recursive.cc b/recursive.cc index 09aa095..f1fd653 100644 --- a/recursive.cc +++ b/recursive.cc @@ -1,5 +1,5 @@ /* Zutils - Utilities dealing with compressed files - Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. + Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/testsuite/check.sh b/testsuite/check.sh index faf9dd3..b7ae7e4 100755 --- a/testsuite/check.sh +++ b/testsuite/check.sh @@ -1,6 +1,6 @@ #! /bin/sh # check script for Zutils - Utilities dealing with compressed files -# Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. +# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. # # This script is free software: you have unlimited permission # to copy, distribute and modify it. @@ -232,7 +232,7 @@ printf . printf . "${ZDIFF}" -N -q --format=bz2 in.bz2 2> /dev/null if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi -"${ZDIFF}" -N -q --format=,lz in.lz in.bz2 > /dev/null 2> /dev/null +"${ZDIFF}" -N -q --format=,lz in.lz in.bz2 > /dev/null 2>&1 if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi "${ZDIFF}" -N --bad-option 2> /dev/null if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi @@ -347,7 +347,7 @@ cat in.bz2 > x.bz2 || framework_failure cat in.gz > x.gz || framework_failure "${ZUPDATE}" -N --bz2=bad_command x.bz2 2> /dev/null if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi -"${ZUPDATE}" -N --bz2='bzip2 --bad-option' x.bz2 > /dev/null 2> /dev/null +"${ZUPDATE}" -N --bz2='bzip2 --bad-option' x.bz2 > /dev/null 2>&1 if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi "${ZUPDATE}" -N --gz=bad_command x.gz 2> /dev/null if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi diff --git a/zcat.cc b/zcat.cc index a20d514..dc9fd2b 100644 --- a/zcat.cc +++ b/zcat.cc @@ -1,5 +1,5 @@ /* Zcat - decompress and concatenate files to standard output - Copyright (C) 2010, 2011, 2012, 2013 Antonio Diaz Diaz. + Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/zcmp.cc b/zcmp.cc index 761e48e..17020e7 100644 --- a/zcmp.cc +++ b/zcmp.cc @@ -1,5 +1,5 @@ /* Zcmp - decompress and compare two files byte by byte - Copyright (C) 2010, 2011, 2012, 2013 Antonio Diaz Diaz. + Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/zcmpdiff.cc b/zcmpdiff.cc index d02a85f..68eab85 100644 --- a/zcmpdiff.cc +++ b/zcmpdiff.cc @@ -1,5 +1,5 @@ /* Common code for Zcmp and Zdiff - Copyright (C) 2010, 2011, 2012, 2013 Antonio Diaz Diaz. + Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,7 +34,7 @@ struct { const char * from; const char * to; } const known_extensions[] = { int open_instream( const std::string & input_filename ) { - int infd = open( input_filename.c_str(), O_RDONLY | O_BINARY ); + const int infd = open( input_filename.c_str(), O_RDONLY | O_BINARY ); if( infd < 0 ) show_error2( "Can't open input file", input_filename.c_str() ); return infd; diff --git a/zdiff.cc b/zdiff.cc index a57630a..b8be568 100644 --- a/zdiff.cc +++ b/zdiff.cc @@ -1,5 +1,5 @@ /* Zdiff - decompress and compare two files line by line - Copyright (C) 2010, 2011, 2012, 2013 Antonio Diaz Diaz. + Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/zgrep.cc b/zgrep.cc index 47f5983..7730067 100644 --- a/zgrep.cc +++ b/zgrep.cc @@ -1,5 +1,5 @@ /* Zgrep - search compressed files for a regular expression - Copyright (C) 2010, 2011, 2012, 2013 Antonio Diaz Diaz. + Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/ztest.cc b/ztest.cc index c0147a6..0b47fbf 100644 --- a/ztest.cc +++ b/ztest.cc @@ -1,5 +1,5 @@ /* Ztest - verify integrity of compressed files - Copyright (C) 2010, 2011, 2012, 2013 Antonio Diaz Diaz. + Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -79,7 +79,7 @@ void show_help() int open_instream( std::string & input_filename ) { - int infd = open( input_filename.c_str(), O_RDONLY | O_BINARY ); + const int infd = open( input_filename.c_str(), O_RDONLY | O_BINARY ); if( infd < 0 ) show_error2( "Can't open input file", input_filename.c_str() ); return infd; diff --git a/zupdate.cc b/zupdate.cc index 2b88c79..2b6caaf 100644 --- a/zupdate.cc +++ b/zupdate.cc @@ -1,5 +1,5 @@ /* Zupdate - recompress bzip2, gzip, xz files to lzip files - Copyright (C) 2013 Antonio Diaz Diaz. + Copyright (C) 2013, 2014 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -60,10 +60,10 @@ void show_help() "appropriate for long-term data archiving.\n" "\nIf the lzip compressed version of a file already exists, the file is\n" "skipped unless the '--force' option is given. In this case, if the\n" - "comparison fails, an error is returned and the original file is not\n" - "deleted. The operation of zupdate is meant to be safe and not produce\n" - "any data loss. Therefore, existing lzip compressed files are never\n" - "overwritten nor deleted.\n" + "comparison with the existing lzip version fails, an error is returned\n" + "and the original file is not deleted. The operation of zupdate is meant\n" + "to be safe and not produce any data loss. Therefore, existing lzip\n" + "compressed files are never overwritten nor deleted.\n" "\nUsage: zupdate [options] [files]\n" "\nExit status is 0 if all the compressed files were successfully\n" "recompressed (if needed), compared and deleted. Non-zero otherwise.\n" @@ -105,10 +105,14 @@ int cant_execute( const std::string & command, const int status ) void set_permissions( const char * const rname, const struct stat & in_stats ) { bool warning = false; - // fchown will in many cases return with EPERM, which can be safely ignored. - if( ( chown( rname, in_stats.st_uid, in_stats.st_gid ) != 0 && - errno != EPERM ) || - chmod( rname, in_stats.st_mode ) != 0 ) warning = true; + const mode_t mode = in_stats.st_mode; + // chown will in many cases return with EPERM, which can be safely ignored. + if( chown( rname, in_stats.st_uid, in_stats.st_gid ) == 0 ) + { if( chmod( rname, mode ) != 0 ) warning = true; } + else + if( errno != EPERM || + chmod( rname, mode & ~( S_ISUID | S_ISGID | S_ISVTX ) ) != 0 ) + warning = true; struct utimbuf t; t.actime = in_stats.st_atime; t.modtime = in_stats.st_mtime; diff --git a/zutils.cc b/zutils.cc index afce7fc..069a010 100644 --- a/zutils.cc +++ b/zutils.cc @@ -1,5 +1,5 @@ /* Zutils - Utilities dealing with compressed files - Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. + Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -96,7 +96,7 @@ int readblock( const int fd, uint8_t * const buf, const int size ) const int n = read( fd, buf + size - rest, rest ); if( n > 0 ) rest -= n; else if( n == 0 ) break; // EOF - else if( errno != EINTR && errno != EAGAIN ) break; + else if( errno != EINTR ) break; errno = 0; } return size - rest; @@ -114,7 +114,7 @@ int writeblock( const int fd, const uint8_t * const buf, const int size ) { const int n = write( fd, buf + size - rest, rest ); if( n > 0 ) rest -= n; - else if( n < 0 && errno != EINTR && errno != EAGAIN ) break; + else if( n < 0 && errno != EINTR ) break; errno = 0; } return size - rest; diff --git a/zutils.h b/zutils.h index 511ee04..480fb35 100644 --- a/zutils.h +++ b/zutils.h @@ -1,5 +1,5 @@ /* Zutils - Utilities dealing with compressed files - Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. + Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -- cgit v1.2.3