Minor nits with stdout/stderr.

This commit is contained in:
veggie 2015-01-26 10:35:25 -05:00 committed by Manuel Pégourié-Gonnard
parent 2a9c8b62bf
commit 64a5799637
3 changed files with 10 additions and 9 deletions

View file

@ -62,7 +62,7 @@ int main( int argc, char *argv[] )
if( ( f = fopen( argv[1], "wb+" ) ) == NULL ) if( ( f = fopen( argv[1], "wb+" ) ) == NULL )
{ {
polarssl_printf( "failed to open '%s' for writing.\n", argv[0] ); polarssl_printf( "failed to open '%s' for writing.\n", argv[1] );
return( 1 ); return( 1 );
} }
@ -79,14 +79,15 @@ int main( int argc, char *argv[] )
fwrite( buf, 1, sizeof( buf ), f ); fwrite( buf, 1, sizeof( buf ), f );
polarssl_printf( "Generating 32Mb of data in file '%s'... %04.1f" \ polarssl_printf( "Generating %ldkb of data in file '%s'... %04.1f" \
"%% done\r", argv[1], (100 * (float) (i + 1)) / k ); "%% done\r", (long)(sizeof(buf) * k / 1024), argv[1], (100 * (float) (i + 1)) / k );
fflush( stdout ); fflush( stdout );
} }
ret = 0; ret = 0;
cleanup: cleanup:
printf( "\n" );
fclose( f ); fclose( f );
entropy_free( &entropy ); entropy_free( &entropy );

View file

@ -64,7 +64,7 @@ int main( int argc, char *argv[] )
if( ( f = fopen( argv[1], "wb+" ) ) == NULL ) if( ( f = fopen( argv[1], "wb+" ) ) == NULL )
{ {
polarssl_printf( "failed to open '%s' for writing.\n", argv[0] ); polarssl_printf( "failed to open '%s' for writing.\n", argv[1] );
return( 1 ); return( 1 );
} }
@ -108,8 +108,8 @@ int main( int argc, char *argv[] )
fwrite( buf, 1, sizeof( buf ), f ); fwrite( buf, 1, sizeof( buf ), f );
polarssl_printf( "Generating 32Mb of data in file '%s'... %04.1f" \ polarssl_printf( "Generating %ldkb of data in file '%s'... %04.1f" \
"%% done\r", argv[1], (100 * (float) (i + 1)) / k ); "%% done\r", (long)(sizeof(buf) * k / 1024), argv[1], (100 * (float) (i + 1)) / k );
fflush( stdout ); fflush( stdout );
} }

View file

@ -64,7 +64,7 @@ int main( int argc, char *argv[] )
if( ( f = fopen( argv[1], "wb+" ) ) == NULL ) if( ( f = fopen( argv[1], "wb+" ) ) == NULL )
{ {
polarssl_printf( "failed to open '%s' for writing.\n", argv[0] ); polarssl_printf( "failed to open '%s' for writing.\n", argv[1] );
return( 1 ); return( 1 );
} }
@ -84,8 +84,8 @@ int main( int argc, char *argv[] )
fwrite( buf, sizeof( buf ), 1, f ); fwrite( buf, sizeof( buf ), 1, f );
polarssl_printf( "Generating 32Mb of data in file '%s'... %04.1f" \ polarssl_printf( "Generating %ldkb of data in file '%s'... %04.1f" \
"%% done\r", argv[1], (100 * (float) (i + 1)) / k ); "%% done\r", (long)(sizeof(buf) * k / 1024), argv[1], (100 * (float) (i + 1)) / k );
fflush( stdout ); fflush( stdout );
} }