#include <errno.h>
#include "SHA3api_ref.h"
+#define TRYHELP_GOODBYE() do { printf("Try 'skein%dsum --help' for more information.\n", hashbitlen); exit(1); } while(0)
+
extern const int hashbitlen;
#define MaxNmberFiles 10
static struct option const long_options[] =
{
- { "binary", no_argument, NULL, 'b' },
- { "check", no_argument, NULL, 'c' },
- { "quiet", no_argument, NULL, QUIET_OPTION },
- { "status", no_argument, NULL, STATUS_OPTION },
- { "text", no_argument, NULL, 't' },
- { "warn", no_argument, NULL, 'w' },
- { "tag", no_argument, NULL, TAG_OPTION },
- { "help", no_argument, NULL, HELP_OPTION },
+ { "binary", no_argument, NULL, 'b' },
+ { "check", no_argument, NULL, 'c' },
+ { "quiet", no_argument, NULL, QUIET_OPTION },
+ { "status", no_argument, NULL, STATUS_OPTION },
+ { "text", no_argument, NULL, 't' },
+ { "warn", no_argument, NULL, 'w' },
+ { "tag", no_argument, NULL, TAG_OPTION },
+ { "help", no_argument, NULL, HELP_OPTION },
{ "version", no_argument, NULL, VERSION_OPTION },
{ NULL, 0, NULL, 0 }
};
case HELP_OPTION : print_usage(); /* ..never returns */
case VERSION_OPTION : print_version(); /* ..never returns */
- default:
- printf("Try `skein%dsum --help' for more information.\n",hashbitlen);
- exit(1);
+ default: TRYHELP_GOODBYE();
}
}
if (check == 1 || quiet == 1 || warn == 1 || status == 1)
{
printf("skein%dsum: the --binary and --text options are meaningless when verifying checksums\n",hashbitlen);
- printf("Try 'skein%dsum --help' for more information.\n",hashbitlen);
- exit(0);
+ TRYHELP_GOODBYE();
}
if(number_files > 0)
{
if (check == 1 || quiet == 1 || warn == 1 || status == 1)
{
printf("skein%dsum: the --binary and --text options are meaningless when verifying checksums\n",hashbitlen);
- printf("Try 'skein%dsum --help' for more information.\n",hashbitlen);
- exit(0);
+ TRYHELP_GOODBYE();
}
if(number_files > 0)
{
printf("skein%dsum: the --status option is meaningful only when verifying checksums\n",hashbitlen);
if(warn == 1)
printf("skein%dsum: the --warn option is meaningful only when verifying checksums\n",hashbitlen);
-
- printf("Try 'skein%dsum --help' for more information.\n",hashbitlen);
- exit(1);
+ TRYHELP_GOODBYE();
}
if(number_files > 0)
{// hashing files
if(tag == 1)
{
printf("skein%dsum: the --tag option is meaningless when verifying checksums\n",hashbitlen);
- printf("Try 'skein%dsum --help' for more information\n",hashbitlen);
- exit(1);
+ TRYHELP_GOODBYE();
}
int index_files = 0;
while(index_files < number_files)