summaryrefslogtreecommitdiffstats
path: root/zgrep.cc
diff options
context:
space:
mode:
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; }