Tools: Error messages

This commit is contained in:
Shahram Najm 2023-08-09 12:09:13 +01:00
parent 7e882a34c4
commit d0fd3ed254
4 changed files with 7 additions and 7 deletions

View File

@ -268,8 +268,8 @@ int grib_tool_init(grib_runtime_options* options)
options->idx = grib_fieldset_new_from_files(context, filename,
nfiles, 0, 0, 0, orderby, &ret);
if (ret) {
fprintf(stderr, "Unable to create index for input file %s (%s)",
options->infile_extra->name, grib_get_error_message(ret));
fprintf(stderr, "%s: Unable to create index for input file %s (%s)",
tool_name, options->infile_extra->name, grib_get_error_message(ret));
exit(ret);
}
}
@ -307,7 +307,7 @@ int grib_tool_init(grib_runtime_options* options)
if (grib_options_on("R:")) {
maxAbsoluteError = strtod(absTolStr, &endPtr);
if (*endPtr) {
fprintf(stderr, "Invalid absolute error: '%s'\n", absTolStr);
fprintf(stderr, "%s: Invalid absolute error: '%s'\n", tool_name, absTolStr);
exit(1);
}
}
@ -315,7 +315,7 @@ int grib_tool_init(grib_runtime_options* options)
compare_double = &compare_double_absolute;
global_tolerance = strtod(absTolStr, &endPtr);
if (*endPtr) {
fprintf(stderr, "Invalid absolute error: '%s'\n", absTolStr);
fprintf(stderr, "%s: Invalid absolute error: '%s'\n",tool_name, absTolStr);
exit(1);
}
}

View File

@ -104,7 +104,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
v = (double*)calloc(size, sizeof(double));
if (!v) {
fprintf(stderr, "failed to allocate %ld bytes\n", (long)(size * sizeof(double)));
fprintf(stderr, "%s: Failed to allocate %zu bytes\n", tool_name, size * sizeof(double));
exit(1);
}

View File

@ -265,7 +265,7 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
const char* optionStr = grib_options_get_option("d:");
options->constant = strtod(optionStr, &endPtr);
if (*endPtr) {
fprintf(stderr, "Invalid number for -d option: '%s'\n", optionStr);
fprintf(stderr, "%s: Invalid number for -d option: '%s'\n", tool_name, optionStr);
exit(1);
}
options->repack = 1;

View File

@ -76,7 +76,7 @@ int grib_tool_init(grib_runtime_options* options)
// }
// if (grib_options_on("n:") && grib_options_on("d:")) {
// fprintf(stderr, "Error: -n and -d options are incompatible. Choose one of the two please.\n");
// fprintf(stderr, "%s: -n and -d options are incompatible. Choose one of the two please.\n",tool_name);
// exit(1);
// }