diff --git a/tools/grib_compare.cc b/tools/grib_compare.cc index b82377dea..dbcb8ed7e 100644 --- a/tools/grib_compare.cc +++ b/tools/grib_compare.cc @@ -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); } } diff --git a/tools/grib_copy.cc b/tools/grib_copy.cc index 20823e2a5..ccc4c690a 100644 --- a/tools/grib_copy.cc +++ b/tools/grib_copy.cc @@ -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); } diff --git a/tools/grib_options.cc b/tools/grib_options.cc index 6f1af95fe..78e82d1d8 100644 --- a/tools/grib_options.cc +++ b/tools/grib_options.cc @@ -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; diff --git a/tools/grib_set.cc b/tools/grib_set.cc index 4e47264c6..13adcde65 100644 --- a/tools/grib_set.cc +++ b/tools/grib_set.cc @@ -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); // }