1
0
Fork 0

Merging upstream version 1.0~rc7.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-24 05:41:55 +01:00
parent 70fca17fa7
commit 59f5545caa
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
15 changed files with 82 additions and 55 deletions

View file

@ -1,3 +1,8 @@
2013-04-08 Antonio Diaz Diaz <ant_diaz@teleline.es>
* Version 1.0-rc7 released.
* Zgrep: Fixed output of option '-L' (it behaved like '-l').
2013-03-15 Antonio Diaz Diaz <ant_diaz@teleline.es>
* Version 1.0-rc6 released.

2
NEWS
View file

@ -5,6 +5,8 @@ The new option "--format" has been added to all utilities.
Zgrep no more prefixes the file name to the output by default when
searching one file and "--recursive" has not been selected.
The output of "zgrep -L" has been fixed (it behaved like "zgrep -l").
A deadlock in zcmp, which happens when the "-n" option is used, has been
fixed.

2
configure vendored
View file

@ -8,7 +8,7 @@
args=
no_create=
pkgname=zutils
pkgversion=1.0-rc6
pkgversion=1.0-rc7
progname=zutils
srctrigger=zutils.h

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
.TH ZCAT "1" "March 2013" "Zcat (zutils) 1.0-rc6" "User Commands"
.TH ZCAT "1" "April 2013" "Zcat (zutils) 1.0-rc7" "User Commands"
.SH NAME
Zcat \- decompress and concatenate files to standard output
.SH SYNOPSIS

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
.TH ZCMP "1" "March 2013" "Zcmp (zutils) 1.0-rc6" "User Commands"
.TH ZCMP "1" "April 2013" "Zcmp (zutils) 1.0-rc7" "User Commands"
.SH NAME
Zcmp \- decompress and compare two files byte by byte
.SH SYNOPSIS

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
.TH ZDIFF "1" "March 2013" "Zdiff (zutils) 1.0-rc6" "User Commands"
.TH ZDIFF "1" "April 2013" "Zdiff (zutils) 1.0-rc7" "User Commands"
.SH NAME
Zdiff \- decompress and compare two files line by line
.SH SYNOPSIS

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
.TH ZGREP "1" "March 2013" "Zgrep (zutils) 1.0-rc6" "User Commands"
.TH ZGREP "1" "April 2013" "Zgrep (zutils) 1.0-rc7" "User Commands"
.SH NAME
Zgrep \- search compressed files for a regular expression
.SH SYNOPSIS

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
.TH ZTEST "1" "March 2013" "Ztest (zutils) 1.0-rc6" "User Commands"
.TH ZTEST "1" "April 2013" "Ztest (zutils) 1.0-rc7" "User Commands"
.SH NAME
Ztest \- verify integrity of compressed files
.SH SYNOPSIS

View file

@ -12,7 +12,7 @@ File: zutils.info, Node: Top, Next: Introduction, Up: (dir)
Zutils Manual
*************
This manual is for Zutils (version 1.0-rc6, 15 March 2013).
This manual is for Zutils (version 1.0-rc7, 8 April 2013).
* Menu:
@ -584,14 +584,14 @@ Concept Index

Tag Table:
Node: Top224
Node: Introduction1006
Node: Zcat2593
Node: Zcmp4679
Node: Zdiff7165
Node: Zgrep9831
Node: Ztest12842
Node: Problems14246
Node: Concept Index14775
Node: Introduction1005
Node: Zcat2592
Node: Zcmp4678
Node: Zdiff7164
Node: Zgrep9830
Node: Ztest12841
Node: Problems14245
Node: Concept Index14774

End Tag Table

View file

@ -6,8 +6,8 @@
@finalout
@c %**end of header
@set UPDATED 15 March 2013
@set VERSION 1.0-rc6
@set UPDATED 8 April 2013
@set VERSION 1.0-rc7
@dircategory Data Compression
@direntry

View file

@ -251,7 +251,7 @@ int main( const int argc, const char * const argv[] )
int argind = 0;
int grep_show_name = -1;
bool grep_list = false;
int grep_list_mode = 0; // 1 = list matches, -1 = list non matches
bool grep_pattern_found = false;
for( ; argind < parser.arguments(); ++argind )
{
@ -317,8 +317,8 @@ int main( const int argc, const char * const argv[] )
case 'H': grep_show_name = true; break;
case 'i': grep_args.push_back( "-i" ); break;
case 'I': grep_args.push_back( "-I" ); break;
case 'l': grep_args.push_back( "-l" ); grep_list = true; break;
case 'L': grep_args.push_back( "-L" ); grep_list = true; break;
case 'l': grep_args.push_back( "-l" ); grep_list_mode = 1; break;
case 'L': grep_args.push_back( "-L" ); grep_list_mode = -1; break;
case 'm': grep_args.push_back( "-m" ); grep_args.push_back( arg ); break;
case 'n': grep_args.push_back( "-n" ); break;
case 'o': grep_args.push_back( "-o" ); break;
@ -412,7 +412,7 @@ int main( const int argc, const char * const argv[] )
if( infd == STDIN_FILENO )
tmp = zgrep_stdin( infd, format_type, grep_args );
else tmp = zgrep_file( infd, format_type, input_filename, grep_args,
grep_list, grep_show_name );
grep_list_mode, grep_show_name );
break;
case m_ztest:
if( infd == STDIN_FILENO )

View file

@ -83,13 +83,13 @@ printf .
cmp in6 copy6 || fail=1
printf .
"${ZCAT}" --format=gz in.bz2 2> /dev/null
if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCAT}" --format=bz2 in.lz 2> /dev/null
if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCAT}" --format=lz in.gz 2> /dev/null
if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCAT}" --bad-option 2> /dev/null
if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
printf "\ntesting zcmp-%s..." "$2"
@ -112,16 +112,16 @@ for i in ${extensions}; do
done
"${ZCMP}" in in6 2> /dev/null
if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCMP}" -n 0 in in6 || fail=1
"${ZCMP}" -n 100 in in6 || fail=1
"${ZCMP}" -n 1000 in in6 || fail=1
"${ZCMP}" -n 10000 in in6 || fail=1
printf .
"${ZCMP}" in.tar pin.tar > /dev/null
if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCMP}" -i 0,11 in.tar pin.tar 2> /dev/null
if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCMP}" -i 0,11 -n 0 in.tar pin.tar || fail=1
"${ZCMP}" -i 0,11 -n 100 in.tar pin.tar || fail=1
"${ZCMP}" -i 0,11 -n 1000 in.tar pin.tar || fail=1
@ -162,13 +162,13 @@ printf .
"${ZCMP}" - in < in.lz || fail=1
printf .
"${ZCMP}" -q --format=lz in.lz
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCMP}" --format=lz in.gz in.lz 2> /dev/null
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCMP}" -n -1 in in 2> /dev/null
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZCMP}" --bad-option in in 2> /dev/null
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
printf "\ntesting zdiff-%s..." "$2"
@ -187,9 +187,9 @@ for i in ${extensions}; do
done
"${ZDIFF}" in in6 > /dev/null
if [ $? = 0 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZDIFF}" in.tar pin.tar > /dev/null
if [ $? = 0 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZDIFF}" - || fail=1
printf .
"${ZDIFF}" in in || fail=1
@ -225,11 +225,11 @@ printf .
"${ZDIFF}" - in < in.lz || fail=1
printf .
"${ZDIFF}" -q --format=bz2 in.bz2 2> /dev/null
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZDIFF}" -q --format=,lz in.lz in.bz2 > /dev/null 2> /dev/null
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZDIFF}" --bad-option 2> /dev/null
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
printf "\ntesting zgrep-%s..." "$2"
@ -237,14 +237,22 @@ printf "\ntesting zgrep-%s..." "$2"
for i in ${extensions}; do
"${ZGREP}" "GNU" in.$i > /dev/null || fail=1
printf .
"${ZGREP}" -l "GNU" in.$i > /dev/null || fail=1
printf .
"${ZGREP}" -L "GNU" in.$i || fail=1
printf .
"${ZGREP}" --format=$i "GNU" in.$i > /dev/null || fail=1
printf .
"${ZGREP}" -v "nx_pattern" in.$i > /dev/null || fail=1
printf .
"${ZGREP}" "nx_pattern" in.$i > /dev/null
if [ $? = 0 ] ; then fail=1 ; printf - ; else printf . ; fi
"${ZGREP}" "nx_pattern" in.$i
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZGREP}" -l "nx_pattern" in.$i
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZGREP}" -L "nx_pattern" in.$i > /dev/null
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZGREP}" --format=$i "GNU" in 2> /dev/null
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
done
"${ZGREP}" "GNU" < pin.tar > /dev/null || fail=1
@ -254,7 +262,7 @@ printf .
"${ZGREP}" -r "GNU" . > /dev/null || fail=1
printf .
"${ZGREP}" "nx_pattern" -r . in > /dev/null
if [ $? = 0 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZGREP}" "GNU" < in > /dev/null || fail=1
printf .
"${ZGREP}" "GNU" < in.gz > /dev/null || fail=1
@ -273,8 +281,14 @@ printf .
printf .
"${ZGREP}" -l "GNU" in in.gz in.bz2 in.lz -- -in- > /dev/null || fail=1
printf .
"${ZGREP}" -L "GNU" in in.gz in.bz2 in.lz -- -in- || fail=1
printf .
"${ZGREP}" -l "nx_pattern" in in.gz in.bz2 in.lz -- -in-
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZGREP}" -L "nx_pattern" in in.gz in.bz2 in.lz -- -in- > /dev/null
if [ $? != 0 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZGREP}" --bad-option 2> /dev/null
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZEGREP}" "GNU" in > /dev/null || fail=1
printf .
@ -288,9 +302,9 @@ for i in ${extensions}; do
"${ZTEST}" --format=$i < in.$i || fail=1
printf .
"${ZTEST}" --format=$i < in 2> /dev/null
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZTEST}" --format=$i in 2> /dev/null
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
done
"${ZTEST}" in in.gz in.bz2 in.lz -- -in- || fail=1
@ -304,13 +318,13 @@ printf .
"${ZTEST}" -r . || fail=1
printf .
"${ZTEST}" < in 2> /dev/null
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
dd if=in.lz bs=1000 count=1 2> /dev/null | "${ZTEST}" -q
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZTEST}" --format=lz in.bz2 2> /dev/null
if [ $? != 2 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
"${ZTEST}" --bad-option 2> /dev/null
if [ $? != 1 ] ; then fail=1 ; printf - ; else printf . ; fi
if [ $? = 1 ] ; then printf . ; else printf - ; fail=1 ; fi
echo
if [ ${fail} = 0 ] ; then

View file

@ -31,6 +31,9 @@
#include <stdint.h>
#include <unistd.h>
#include <sys/stat.h>
#if defined(__MSVCRT__) || defined(__OS2__)
#include <io.h>
#endif
#include "arg_parser.h"
#include "zutils.h"
@ -357,8 +360,8 @@ int main( const int argc, const char * const argv[] )
} // end process options
#if defined(__MSVCRT__) || defined(__OS2__)
_fsetmode( stdin, "b" );
_fsetmode( stdout, "b" );
setmode( STDIN_FILENO, O_BINARY );
setmode( STDOUT_FILENO, O_BINARY );
#endif
if( argind >= parser.arguments() )

View file

@ -31,6 +31,9 @@
#include <stdint.h>
#include <unistd.h>
#include <sys/stat.h>
#if defined(__MSVCRT__) || defined(__OS2__)
#include <io.h>
#endif
#include "arg_parser.h"
#include "zutils.h"
@ -313,8 +316,8 @@ int main( const int argc, const char * const argv[] )
} // end process options
#if defined(__MSVCRT__) || defined(__OS2__)
_fsetmode( stdin, "b" );
_fsetmode( stdout, "b" );
setmode( STDIN_FILENO, O_BINARY );
setmode( STDOUT_FILENO, O_BINARY );
#endif
if( argind >= parser.arguments() )

View file

@ -101,7 +101,7 @@ int zgrep_stdin( int infd, const int format_type,
int zgrep_file( int infd, const int format_type,
const std::string & input_filename,
const std::vector< const char * > & grep_args,
const bool grep_list, const bool grep_show_name )
const int grep_list_mode, const bool grep_show_name )
{
pid_t pid;
if( !set_data_feeder( &infd, &pid, format_type ) ) return 2;
@ -137,7 +137,7 @@ int zgrep_file( int infd, const int format_type,
const int size = readblock( fda[0], buffer, buffer_size );
if( size != buffer_size && errno )
{ show_error( "Read error", errno ); return 2; }
if( size > 0 && !grep_list )
if( size > 0 && !grep_list_mode )
{
if( grep_show_name )
for( int i = 0; i < size; ++i )
@ -158,7 +158,7 @@ int zgrep_file( int infd, const int format_type,
{ if( pid ) kill( pid, SIGTERM ); }
else
if( pid && wait_for_child( pid, "data feeder" ) != 0 ) retval = 2;
if( grep_list && retval == 0 )
if( grep_list_mode && (retval == 0) == (grep_list_mode == 1) )
std::printf( "%s\n", input_filename.c_str() );
if( close( infd ) != 0 )
{ show_close_error( "data feeder" ); return 2; }