34 printf (
"Usage: \n" );
35 printf (
"\n%s -i input_file [-h][-v][-f][-l][-F prefix][-T T2_selection][-O selo][-S sels][-U selu]\n" ,
OWN);
36 printf (
" -h Print this help\n" );
37 printf (
" -v Print information about build and version\n" );
38 printf (
" -i Input file. Complete input path file for NOAA *.bin bufr archive file\n" );
39 printf (
" -2 Input file is formatted in alternative form: Headers has '#' instead of '*' marks and no sep after '7777'\n");
40 printf (
" -l list the names of reports in input file\n" );
41 printf (
" -f Extract selected reports and write them in files, one per bufr message, as \n" );
42 printf (
" example '20110601213442_ISIE06_SBBR_012100_RRB.bufr'. First field in name is input file timestamp \n" );
43 printf (
" Other fields are from header\n" );
44 printf (
" -F prefix. Builds an archive file with the same format as NOAA one but just with selected messages\n" );
45 printf (
" witgh option -T. Resulting name is 'prefix_input_filename'\n" );
46 printf (
" If no -F option no archive bin file is created.\n" );
47 printf (
" If no message is selected, the a void file is created.\n" );
48 printf (
" File timestamp is the same than input file\n" );
49 printf (
" -T T2_selection. A string with selection. A character per type (T2 code)\n" );
50 printf (
" 'S' = Surface . 'O'= Oceanographic. 'U'= upper air\n" );
51 printf (
" If no -T argument then nothing is selected\n" );
52 printf (
" -S sels. String with selection for A1 when T2='S'\n" );
53 printf (
" By default all A1 are selected\n" );
54 printf (
" -O selo. String with selection for A1 when T2='O'\n" );
55 printf (
" By default all A1 are selected\n" );
56 printf (
" -U sels. String with selection for A1 when T2='U'\n" );
57 printf (
" By default all A1 are selected\n" );
72char *
bufrnoaa_get_version(
char *version,
char *build,
char *builder,
int *version_major,
int *version_minor,
int *version_patch)
74 int major = 0, minor = 0, patch = 0;
79 sprintf(version,
"%s",
VERSION);
81 sscanf(version,
"%d.%d.%d", &major, &minor, &patch);
85#if defined(__INTEL_COMPILER)
86 c += sprintf(build,
"using INTEL C compiler icc %d.%d ", __INTEL_COMPILER, __INTEL_COMPILER_UPDATE);
87#elif defined(__clang_version__)
88 c += sprintf(build,
"using clang C compiler ", __clang_version__);
89#elif defined(__GNUC__)
90 c += sprintf(build,
"using GNU C compiler gcc %d.%d.%d ", __GNUC__ , __GNUC_MINOR__ , __GNUC_PATCHLEVEL__);
91#elif defined(_MSC_VER)
92 c += sprintf(build,
"using MICROSOFT C compiler %d ", _MSC_VER);
94 c += sprintf(build,
"using an unknown C compiler ");
96 sprintf(c,
"at %s %s",__DATE__,__TIME__);
100#ifdef BUILD_USING_CMAKE
101 strcpy(builder,
"cmake");
103 strcpy(builder,
"autotools");
106 *version_major = major;
108 *version_minor = minor;
110 *version_patch = patch;
116 char version[16], build[64], builder[32];
119 printf (
"%s: Version '%s' built %s and %s.\n" ,
OWN,
VERSION, build, builder);
151 while ( ( iopt = getopt ( _argc, _argv,
"hv2i:flF:O:qS:T:U:" ) ) !=-1 )
155 if ( strlen ( optarg ) < 256 )
172 if ( strlen ( optarg ) && strlen ( optarg ) < 64 )
174 strcpy (
PREFIX, optarg );
179 if ( strlen ( optarg ) < 64 )
181 strcpy (
SEL, optarg );
186 if ( strlen ( optarg ) < 64 )
188 strcpy (
SELS, optarg );
192 if ( strlen ( optarg ) < 64 )
194 strcpy (
SELO, optarg );
198 if ( strlen ( optarg ) < 64 )
200 strcpy (
SELU, optarg );
205 exit ( EXIT_SUCCESS );
210 exit ( EXIT_SUCCESS );
215 printf (
"%s: It is needed an input file. Use -i option\n",
OWN );
inclusion file for binary bufrnoaa
int read_args(int _argc, char *_argv[])
read the arguments from stdio
char * bufrnoaa_get_version(char *version, char *build, char *builder, int *version_major, int *version_minor, int *version_patch)
Get strings with version information and build date and time.