Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/BLAKE2/BLAKE2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/b2sum
diff options
context:
space:
mode:
authorArtem Chudinov <arzeth0@gmail.com>2015-10-30 20:03:12 +0300
committerArtem Chudinov <arzeth0@gmail.com>2015-10-30 20:03:12 +0300
commit01f12dbc5ccf2fdb552339218ac92402a5f2ab22 (patch)
tree0cfd71546a5c9474566a35c892ba52d21f25c98f /b2sum
parent7b8a7433407e411a5a838f3eb1f0bb6cb07b305e (diff)
b2sum: Get rid of two `goto`
Diffstat (limited to 'b2sum')
-rw-r--r--b2sum/b2sum.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/b2sum/b2sum.c b/b2sum/b2sum.c
index e9cd526..ebf1757 100644
--- a/b2sum/b2sum.c
+++ b/b2sum/b2sum.c
@@ -258,10 +258,11 @@ int main( int argc, char **argv )
int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] = {
- { "help", no_argument, 0, 0 },
- { "tag", no_argument, 0, 0 },
+ { "help", no_argument, 0, 0 },
+ { "tag", no_argument, 0, 0 },
{ NULL, 0, NULL, 0 }
};
+
c = getopt_long( argc, argv, "a:", long_options, &option_index );
if( c == -1 ) break;
switch( c )
@@ -322,34 +323,34 @@ int main( int argc, char **argv )
if( !f )
{
fprintf( stderr, "Could not open `%s': %s\n", argv[i], strerror( errno ) );
- goto end0;
+ continue;
}
if( blake2_stream( f, hash ) < 0 )
{
fprintf( stderr, "Failed to hash `%s'\n", argv[i] );
- goto end1;
}
-
- if( bsdstyle )
+ else
{
- if( blake2_stream == blake2b_stream ) printf( "BLAKE2b" );
- else if( blake2_stream == blake2bp_stream ) printf( "BLAKE2bp" );
- else if( blake2_stream == blake2s_stream ) printf( "BLAKE2s" );
- else if( blake2_stream == blake2sp_stream ) printf( "BLAKE2sp" );
- printf( " (%s) = ", argv[i] );
- }
+ if( bsdstyle )
+ {
+ if( blake2_stream == blake2b_stream ) printf( "BLAKE2b" );
+ else if( blake2_stream == blake2bp_stream ) printf( "BLAKE2bp" );
+ else if( blake2_stream == blake2s_stream ) printf( "BLAKE2s" );
+ else if( blake2_stream == blake2sp_stream ) printf( "BLAKE2sp" );
+ printf( " (%s) = ", argv[i] );
+ }
- for( int j = 0; j < outlen; ++j )
- printf( "%02x", hash[j] );
+ for( int j = 0; j < outlen; ++j )
+ printf( "%02x", hash[j] );
+
+ if( bsdstyle )
+ printf( "\n" );
+ else
+ printf( " %s\n", argv[i] );
+ }
- if( bsdstyle )
- printf( "\n" );
- else
- printf( " %s\n", argv[i] );
-end1:
if( f != stdin ) fclose( f );
-end0: ;
}
return 0;