1
0
Fork 0

Merging upstream version 1.16~pre2.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-21 11:20:27 +01:00
parent bfc3807823
commit 2fa5af17f3
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
19 changed files with 455 additions and 205 deletions

21
main.cc
View file

@ -256,17 +256,6 @@ bool open_outstream( const bool force )
}
bool check_tty( const int infd )
{
if( isatty( infd ) )
{
show_error( "I won't read compressed data from a terminal.", 0, true );
return false;
}
return true;
}
void cleanup_and_fail( const int retval )
{
if( delete_output_on_interrupt )
@ -591,6 +580,7 @@ int main( const int argc, const char * const argv[] )
if( filenames.back() != "-" ) filenames_given = true;
}
try {
switch( program_mode )
{
case m_none: internal_error( "invalid operation." ); break;
@ -620,6 +610,9 @@ int main( const int argc, const char * const argv[] )
return split_file( filenames[0], default_output_filename, verbosity, force );
case m_test: break;
}
}
catch( std::bad_alloc ) { show_error( "Not enough memory." ); return 1; }
catch( Error e ) { show_error( e.msg, errno ); return 1; }
if( program_mode == m_test )
outfd = -1;
@ -683,7 +676,11 @@ int main( const int argc, const char * const argv[] )
}
}
if( !check_tty( infd ) ) return 1;
if( isatty( infd ) )
{
show_error( "I won't read compressed data from a terminal.", 0, true );
return 1;
}
if( output_filename.size() && !to_stdout && program_mode != m_test )
delete_output_on_interrupt = true;