From 8e7d86c466470db9ed54f711046d5e96d3f6ee5a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 8 Nov 2015 05:26:17 +0100 Subject: Merging upstream version 1.0. Signed-off-by: Daniel Baumann --- ChangeLog | 49 ++++++++++++------------------------------------- INSTALL | 2 +- NEWS | 4 ++-- README | 4 ++++ configure | 38 ++++++++++++++++++++++++++++---------- doc/zcat.1 | 2 +- doc/zcmp.1 | 4 ++-- doc/zdiff.1 | 4 ++-- doc/zgrep.1 | 2 +- doc/ztest.1 | 2 +- doc/zutils.info | 26 +++++++++++++++----------- doc/zutils.texinfo | 12 ++++++++---- zcmp.cc | 2 +- zdiff.cc | 2 +- zutils.cc | 8 ++++---- zutils.h | 2 +- 16 files changed, 84 insertions(+), 79 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9445e68..7140457 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,46 +1,21 @@ -2013-04-08 Antonio Diaz Diaz +2013-05-31 Antonio Diaz Diaz - * Version 1.0-rc7 released. + * Version 1.0 released. + * Added 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'). - -2013-03-15 Antonio Diaz Diaz - - * Version 1.0-rc6 released. + * zcmp.cc: Fixed deadlock when '-n' option is used. * zdiff.cc (set_data_feeder): Call decompressor with option "-q" only if verbosity < 0. * zutils.cc (set_data_feeder): Likewise. - -2013-02-21 Antonio Diaz Diaz - - * Version 1.0-rc5 released. - * main.cc (main): Zgrep now shows file names by default when - '--recursive' is selected. - * zcmp.cc: Fixed deadlock when '-n' option is used. - * main.cc: Use 'setmode' instead of '_setmode' on Windows and OS/2. - -2012-12-04 Antonio Diaz Diaz - - * Version 1.0-rc4 released. - * main.cc (main): Make 'grep_show_name' tri-state so that file name - is no prefixed to output by default when searching one file. - * zcat.cc (Line_number): Fixed a portability issue with Solaris 9. - -2012-10-26 Antonio Diaz Diaz - - * Version 1.0-rc3 released. - * Added new option '--format' to all utilities. - * Makefile.in: Added new target 'install-bin'. - -2012-04-30 Antonio Diaz Diaz - - * Version 1.0-rc2 released. - * Minor fixes. - * configure: 'datadir' renamed to 'datarootdir'. - -2012-01-18 Antonio Diaz Diaz - - * Version 1.0-rc1 released. * Changed 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'. + * Use 'setmode' instead of '_setmode' on Windows and OS/2. + * zcat.cc (Line_number): Fixed a portability issue with Solaris 9. * INSTALL: Document installing zutils along with GNU gzip. 2011-01-11 Antonio Diaz Diaz diff --git a/INSTALL b/INSTALL index 18a372a..13f8af3 100644 --- a/INSTALL +++ b/INSTALL @@ -1,7 +1,7 @@ Requirements ------------ You will need a C++ compiler. -I use gcc 4.7.2 and 3.3.6, but the code should compile with any +I use gcc 4.8.0 and 3.3.6, but the code should compile with any standards compliant compiler. Gcc is available at http://gcc.gnu.org. diff --git a/NEWS b/NEWS index a2b4694..aa99159 100644 --- a/NEWS +++ b/NEWS @@ -14,11 +14,11 @@ Decompressors are now invoked without the "-q" option except if explicitly requested, as some simplified implementations do not accept it. -Minor fixes. - Quote characters in messages have been changed as advised by GNU Coding Standards. +"configure" now accepts options with a separate argument. + Configure option "--datadir" has been renamed to "--datarootdir" to follow GNU Standards. diff --git a/README b/README index fb812cb..1d5c7da 100644 --- a/README +++ b/README @@ -16,6 +16,10 @@ The supported formats are bzip2, gzip, lzip and xz. Zcat, zcmp, zdiff, and zgrep are improved replacements for the shell scripts provided with GNU gzip. Ztest is unique to 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 backends for zutils. + Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz. diff --git a/configure b/configure index 3c80638..6447312 100755 --- a/configure +++ b/configure @@ -5,10 +5,8 @@ # This configure script is free software: you have unlimited permission # to copy, distribute and modify it. -args= -no_create= pkgname=zutils -pkgversion=1.0-rc7 +pkgversion=1.0 progname=zutils srctrigger=zutils.h @@ -30,18 +28,19 @@ DIFF=diff GREP=grep # checking whether we are using GNU C++. -if [ ! -x /bin/g++ ] && - [ ! -x /usr/bin/g++ ] && - [ ! -x /usr/local/bin/g++ ] ; then +${CXX} --version > /dev/null 2>&1 +if [ $? != 0 ] ; then CXX=c++ CXXFLAGS='-W -O2' fi # Loop over all args -while [ -n "$1" ] ; do +args= +no_create= +while [ $# != 0 ] ; do # Get the first arg, and shuffle - option=$1 + option=$1 ; arg2=no shift # Add the argument quoted to args @@ -78,6 +77,14 @@ while [ -n "$1" ] ; do --version | -V) echo "Configure script for ${pkgname} version ${pkgversion}" exit 0 ;; + --srcdir) srcdir=$1 ; arg2=yes ;; + --prefix) prefix=$1 ; arg2=yes ;; + --exec-prefix) exec_prefix=$1 ; arg2=yes ;; + --bindir) bindir=$1 ; arg2=yes ;; + --datarootdir) datarootdir=$1 ; arg2=yes ;; + --infodir) infodir=$1 ; arg2=yes ;; + --mandir) mandir=$1 ; arg2=yes ;; + --srcdir=*) srcdir=${optarg} ;; --prefix=*) prefix=${optarg} ;; --exec-prefix=*) exec_prefix=${optarg} ;; @@ -94,11 +101,22 @@ while [ -n "$1" ] ; do DIFF=*) DIFF=${optarg} ;; GREP=*) GREP=${optarg} ;; - --* | *=* | *-*-*) ;; + --*) + echo "configure: WARNING: unrecognized option: '${option}'" 1>&2 ;; + *=* | *-*-*) ;; *) - echo "configure: Unrecognized option: \"${option}\"; use --help for usage." 1>&2 + echo "configure: unrecognized option: '${option}'" 1>&2 + echo "Try 'configure --help' for more information." exit 1 ;; esac + + # Check if the option took a separate argument + if [ "${arg2}" = yes ] ; then + if [ $# != 0 ] ; then args="${args} \"$1\"" ; shift + else echo "configure: Missing argument to '${option}'" 1>&2 + exit 1 + fi + fi done # Find the source files, if location was not specified. diff --git a/doc/zcat.1 b/doc/zcat.1 index 5018140..146e6e0 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" "April 2013" "Zcat (zutils) 1.0-rc7" "User Commands" +.TH ZCAT "1" "May 2013" "Zcat (zutils) 1.0" "User Commands" .SH NAME Zcat \- decompress and concatenate files to standard output .SH SYNOPSIS diff --git a/doc/zcmp.1 b/doc/zcmp.1 index 9ef3a65..68f44fd 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" "April 2013" "Zcmp (zutils) 1.0-rc7" "User Commands" +.TH ZCMP "1" "May 2013" "Zcmp (zutils) 1.0" "User Commands" .SH NAME Zcmp \- decompress and compare two files byte by byte .SH SYNOPSIS @@ -20,7 +20,7 @@ If is compressed, compares to the file with the corresponding decompressed file name (removes the extension from ). If is not compressed, compares to the uncompressed -contents of .[bz2|gz|lz|xz] (the first one that is found). +contents of .[lz|bz2|gz|xz] (the first one that is found). If no suitable file is found, compares to data read from standard input. .PP diff --git a/doc/zdiff.1 b/doc/zdiff.1 index e77fe1d..be9d335 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" "April 2013" "Zdiff (zutils) 1.0-rc7" "User Commands" +.TH ZDIFF "1" "May 2013" "Zdiff (zutils) 1.0" "User Commands" .SH NAME Zdiff \- decompress and compare two files line by line .SH SYNOPSIS @@ -20,7 +20,7 @@ If is compressed, compares to the file with the corresponding decompressed file name (removes the extension from ). If is not compressed, compares to the uncompressed -contents of .[bz2|gz|lz|xz] (the first one that is found). +contents of .[lz|bz2|gz|xz] (the first one that is found). If no suitable file is found, compares to data read from standard input. .PP diff --git a/doc/zgrep.1 b/doc/zgrep.1 index 764a178..452c26d 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" "April 2013" "Zgrep (zutils) 1.0-rc7" "User Commands" +.TH ZGREP "1" "May 2013" "Zgrep (zutils) 1.0" "User Commands" .SH NAME Zgrep \- search compressed files for a regular expression .SH SYNOPSIS diff --git a/doc/ztest.1 b/doc/ztest.1 index 420b68e..7169021 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" "April 2013" "Ztest (zutils) 1.0-rc7" "User Commands" +.TH ZTEST "1" "May 2013" "Ztest (zutils) 1.0" "User Commands" .SH NAME Ztest \- verify integrity of compressed files .SH SYNOPSIS diff --git a/doc/zutils.info b/doc/zutils.info index 79bc5b8..77e2035 100644 --- a/doc/zutils.info +++ b/doc/zutils.info @@ -12,7 +12,7 @@ File: zutils.info, Node: Top, Next: Introduction, Up: (dir) Zutils Manual ************* -This manual is for Zutils (version 1.0-rc7, 8 April 2013). +This manual is for Zutils (version 1.0, 31 May 2013). * Menu: @@ -53,6 +53,10 @@ The supported formats are bzip2, gzip, lzip and xz. Zcat, zcmp, zdiff, and zgrep are improved replacements for the shell scripts provided with GNU gzip. Ztest is unique to 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 backends for zutils. + Numbers given as arguments to options (positions, sizes) may be followed by a multiplier and an optional `B' for "byte". @@ -181,7 +185,7 @@ following: FILE1). 2. If FILE1 is not compressed, compares FILE1 to the uncompressed - contents of FILE1.[bz2|gz|lz|xz] (the first one that is found). + contents of FILE1.[lz|bz2|gz|xz] (the first one that is found). 3. If no suitable file is found, compares FILE1 to data read from standard input. @@ -264,7 +268,7 @@ following: FILE1). 2. If FILE1 is not compressed, compares FILE1 to the uncompressed - contents of FILE1.[bz2|gz|lz|xz] (the first one that is found). + contents of FILE1.[lz|bz2|gz|xz] (the first one that is found). 3. If no suitable file is found, compares FILE1 to data read from standard input. @@ -584,14 +588,14 @@ Concept Index  Tag Table: Node: Top224 -Node: Introduction1005 -Node: Zcat2592 -Node: Zcmp4678 -Node: Zdiff7164 -Node: Zgrep9830 -Node: Ztest12841 -Node: Problems14245 -Node: Concept Index14774 +Node: Introduction1000 +Node: Zcat2794 +Node: Zcmp4880 +Node: Zdiff7366 +Node: Zgrep10032 +Node: Ztest13043 +Node: Problems14447 +Node: Concept Index14976  End Tag Table diff --git a/doc/zutils.texinfo b/doc/zutils.texinfo index b5a2413..ed65997 100644 --- a/doc/zutils.texinfo +++ b/doc/zutils.texinfo @@ -6,8 +6,8 @@ @finalout @c %**end of header -@set UPDATED 8 April 2013 -@set VERSION 1.0-rc7 +@set UPDATED 31 May 2013 +@set VERSION 1.0 @dircategory Data Compression @direntry @@ -74,6 +74,10 @@ The supported formats are bzip2, gzip, lzip and xz. Zcat, zcmp, zdiff, and zgrep are improved replacements for the shell scripts provided with GNU gzip. Ztest is unique to 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 backends for zutils. + @sp 1 Numbers given as arguments to options (positions, sizes) may be followed by a multiplier and an optional @samp{B} for "byte". @@ -211,7 +215,7 @@ corresponding decompressed file name (removes the extension from @var{file1}). @item If @var{file1} is not compressed, compares @var{file1} to the -uncompressed contents of @var{file1}.[bz2|gz|lz|xz] (the first one that +uncompressed contents of @var{file1}.[lz|bz2|gz|xz] (the first one that is found). @item If no suitable file is found, compares @var{file1} to data read from @@ -303,7 +307,7 @@ corresponding decompressed file name (removes the extension from @var{file1}). @item If @var{file1} is not compressed, compares @var{file1} to the -uncompressed contents of @var{file1}.[bz2|gz|lz|xz] (the first one that +uncompressed contents of @var{file1}.[lz|bz2|gz|xz] (the first one that is found). @item If no suitable file is found, compares @var{file1} to data read from diff --git a/zcmp.cc b/zcmp.cc index 0a4c1fc..0e5b781 100644 --- a/zcmp.cc +++ b/zcmp.cc @@ -67,7 +67,7 @@ void show_help() "corresponding decompressed file name (removes the extension from\n" ").\n" "If is not compressed, compares to the uncompressed\n" - "contents of .[bz2|gz|lz|xz] (the first one that is found).\n" + "contents of .[lz|bz2|gz|xz] (the first one that is found).\n" "If no suitable file is found, compares to data read from\n" "standard input.\n" "\nExit status is 0 if inputs are identical, 1 if different, 2 if trouble.\n" diff --git a/zdiff.cc b/zdiff.cc index ee8c014..14b679e 100644 --- a/zdiff.cc +++ b/zdiff.cc @@ -65,7 +65,7 @@ void show_help() "corresponding decompressed file name (removes the extension from\n" ").\n" "If is not compressed, compares to the uncompressed\n" - "contents of .[bz2|gz|lz|xz] (the first one that is found).\n" + "contents of .[lz|bz2|gz|xz] (the first one that is found).\n" "If no suitable file is found, compares to data read from\n" "standard input.\n" "\nExit status is 0 if inputs are identical, 1 if different, 2 if trouble.\n" diff --git a/zutils.cc b/zutils.cc index 798da03..850504a 100644 --- a/zutils.cc +++ b/zutils.cc @@ -54,13 +54,13 @@ int readblock( const int fd, uint8_t * const buf, const int size ) errno = 0; while( rest > 0 ) { - errno = 0; 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; + errno = 0; } - return ( rest > 0 ) ? size - rest : size; + return size - rest; } @@ -73,12 +73,12 @@ int writeblock( const int fd, const uint8_t * const buf, const int size ) errno = 0; while( rest > 0 ) { - errno = 0; const int n = write( fd, buf + size - rest, rest ); if( n > 0 ) rest -= n; else if( n < 0 && errno != EINTR && errno != EAGAIN ) break; + errno = 0; } - return ( rest > 0 ) ? size - rest : size; + return size - rest; } diff --git a/zutils.h b/zutils.h index 778daa3..1a2bb93 100644 --- a/zutils.h +++ b/zutils.h @@ -30,7 +30,7 @@ const char * const simple_extensions[num_formats] = const char * const decompressor_names[num_formats] = { "bzip2", "gzip", "lzip", "xz" }; const int8_t format_order[num_formats] = - { fmt_gz, fmt_lz, fmt_bz2, fmt_xz }; // search order + { fmt_lz, fmt_bz2, fmt_gz, fmt_xz }; // search order // first magic byte must be different among formats enum { bzip2_magic_size = 3, -- cgit v1.2.3