Merging upstream version 1.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
997ce2ad42
commit
34b309ae87
16 changed files with 84 additions and 79 deletions
49
ChangeLog
49
ChangeLog
|
@ -1,46 +1,21 @@
|
||||||
2013-04-08 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
2013-05-31 Antonio Diaz Diaz <antonio@gnu.org>
|
||||||
|
|
||||||
* 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').
|
* Zgrep: Fixed output of option '-L' (it behaved like '-l').
|
||||||
|
* zcmp.cc: Fixed deadlock when '-n' option is used.
|
||||||
2013-03-15 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
|
||||||
|
|
||||||
* Version 1.0-rc6 released.
|
|
||||||
* zdiff.cc (set_data_feeder): Call decompressor with option "-q"
|
* zdiff.cc (set_data_feeder): Call decompressor with option "-q"
|
||||||
only if verbosity < 0.
|
only if verbosity < 0.
|
||||||
* zutils.cc (set_data_feeder): Likewise.
|
* zutils.cc (set_data_feeder): Likewise.
|
||||||
|
|
||||||
2013-02-21 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
|
||||||
|
|
||||||
* 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 <ant_diaz@teleline.es>
|
|
||||||
|
|
||||||
* 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 <ant_diaz@teleline.es>
|
|
||||||
|
|
||||||
* 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 <ant_diaz@teleline.es>
|
|
||||||
|
|
||||||
* Version 1.0-rc2 released.
|
|
||||||
* Minor fixes.
|
|
||||||
* configure: 'datadir' renamed to 'datarootdir'.
|
|
||||||
|
|
||||||
2012-01-18 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
|
||||||
|
|
||||||
* Version 1.0-rc1 released.
|
|
||||||
* Changed quote characters in messages as advised by GNU Standards.
|
* 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.
|
* INSTALL: Document installing zutils along with GNU gzip.
|
||||||
|
|
||||||
2011-01-11 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
2011-01-11 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||||
|
|
2
INSTALL
2
INSTALL
|
@ -1,7 +1,7 @@
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
You will need a C++ compiler.
|
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.
|
standards compliant compiler.
|
||||||
Gcc is available at http://gcc.gnu.org.
|
Gcc is available at http://gcc.gnu.org.
|
||||||
|
|
||||||
|
|
4
NEWS
4
NEWS
|
@ -14,11 +14,11 @@ Decompressors are now invoked without the "-q" option except if
|
||||||
explicitly requested, as some simplified implementations do not accept
|
explicitly requested, as some simplified implementations do not accept
|
||||||
it.
|
it.
|
||||||
|
|
||||||
Minor fixes.
|
|
||||||
|
|
||||||
Quote characters in messages have been changed as advised by GNU Coding
|
Quote characters in messages have been changed as advised by GNU Coding
|
||||||
Standards.
|
Standards.
|
||||||
|
|
||||||
|
"configure" now accepts options with a separate argument.
|
||||||
|
|
||||||
Configure option "--datadir" has been renamed to "--datarootdir" to
|
Configure option "--datadir" has been renamed to "--datarootdir" to
|
||||||
follow GNU Standards.
|
follow GNU Standards.
|
||||||
|
|
||||||
|
|
4
README
4
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
|
Zcat, zcmp, zdiff, and zgrep are improved replacements for the shell
|
||||||
scripts provided with GNU gzip. Ztest is unique to zutils.
|
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.
|
Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz.
|
||||||
|
|
||||||
|
|
38
configure
vendored
38
configure
vendored
|
@ -5,10 +5,8 @@
|
||||||
# This configure script is free software: you have unlimited permission
|
# This configure script is free software: you have unlimited permission
|
||||||
# to copy, distribute and modify it.
|
# to copy, distribute and modify it.
|
||||||
|
|
||||||
args=
|
|
||||||
no_create=
|
|
||||||
pkgname=zutils
|
pkgname=zutils
|
||||||
pkgversion=1.0-rc7
|
pkgversion=1.0
|
||||||
progname=zutils
|
progname=zutils
|
||||||
srctrigger=zutils.h
|
srctrigger=zutils.h
|
||||||
|
|
||||||
|
@ -30,18 +28,19 @@ DIFF=diff
|
||||||
GREP=grep
|
GREP=grep
|
||||||
|
|
||||||
# checking whether we are using GNU C++.
|
# checking whether we are using GNU C++.
|
||||||
if [ ! -x /bin/g++ ] &&
|
${CXX} --version > /dev/null 2>&1
|
||||||
[ ! -x /usr/bin/g++ ] &&
|
if [ $? != 0 ] ; then
|
||||||
[ ! -x /usr/local/bin/g++ ] ; then
|
|
||||||
CXX=c++
|
CXX=c++
|
||||||
CXXFLAGS='-W -O2'
|
CXXFLAGS='-W -O2'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Loop over all args
|
# Loop over all args
|
||||||
while [ -n "$1" ] ; do
|
args=
|
||||||
|
no_create=
|
||||||
|
while [ $# != 0 ] ; do
|
||||||
|
|
||||||
# Get the first arg, and shuffle
|
# Get the first arg, and shuffle
|
||||||
option=$1
|
option=$1 ; arg2=no
|
||||||
shift
|
shift
|
||||||
|
|
||||||
# Add the argument quoted to args
|
# Add the argument quoted to args
|
||||||
|
@ -78,6 +77,14 @@ while [ -n "$1" ] ; do
|
||||||
--version | -V)
|
--version | -V)
|
||||||
echo "Configure script for ${pkgname} version ${pkgversion}"
|
echo "Configure script for ${pkgname} version ${pkgversion}"
|
||||||
exit 0 ;;
|
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} ;;
|
--srcdir=*) srcdir=${optarg} ;;
|
||||||
--prefix=*) prefix=${optarg} ;;
|
--prefix=*) prefix=${optarg} ;;
|
||||||
--exec-prefix=*) exec_prefix=${optarg} ;;
|
--exec-prefix=*) exec_prefix=${optarg} ;;
|
||||||
|
@ -94,11 +101,22 @@ while [ -n "$1" ] ; do
|
||||||
DIFF=*) DIFF=${optarg} ;;
|
DIFF=*) DIFF=${optarg} ;;
|
||||||
GREP=*) GREP=${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 ;;
|
exit 1 ;;
|
||||||
esac
|
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
|
done
|
||||||
|
|
||||||
# Find the source files, if location was not specified.
|
# Find the source files, if location was not specified.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
|
.\" 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
|
.SH NAME
|
||||||
Zcat \- decompress and concatenate files to standard output
|
Zcat \- decompress and concatenate files to standard output
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
|
.\" 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
|
.SH NAME
|
||||||
Zcmp \- decompress and compare two files byte by byte
|
Zcmp \- decompress and compare two files byte by byte
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -20,7 +20,7 @@ If <file1> is compressed, compares <file1> to the file with the
|
||||||
corresponding decompressed file name (removes the extension from
|
corresponding decompressed file name (removes the extension from
|
||||||
<file1>).
|
<file1>).
|
||||||
If <file1> is not compressed, compares <file1> to the uncompressed
|
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).
|
||||||
If no suitable file is found, compares <file1> to data read from
|
If no suitable file is found, compares <file1> to data read from
|
||||||
standard input.
|
standard input.
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
|
.\" 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
|
.SH NAME
|
||||||
Zdiff \- decompress and compare two files line by line
|
Zdiff \- decompress and compare two files line by line
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -20,7 +20,7 @@ If <file1> is compressed, compares <file1> to the file with the
|
||||||
corresponding decompressed file name (removes the extension from
|
corresponding decompressed file name (removes the extension from
|
||||||
<file1>).
|
<file1>).
|
||||||
If <file1> is not compressed, compares <file1> to the uncompressed
|
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).
|
||||||
If no suitable file is found, compares <file1> to data read from
|
If no suitable file is found, compares <file1> to data read from
|
||||||
standard input.
|
standard input.
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
|
.\" 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
|
.SH NAME
|
||||||
Zgrep \- search compressed files for a regular expression
|
Zgrep \- search compressed files for a regular expression
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
|
.\" 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
|
.SH NAME
|
||||||
Ztest \- verify integrity of compressed files
|
Ztest \- verify integrity of compressed files
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|
|
@ -12,7 +12,7 @@ File: zutils.info, Node: Top, Next: Introduction, Up: (dir)
|
||||||
Zutils Manual
|
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:
|
* 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
|
Zcat, zcmp, zdiff, and zgrep are improved replacements for the shell
|
||||||
scripts provided with GNU gzip. Ztest is unique to zutils.
|
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
|
Numbers given as arguments to options (positions, sizes) may be
|
||||||
followed by a multiplier and an optional `B' for "byte".
|
followed by a multiplier and an optional `B' for "byte".
|
||||||
|
@ -181,7 +185,7 @@ following:
|
||||||
FILE1).
|
FILE1).
|
||||||
|
|
||||||
2. If FILE1 is not compressed, compares FILE1 to the uncompressed
|
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
|
3. If no suitable file is found, compares FILE1 to data read from
|
||||||
standard input.
|
standard input.
|
||||||
|
@ -264,7 +268,7 @@ following:
|
||||||
FILE1).
|
FILE1).
|
||||||
|
|
||||||
2. If FILE1 is not compressed, compares FILE1 to the uncompressed
|
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
|
3. If no suitable file is found, compares FILE1 to data read from
|
||||||
standard input.
|
standard input.
|
||||||
|
@ -584,14 +588,14 @@ Concept Index
|
||||||
|
|
||||||
Tag Table:
|
Tag Table:
|
||||||
Node: Top224
|
Node: Top224
|
||||||
Node: Introduction1005
|
Node: Introduction1000
|
||||||
Node: Zcat2592
|
Node: Zcat2794
|
||||||
Node: Zcmp4678
|
Node: Zcmp4880
|
||||||
Node: Zdiff7164
|
Node: Zdiff7366
|
||||||
Node: Zgrep9830
|
Node: Zgrep10032
|
||||||
Node: Ztest12841
|
Node: Ztest13043
|
||||||
Node: Problems14245
|
Node: Problems14447
|
||||||
Node: Concept Index14774
|
Node: Concept Index14976
|
||||||
|
|
||||||
End Tag Table
|
End Tag Table
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
@finalout
|
@finalout
|
||||||
@c %**end of header
|
@c %**end of header
|
||||||
|
|
||||||
@set UPDATED 8 April 2013
|
@set UPDATED 31 May 2013
|
||||||
@set VERSION 1.0-rc7
|
@set VERSION 1.0
|
||||||
|
|
||||||
@dircategory Data Compression
|
@dircategory Data Compression
|
||||||
@direntry
|
@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
|
Zcat, zcmp, zdiff, and zgrep are improved replacements for the shell
|
||||||
scripts provided with GNU gzip. Ztest is unique to zutils.
|
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
|
@sp 1
|
||||||
Numbers given as arguments to options (positions, sizes) may be followed
|
Numbers given as arguments to options (positions, sizes) may be followed
|
||||||
by a multiplier and an optional @samp{B} for "byte".
|
by a multiplier and an optional @samp{B} for "byte".
|
||||||
|
@ -211,7 +215,7 @@ corresponding decompressed file name (removes the extension from
|
||||||
@var{file1}).
|
@var{file1}).
|
||||||
@item
|
@item
|
||||||
If @var{file1} is not compressed, compares @var{file1} to the
|
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).
|
is found).
|
||||||
@item
|
@item
|
||||||
If no suitable file is found, compares @var{file1} to data read from
|
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}).
|
@var{file1}).
|
||||||
@item
|
@item
|
||||||
If @var{file1} is not compressed, compares @var{file1} to the
|
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).
|
is found).
|
||||||
@item
|
@item
|
||||||
If no suitable file is found, compares @var{file1} to data read from
|
If no suitable file is found, compares @var{file1} to data read from
|
||||||
|
|
2
zcmp.cc
2
zcmp.cc
|
@ -67,7 +67,7 @@ void show_help()
|
||||||
"corresponding decompressed file name (removes the extension from\n"
|
"corresponding decompressed file name (removes the extension from\n"
|
||||||
"<file1>).\n"
|
"<file1>).\n"
|
||||||
"If <file1> is not compressed, compares <file1> to the uncompressed\n"
|
"If <file1> is not compressed, compares <file1> to the uncompressed\n"
|
||||||
"contents of <file1>.[bz2|gz|lz|xz] (the first one that is found).\n"
|
"contents of <file1>.[lz|bz2|gz|xz] (the first one that is found).\n"
|
||||||
"If no suitable file is found, compares <file1> to data read from\n"
|
"If no suitable file is found, compares <file1> to data read from\n"
|
||||||
"standard input.\n"
|
"standard input.\n"
|
||||||
"\nExit status is 0 if inputs are identical, 1 if different, 2 if trouble.\n"
|
"\nExit status is 0 if inputs are identical, 1 if different, 2 if trouble.\n"
|
||||||
|
|
2
zdiff.cc
2
zdiff.cc
|
@ -65,7 +65,7 @@ void show_help()
|
||||||
"corresponding decompressed file name (removes the extension from\n"
|
"corresponding decompressed file name (removes the extension from\n"
|
||||||
"<file1>).\n"
|
"<file1>).\n"
|
||||||
"If <file1> is not compressed, compares <file1> to the uncompressed\n"
|
"If <file1> is not compressed, compares <file1> to the uncompressed\n"
|
||||||
"contents of <file1>.[bz2|gz|lz|xz] (the first one that is found).\n"
|
"contents of <file1>.[lz|bz2|gz|xz] (the first one that is found).\n"
|
||||||
"If no suitable file is found, compares <file1> to data read from\n"
|
"If no suitable file is found, compares <file1> to data read from\n"
|
||||||
"standard input.\n"
|
"standard input.\n"
|
||||||
"\nExit status is 0 if inputs are identical, 1 if different, 2 if trouble.\n"
|
"\nExit status is 0 if inputs are identical, 1 if different, 2 if trouble.\n"
|
||||||
|
|
|
@ -54,13 +54,13 @@ int readblock( const int fd, uint8_t * const buf, const int size )
|
||||||
errno = 0;
|
errno = 0;
|
||||||
while( rest > 0 )
|
while( rest > 0 )
|
||||||
{
|
{
|
||||||
errno = 0;
|
|
||||||
const int n = read( fd, buf + size - rest, rest );
|
const int n = read( fd, buf + size - rest, rest );
|
||||||
if( n > 0 ) rest -= n;
|
if( n > 0 ) rest -= n;
|
||||||
else if( n == 0 ) break; // EOF
|
else if( n == 0 ) break; // EOF
|
||||||
else if( errno != EINTR && errno != EAGAIN ) break;
|
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;
|
errno = 0;
|
||||||
while( rest > 0 )
|
while( rest > 0 )
|
||||||
{
|
{
|
||||||
errno = 0;
|
|
||||||
const int n = write( fd, buf + size - rest, rest );
|
const int n = write( fd, buf + size - rest, rest );
|
||||||
if( n > 0 ) rest -= n;
|
if( n > 0 ) rest -= n;
|
||||||
else if( n < 0 && errno != EINTR && errno != EAGAIN ) break;
|
else if( n < 0 && errno != EINTR && errno != EAGAIN ) break;
|
||||||
|
errno = 0;
|
||||||
}
|
}
|
||||||
return ( rest > 0 ) ? size - rest : size;
|
return size - rest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
2
zutils.h
2
zutils.h
|
@ -30,7 +30,7 @@ const char * const simple_extensions[num_formats] =
|
||||||
const char * const decompressor_names[num_formats] =
|
const char * const decompressor_names[num_formats] =
|
||||||
{ "bzip2", "gzip", "lzip", "xz" };
|
{ "bzip2", "gzip", "lzip", "xz" };
|
||||||
const int8_t format_order[num_formats] =
|
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
|
// first magic byte must be different among formats
|
||||||
enum { bzip2_magic_size = 3,
|
enum { bzip2_magic_size = 3,
|
||||||
|
|
Loading…
Add table
Reference in a new issue