summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:25:30 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:25:30 +0000
commit26f1d5c221a20e4c9858e6ab2ac0c2fed8fdbdd4 (patch)
tree56d8448080a67622474e76f86071049a7c7d1ae9
parentAdding debian version 1.0~rc6-1. (diff)
downloadzutils-26f1d5c221a20e4c9858e6ab2ac0c2fed8fdbdd4.tar.xz
zutils-26f1d5c221a20e4c9858e6ab2ac0c2fed8fdbdd4.zip
Merging upstream version 1.0~rc7.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r--ChangeLog5
-rw-r--r--NEWS2
-rwxr-xr-xconfigure2
-rw-r--r--doc/zcat.12
-rw-r--r--doc/zcmp.12
-rw-r--r--doc/zdiff.12
-rw-r--r--doc/zgrep.12
-rw-r--r--doc/ztest.12
-rw-r--r--doc/zutils.info18
-rw-r--r--doc/zutils.texinfo4
-rw-r--r--main.cc8
-rwxr-xr-xtestsuite/check.sh68
-rw-r--r--zcmp.cc7
-rw-r--r--zdiff.cc7
-rw-r--r--zgrep.cc6
15 files changed, 82 insertions, 55 deletions
diff --git a/ChangeLog b/ChangeLog
index fb6093e..9445e68 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/NEWS b/NEWS
index b2e9b43..a2b4694 100644
--- a/NEWS
+++ b/NEWS
@@ -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.
diff --git a/configure b/configure
index 4b9c6b3..3c80638 100755
--- a/configure
+++ b/configure
@@ -8,7 +8,7 @@
args=
no_create=
pkgname=zutils
-pkgversion=1.0-rc6
+pkgversion=1.0-rc7
progname=zutils
srctrigger=zutils.h
diff --git a/doc/zcat.1 b/doc/zcat.1
index 5e06419..5018140 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" "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
diff --git a/doc/zcmp.1 b/doc/zcmp.1
index 9b1d510..9ef3a65 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" "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
diff --git a/doc/zdiff.1 b/doc/zdiff.1
index 65c9a84..e77fe1d 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" "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
diff --git a/doc/zgrep.1 b/doc/zgrep.1
index a56ace6..764a178 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" "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
diff --git a/doc/ztest.1 b/doc/ztest.1
index 74d7102..420b68e 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" "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
diff --git a/doc/zutils.info b/doc/zutils.info
index 9c27308..79bc5b8 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-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
diff --git a/doc/zutils.texinfo b/doc/zutils.texinfo
index af1fd90..b5a2413 100644
--- a/doc/zutils.texinfo
+++ b/doc/zutils.texinfo
@@ -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
diff --git a/main.cc b/main.cc
index 0440f77..f0a66e1 100644
--- a/main.cc
+++ b/main.cc
@@ -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 )
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 85217fc..2faa2b7 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -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
diff --git a/zcmp.cc b/zcmp.cc
index c2fdd7a..0a4c1fc 100644
--- a/zcmp.cc
+++ b/zcmp.cc
@@ -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() )
diff --git a/zdiff.cc b/zdiff.cc
index 7419929..ee8c014 100644
--- a/zdiff.cc
+++ b/zdiff.cc
@@ -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() )
diff --git a/zgrep.cc b/zgrep.cc
index c642da7..7bbb448 100644
--- a/zgrep.cc
+++ b/zgrep.cc
@@ -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; }