NCEPLIBS-bufr  12.0.0
xbfmg.c File Reference

Split a BUFR file into separate BUFR files by message. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libgen.h>
#include <unistd.h>
#include <sys/stat.h>
#include "bufrlib.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 This program splits a single file containing one or more BUFR messages into one or more BUFR files each containing a single BUFR message. More...
 
void prtusage (char *prgnam)
 This function prints program usage information to standard output. More...
 

Detailed Description

Split a BUFR file into separate BUFR files by message.

Author
J. Ator
Date
2018-03-01

Definition in file xbfmg.c.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

This program splits a single file containing one or more BUFR messages into one or more BUFR files each containing a single BUFR message.

The output BUFR files are written to the current working directory, according to a pre-defined naming convention as described below.

Usage

  xbfmg [-v] [-h] [-g] bufrfile

    where:
      -v        prints version information and exits

      -h        prints program help and usage information and exits

      -g        preserves within each output file any GTS bulletin header
                and control characters associated with the corresponding
                BUFR message from the input file

     bufrfile   [path/]name of input file containing one or more BUFR
                messages to be extracted into separate output files within
                the current working directory

  The output will be stored within the current working directory using
  the following filenames:

     (basename).xbfmg.out.000001
     (basename).xbfmg.out.000002
     (basename).xbfmg.out.000003
       and so on, up through
     (basename).xbfmg.out.(last#)

  where:

     (basename) = basename of bufrfile

     (last#) = total number of BUFR messages in bufrfile
Parameters
argc- argument count.
argv- argument array.
Returns
0 for success, error code otherwise.
Author
J. Ator
Date
2018-03-01

Definition at line 95 of file xbfmg.c.

References bvers_f(), iupb_f(), moda_bufrmg::msglen, prtusage(), VERS_STR_LEN, and wrdlen_f().

◆ prtusage()

void prtusage ( char *  prgnam)

This function prints program usage information to standard output.

Parameters
prgnam- [path/]name of program executable.
Author
J. Ator
Date
2018-03-01

Definition at line 23 of file xbfmg.c.

Referenced by main().