/*check if file is accessible*/
if (file_name && (!is_file_readable(file_name)))
{
- print_logo();
- FPRINTF(stderr, T("Given input file is not readable:\n%s\n\n%s\n\n"), file_name ? file_name : T("<STDIN>"), STRERROR(errno));
+ if (!param->ignore_errors)
+ {
+ print_logo();
+ FPRINTF(stderr, T("Given input file is not readable:\n%s\n\n%s\n\n"), file_name ? file_name : T("<STDIN>"), STRERROR(errno));
+ }
return 0;
}
/*open source file*/
if (!(source = file_name ? FOPEN(file_name, T("rb")) : stdin))
{
- print_logo();
- FPRINTF(stderr, T("Failed to open input file:\n%s\n\n%s\n\n"), file_name ? file_name : T("<STDIN>"), STRERROR(errno));
+ if (!param->ignore_errors)
+ {
+ print_logo();
+ FPRINTF(stderr, T("Failed to open input file:\n%s\n\n%s\n\n"), file_name ? file_name : T("<STDIN>"), STRERROR(errno));
+ }
return 0;
}
/*check file error status*/
if ((!g_interrupted) && ferror(source))
{
- print_logo();
- FPUTS(T("File read error has occurred!\n"), stderr);
+ if (!param->ignore_errors)
+ {
+ print_logo();
+ FPUTS(T("File read error has occurred!\n"), stderr);
+ }
fclose(source);
return 0;
}
if (!process_file(multi_file, ¶m, &bytes_total, argv[file_id++]))
{
retval = EXIT_FAILURE;
- break;
+ if (!param.ignore_errors)
+ {
+ break; /*fail!*/
+ }
}
}
}
/*check if file is accessible*/
if (file_name && (!is_file_readable(file_name)))
{
- print_logo();
- FPRINTF(stderr, T("Given input file is not readable:\n%s\n\n%s\n\n"), file_name ? file_name : T("<STDIN>"), STRERROR(errno));
+ if (!param->ignore_errors)
+ {
+ print_logo();
+ FPRINTF(stderr, T("Given input file is not readable:\n%s\n\n%s\n\n"), file_name ? file_name : T("<STDIN>"), STRERROR(errno));
+ }
return 0;
}
/*open source file*/
if (!(source = file_name ? FOPEN(file_name, T("rb")) : stdin))
{
- print_logo();
- FPRINTF(stderr, T("Failed to open input file:\n%s\n\n%s\n\n"), file_name ? file_name : T("<STDIN>"), STRERROR(errno));
+ if (!param->ignore_errors)
+ {
+ print_logo();
+ FPRINTF(stderr, T("Failed to open input file:\n%s\n\n%s\n\n"), file_name ? file_name : T("<STDIN>"), STRERROR(errno));
+ }
return 0;
}
/*check file error status*/
if ((!g_interrupted) && ferror(source))
{
- print_logo();
- FPUTS(T("File read error has occurred!\n"), stderr);
+ if (!param->ignore_errors)
+ {
+ print_logo();
+ FPUTS(T("File read error has occurred!\n"), stderr);
+ }
fclose(source);
return 0;
}
if (!process_file(multi_file, ¶m, &bytes_total, argv[file_id++]))
{
retval = EXIT_FAILURE;
- break;
+ if (!param.ignore_errors)
+ {
+ break; /*fail!*/
+ }
}
}
}
int use_upper_case;
int curly_brackets;
int raw_output;
+ int ignore_errors;
}
param_t;
FPUTS(T(" -c, --curly print digest using C-style curly brackets\n"), stderr);
FPUTS(T(" -r, --raw output \"raw\" bytes (no \"hex\" encoding)\n"), stderr);
FPUTS(T(" -b, --bench compute and print throughput\n"), stderr);
+ FPUTS(T(" -i, --ignore ignore errors and proceed with ntext file\n"), stderr);
FPUTS(T(" -v, --version print the version string and exit\n"), stderr);
FPUTS(T(" -t, --test execute self-test and exit\n"), stderr);
FPUTS(T(" -h, --help print this help screen and exit\n\n"), stderr);
param->enable_bench = 1;
return 1;
}
+ if (IS_OPTION(argv, is_long, T('i'), T("ignore")))
+ {
+ param->ignore_errors = 1;
+ return 1;
+ }
if (IS_OPTION(argv, is_long, T('p'), T("progress")))
{
param->show_progress = 1;