summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 14:03:45 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 14:03:45 +0000
commit8e588bc047fbb5af60a8eb44f5e5715f035888fc (patch)
treecd40dee12f5e790ea1540b9151e2354b14c092ba /main.c
parentAdding upstream version 1.6~pre3. (diff)
downloadlzlib-8e588bc047fbb5af60a8eb44f5e5715f035888fc.tar.xz
lzlib-8e588bc047fbb5af60a8eb44f5e5715f035888fc.zip
Adding upstream version 1.6~pre4.upstream/1.6_pre4
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'main.c')
-rw-r--r--main.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/main.c b/main.c
index 5c53b00..d2e8730 100644
--- a/main.c
+++ b/main.c
@@ -35,7 +35,7 @@
#include <unistd.h>
#include <utime.h>
#include <sys/stat.h>
-#if defined(__MSVCRT__) || defined(_MSC_VER)
+#if defined(__MSVCRT__)
#include <io.h>
#define fchmod(x,y) 0
#define fchown(x,y,z) 0
@@ -154,7 +154,7 @@ static void Pp_show_msg( struct Pretty_print * const pp, const char * const msg
for( i = 0; i < len; ++i ) fprintf( stderr, " " );
if( !msg ) fflush( stderr );
}
- if( msg ) fprintf( stderr, "%s.\n", msg );
+ if( msg ) fprintf( stderr, "%s\n", msg );
}
}
@@ -559,7 +559,7 @@ static int do_compress( struct LZ_Encoder * const encoder,
return 1;
}
if( rd > 0 && rd != LZ_compress_write( encoder, buffer, rd ) )
- internal_error( "library error (LZ_compress_write)" );
+ internal_error( "library error (LZ_compress_write)." );
if( rd < size ) LZ_compress_finish( encoder );
/* else LZ_compress_sync_flush( encoder ); */
in_size += rd;
@@ -582,7 +582,7 @@ static int do_compress( struct LZ_Encoder * const encoder,
return 1;
}
}
- else if( in_size == 0 ) internal_error( "library error (LZ_compress_read)" );
+ else if( in_size == 0 ) internal_error( "library error (LZ_compress_read)." );
if( LZ_compress_member_finished( encoder ) )
{
unsigned long long size;
@@ -597,7 +597,7 @@ static int do_compress( struct LZ_Encoder * const encoder,
{
close_and_set_permissions( in_statsp );
if( !next_filename() )
- { Pp_show_msg( pp, "Too many volume files" ); return 1; }
+ { Pp_show_msg( pp, "Too many volume files." ); return 1; }
if( !open_outstream( true ) ) return 1;
delete_output_on_interrupt = true;
}
@@ -650,9 +650,9 @@ int compress( const unsigned long long member_size,
if( !encoder || LZ_compress_errno( encoder ) != LZ_ok )
{
if( !encoder || LZ_compress_errno( encoder ) == LZ_mem_error )
- Pp_show_msg( pp, "Not enough memory. Try a smaller dictionary size" );
+ Pp_show_msg( pp, "Not enough memory. Try a smaller dictionary size." );
else
- internal_error( "invalid argument to encoder" );
+ internal_error( "invalid argument to encoder." );
retval = 1;
}
else retval = do_compress( encoder, member_size, volume_size,
@@ -683,7 +683,7 @@ int do_decompress( struct LZ_Decoder * const decoder, const int infd,
return 1;
}
if( in_size > 0 && in_size != LZ_decompress_write( decoder, buffer, in_size ) )
- internal_error( "library error (LZ_decompress_write)" );
+ internal_error( "library error (LZ_decompress_write)." );
if( in_size < max_in_size ) LZ_decompress_finish( decoder );
}
while( true )
@@ -733,16 +733,16 @@ int do_decompress( struct LZ_Decoder * const decoder, const int infd,
if( lz_errno == LZ_header_error || ( first_member && out_size == 0 ) )
{
if( !first_member ) break; /* trailing garbage */
- Pp_show_msg( pp, "Bad magic number (file not in lzip format)" );
+ Pp_show_msg( pp, "Bad magic number (file not in lzip format)." );
return 2;
}
if( lz_errno == LZ_mem_error )
- { Pp_show_msg( pp, "Not enough memory" ); return 1; }
+ { Pp_show_msg( pp, "Not enough memory." ); return 1; }
if( verbosity >= 0 )
{
Pp_show_msg( pp, 0 );
if( lz_errno == LZ_unexpected_eof )
- fprintf( stderr, "File ends unexpectedly at pos %llu\n",
+ fprintf( stderr, "File ends unexpectedly at pos %llu.\n",
LZ_decompress_total_in_size( decoder ) );
else
fprintf( stderr, "Decoder error at pos %llu: %s.\n",
@@ -753,7 +753,7 @@ int do_decompress( struct LZ_Decoder * const decoder, const int infd,
}
if( LZ_decompress_finished( decoder ) == 1 ) break;
if( in_size == 0 && out_size == 0 )
- internal_error( "library error (LZ_decompress_read)" );
+ internal_error( "library error (LZ_decompress_read)." );
}
return 0;
}
@@ -766,7 +766,7 @@ int decompress( const int infd, struct Pretty_print * const pp,
int retval;
if( !decoder || LZ_decompress_errno( decoder ) != LZ_ok )
- { Pp_show_msg( pp, "Not enough memory" ); retval = 1; }
+ { Pp_show_msg( pp, "Not enough memory." ); retval = 1; }
else retval = do_decompress( decoder, infd, pp, testing );
LZ_decompress_close( decoder );
@@ -797,7 +797,7 @@ void show_error( const char * const msg, const int errcode, const bool help )
if( msg && msg[0] )
{
fprintf( stderr, "%s: %s", program_name, msg );
- if( errcode > 0 ) fprintf( stderr, ": %s", strerror( errcode ) );
+ if( errcode > 0 ) fprintf( stderr, ": %s.", strerror( errcode ) );
fprintf( stderr, "\n" );
}
if( help )
@@ -810,7 +810,7 @@ void show_error( const char * const msg, const int errcode, const bool help )
void internal_error( const char * const msg )
{
if( verbosity >= 0 )
- fprintf( stderr, "%s: internal error: %s.\n", program_name, msg );
+ fprintf( stderr, "%s: internal error: %s\n", program_name, msg );
exit( 3 );
}
@@ -887,9 +887,9 @@ int main( const int argc, const char * const argv[] )
invocation_name = argv[0];
if( LZ_version()[0] != LZ_version_string[0] )
- internal_error( "bad library version" );
+ internal_error( "bad library version." );
if( strcmp( PROGVERSION, LZ_version_string ) != 0 )
- internal_error( "bad library version_string" );
+ internal_error( "bad library version_string." );
if( !ap_init( &parser, argc, argv, options, 0 ) )
{ show_error( "Not enough memory.", 0, false ); return 1; }
@@ -925,11 +925,11 @@ int main( const int argc, const char * const argv[] )
case 't': program_mode = m_test; break;
case 'v': if( verbosity < 4 ) ++verbosity; break;
case 'V': show_version(); return 0;
- default : internal_error( "uncaught option" );
+ default : internal_error( "uncaught option." );
}
} /* end process options */
-#if defined(__MSVCRT__) || defined(__OS2__) || defined(_MSC_VER)
+#if defined(__MSVCRT__) || defined(__OS2__)
setmode( STDIN_FILENO, O_BINARY );
setmode( STDOUT_FILENO, O_BINARY );
#endif