OpenCOBOL 1.1pre-rel
Functions
cobcrun.c File Reference
#include "config.h"
#include "defaults.h"
#include <stdio.h>
#include <string.h>
#include <libcob.h>
#include <tarstamp.h>
Include dependency graph for cobcrun.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 63 of file cobcrun.c.

{
        union {
                int     (*func)();
                void    *func_void;
        } unifunc;

        if (argc <= 1) {
                print_usage ();
                return 1;
        }
        /* Quick check without getopt */
        if (!strncmp (argv[1], "--version", 10) ||
            !strncmp (argv[1], "-V", 4)) {
                print_version ();
                return 0;
        }
        if (!strncmp (argv[1], "--help", 10) ||
            !strncmp (argv[1], "-h", 4)) {
                print_usage ();
                return 0;
        }
        if (strlen (argv[1]) > 31) {
                fprintf (stderr, "Invalid PROGRAM name\n");
                return 1;
        }
        cob_init (argc - 1, &argv[1]);
        unifunc.func_void = cob_resolve (argv[1]);
        if (unifunc.func_void == NULL) {
                cob_call_error ();
        }
        cob_stop_run ( unifunc.func() );
}

Here is the call graph for this function:

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines