39 printf (
"Usage: \n" );
40 printf (
"bufrdeco_test -i input_file [-h][more optional args...]\n" );
41 printf (
" -h Print this help\n" );
42 printf (
" -i Input file. Complete input path file for bufr file\n" );
43 printf (
" -J. Information, tree and data in json format. Equivalent to option -E01234\n" );
44 printf (
" -S first..last . Print only results for subsets in range first..last (First subset available is 0). Default is all subsets\n" );
45 printf (
" -T. Print expanded tree in json format\n" );
46 printf (
" -X. Extract first BUFR buffer found in input file (from first 'BUFR' item to next '7777')\n" );
47 printf (
" -0. Prints BUFR Sec 0 information in json format\n" );
48 printf (
" -1. Prints BUFR Sec 1 information in json format\n" );
49 printf (
" -2. Prints BUFR Sec 2 information in json format\n" );
50 printf (
" -3. Prints BUFR Sec 3 information in json format\n" );
51 printf (
" -4. Prints BUFR data in json format\n" );
79 while ( ( iopt = getopt ( _argc, _argv,
"hi:JXT01234" ) ) !=-1 )
121 if ( strlen ( optarg ) < 128 &&
122 strspn ( optarg,
"0123456789." ) == strlen ( optarg ) )
124 if ( strstr ( optarg,
".." ) != NULL )
126 strcpy ( aux, optarg );
127 c = strstr ( aux,
".." );
128 if ( strlen ( c ) > 2 )
146 if ( strlen ( optarg ) < 256 )
153 exit ( EXIT_SUCCESS );
158 printf (
"read_args(): It is needed an input file. Use -i option\n" );
188int main (
int argc,
char *argv[] )
190 size_t subset, first_subset, last_subset;
194 exit ( EXIT_FAILURE );
207 exit ( EXIT_FAILURE );
213 exit ( EXIT_FAILURE );
220 exit ( EXIT_FAILURE );
232 fprintf (
BUFR.
err,
"Error, first subset to parse is greater than subset number in BUFR\n" );
233 exit ( EXIT_FAILURE );
236 if ( last_subset < first_subset )
240 for ( subset = first_subset; subset <= last_subset ; subset++ )
246 exit ( EXIT_FAILURE );
252 exit ( EXIT_SUCCESS );
int PRINT_JSON_EXPANDED_TREE
int main(int argc, char *argv[])
int read_args(int _argc, char *_argv[])
read the arguments from stdio
int set_bufrdeco_mask(struct bufrdeco *b)
int bufrdeco_close(struct bufrdeco *b)
Free all allocated memory. Needed when no more task to do with bufrdeco library.
int bufrdeco_parse_tree(struct bufrdeco *b)
Parse the tree of descriptors without expand the replicators.
struct bufrdeco_subset_sequence_data * bufrdeco_get_target_subset_sequence_data(buf_t nset, struct bufrdeco *b)
Prepare the struct bufrdeco to get data from the solicited subset.
int bufrdeco_init(struct bufrdeco *b)
Inits and allocate memory for a struct bufrdeco.
Include header file for bufrdeco library.
#define BUFRDECO_OUTPUT_JSON_EXPANDED_TREE
Bit mask to the member mask of struct bufrdeco to print bufr expanded tree of descriptors.
buf_t bufrdeco_print_json_tree(struct bufrdeco *b)
#define BUFRDECO_OUTPUT_JSON_SUBSET_DATA
Bit mask to the member mask of struct bufrdeco to print bufr subset data in json format.
#define BUFRDECO_OUTPUT_JSON_SEC2
Bit mask to the member mask of struct bufrdeco to print bufr info for SEC 2 in json format.
#define BUFRDECO_OUTPUT_JSON_SEC3
Bit mask to the member mask of struct bufrdeco to print bufr info for SEC 3 in json format.
#define BUFRDECO_OUTPUT_JSON_SEC0
Bit mask to the member mask of struct bufrdeco to print info for SEC 0 in json format.
#define BUFRDECO_OUTPUT_JSON_SEC1
Bit mask to the member mask of struct bufrdeco to print info for SEC 1 in json format.
int bufrdeco_extract_bufr(struct bufrdeco *b, char *filename)
Read file and try to find a bufr report inserted in. Once found do the same that bufrdeco_read_file()
int bufrdeco_read_bufr(struct bufrdeco *b, char *filename)
Read bufr file and does preliminary and first decode pass.
Contains all the information for a subset in a expanded squence This is a version to use with bufrdec...
This struct contains all needed data to parse and decode a BUFR file.