Tools: Increase coverage

This commit is contained in:
Shahram Najm 2023-12-23 14:18:23 +00:00
parent d670455ff0
commit 21298e4489
2 changed files with 7 additions and 13 deletions

View File

@ -34,11 +34,10 @@ metar_file=metar.txt
f=$metar_file
echo $f >> $fLog
${tools_dir}/metar_dump $f >> $fLog
${tools_dir}/metar_dump -w count=1 $f >> $fLog
${tools_dir}/metar_dump -Dat $f >> $fLog
${tools_dir}/metar_dump -OH $f >> $fLog
#-------------------------------------------
# Test "-p" switch
#-------------------------------------------
ref_dump=$f".dump.ref"
res_dump=$f".dump.test"
REDIRECT=/dev/null

View File

@ -47,7 +47,7 @@ int grib_tool_before_getopt(grib_runtime_options* options)
int grib_tool_init(grib_runtime_options* options)
{
int opt = grib_options_on("C") + grib_options_on("O") + grib_options_on("D");
int opt = grib_options_on("O") + grib_options_on("D");
options->dump_mode = (char*)"default";
@ -66,16 +66,11 @@ int grib_tool_init(grib_runtime_options* options)
options->dump_flags = GRIB_DUMP_FLAG_VALUES | GRIB_DUMP_FLAG_READ_ONLY;
}
if (grib_options_on("J")) {
if (grib_options_on("j")) {
options->dump_mode = (char*)"json";
options->dump_flags = GRIB_DUMP_FLAG_VALUES | GRIB_DUMP_FLAG_READ_ONLY;
}
if (grib_options_on("X")) {
options->dump_mode = (char*)"xml";
options->dump_flags = GRIB_DUMP_FLAG_VALUES | GRIB_DUMP_FLAG_READ_ONLY;
}
if (grib_options_on("a"))
options->dump_flags |= GRIB_DUMP_FLAG_ALIASES;
@ -104,7 +99,7 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi
if (!options->current_infile->name)
return 0;
snprintf(tmp, 1024, "FILE: %s ", options->current_infile->name);
if (!grib_options_on("C") && !grib_options_on("J") && !grib_options_on("X"))
if ( !grib_options_on("C") && !grib_options_on("j") )
fprintf(stdout, "***** %s\n", tmp);
return 0;
}
@ -123,7 +118,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
grib_set_flag(h, options->print_keys[i].name, GRIB_ACCESSOR_FLAG_DUMP);
snprintf(tmp, 1024, "MESSAGE %d ( length=%ld )", options->handle_count, length);
if (!grib_options_on("C") && !grib_options_on("X") && !grib_options_on("J"))
if (!grib_options_on("C") && !grib_options_on("j"))
fprintf(stdout, "#============== %-38s ==============\n", tmp);
if (!strcmp(options->dump_mode, "default")) {
GRIB_CHECK_NOLINE(grib_get_string(h, "identifier", identifier, &idlen), 0);