summaryrefslogtreecommitdiffstats
path: root/zgrep.cc
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 /zgrep.cc
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 'zgrep.cc')
-rw-r--r--zgrep.cc6
1 files changed, 3 insertions, 3 deletions
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; }