GRIB-387: grib_ls does not print value for key of type BYTES unless type specifier is given

This commit is contained in:
Shahram Najm 2013-06-14 11:38:40 +01:00
parent 6a56eb9852
commit 0dd424b03a
1 changed files with 655 additions and 665 deletions

View File

@ -248,10 +248,8 @@ static int grib_tool_with_orderby(grib_runtime_options* options) {
grib_tool_print_key_values(options,h);
grib_handle_delete(h);
}
grib_tool_finalise_action(options);
return 0;
@ -287,14 +285,12 @@ static int grib_tool_without_orderby(grib_runtime_options* options) {
setvbuf(infile->file,iobuf,_IOFBF,sizeof(iobuf));
options->file_count++;
infile->handle_count=0;
infile->filter_handle_count=0;
grib_tool_new_file_action(options,infile);
while(!options->skip_all && ((h = grib_handle_new_from_file_x(c,infile->file,options->mode,
options->headers_only,&err))
!= NULL || err != GRIB_SUCCESS ) ) {
@ -336,7 +332,6 @@ static int grib_tool_without_orderby(grib_runtime_options* options) {
grib_print_key_values(options,h);
grib_handle_delete(h);
}
grib_print_file_statistics(options,infile);
@ -350,7 +345,6 @@ static int grib_tool_without_orderby(grib_runtime_options* options) {
infile=infile->next;
options->current_infile=infile;
}
grib_print_full_statistics(options);
@ -387,7 +381,6 @@ static int navigate(grib_field_tree* fields,grib_runtime_options* options) {
return err;
}
static int grib_tool_index(grib_runtime_options* options) {
int err=0;
grib_context* c=NULL;
@ -433,9 +426,7 @@ static int grib_tool_index(grib_runtime_options* options) {
printf("\t%s\n",k2->name);
k2=k2->next;
}
exit(1);
}
k1->value[0]=0;
@ -561,7 +552,6 @@ static int process(grib_context* c,grib_runtime_options* options,const char* pat
grib_tool_new_filename_action(options,path);
}
return 0;
}
static int grib_tool_onlyfiles(grib_runtime_options* options) {
@ -671,9 +661,7 @@ static void grib_tools_set_print_keys(grib_runtime_options* options, grib_handle
printf("ERROR: namespace \"%s\" does not contain any key\n",ns);
exit(1);
}
}
}
static int to_skip(grib_handle* h,grib_values* v,int *err) {
@ -704,7 +692,6 @@ static int to_skip(grib_handle* h,grib_values* v,int *err) {
default:
fprintf(dump_file,"invalid type for %s\n",v->name);
exit(1);
}
return ret;
@ -757,7 +744,8 @@ void grib_skip_check(grib_runtime_options* options,grib_handle* h) {
}
}
void grib_print_key_values(grib_runtime_options* options,grib_handle* h) {
void grib_print_key_values(grib_runtime_options* options,grib_handle* h)
{
int i=0;
int ret=0,width=0;
int strlenvalue=0;
@ -790,6 +778,9 @@ void grib_print_key_values(grib_runtime_options* options,grib_handle* h) {
ret=grib_get_long( h,options->print_keys[i].name,&lvalue);
sprintf(value,"%ld", lvalue);
break;
case GRIB_TYPE_BYTES:
ret=grib_get_string( h,options->print_keys[i].name,value,&len);
break;
default:
fprintf(dump_file,"invalid format option for %s\n",options->print_keys[i].name);
exit(1);
@ -868,7 +859,6 @@ void grib_print_key_values(grib_runtime_options* options,grib_handle* h) {
if (written_to_dump) {
fprintf(dump_file,"\n");
}
}
@ -900,13 +890,15 @@ void grib_print_file_statistics(grib_runtime_options* options,grib_tools_file* f
*/
}
void grib_print_full_statistics(grib_runtime_options* options) {
void grib_print_full_statistics(grib_runtime_options* options)
{
if (options->print_statistics && options->verbose)
fprintf(dump_file,"%d of %d total grib messages in %d files\n",
options->filter_handle_count,options->handle_count,options->file_count);
}
}
void grib_tools_write_message(grib_runtime_options* options, grib_handle* h) {
void grib_tools_write_message(grib_runtime_options* options, grib_handle* h)
{
const void *buffer;
size_t size;
grib_file* of = NULL;
@ -994,5 +986,3 @@ void grib_tools_write_message(grib_runtime_options* options, grib_handle* h) {
#endif
}