Tools: print stdin if input filter is '-'

This commit is contained in:
Shahram Najm 2020-07-19 15:19:31 +01:00
parent 2e295d5674
commit 0d04b7aa9a
2 changed files with 6 additions and 2 deletions

View File

@ -55,7 +55,9 @@ int grib_tool_init(grib_runtime_options* options)
{
options->action = grib_action_from_filter(options->infile_extra->name);
if (!options->action) {
fprintf(stderr, "%s: error unable to create action\n", options->infile_extra->name);
const char* filt = options->infile_extra->name;
if (strcmp(filt, "-")==0) filt = "stdin";
fprintf(stderr, "Error: %s: unable to create action\n", filt);
exit(1);
}

View File

@ -51,7 +51,9 @@ int grib_tool_init(grib_runtime_options* options)
{
options->action = grib_action_from_filter(options->infile_extra->name);
if (!options->action) {
fprintf(stderr, "%s: error unable to create action\n", options->infile_extra->name);
const char* filt = options->infile_extra->name;
if (strcmp(filt, "-")==0) filt = "stdin";
fprintf(stderr, "Error: %s: unable to create action\n", filt);
exit(1);
}