summaryrefslogtreecommitdiffstats
path: root/zgrep.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:25:23 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:25:23 +0000
commit8566aaafaa90f4d8225628f26b5d394292165a57 (patch)
treec652849f0274c7b8d1a5103faf77dd040ae9d8ca /zgrep.cc
parentAdding upstream version 1.0~rc6. (diff)
downloadzutils-8566aaafaa90f4d8225628f26b5d394292165a57.tar.xz
zutils-8566aaafaa90f4d8225628f26b5d394292165a57.zip
Adding upstream version 1.0~rc7.upstream/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; }