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

@ -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; }