(file) Return to smpl_00.c CVS log (file) (dir) Up to [Development] / JSOC / proj / cookbook

 1 rick  1.1 /*
 2            *  smpl_00.c						$DRMS/proj/cookbook/
 3            *
 4 rick  1.4  *  An extremely simple program that does (almost) nothing at all.
 5 rick  1.5  *    It illustrates how a module is called from a driver program, in this
 6            *    case a locally-provided main program rather than jsoc_main, and the
 7            *    use of the command line parsing features in (and outside of) the
 8            *    module.
 9 rick  1.1  *
10            *  Usage:
11 rick  1.5  *    smpl_00 [print= ...]
12 rick  1.1  *
13            *  Bugs:
14 rick  1.4  *    The program is of no particular use, and exists merely for heuristic
15 rick  1.1  *      and testing purposes.
16            *
17            *  Revision history is at end of file.
18            */
19 rick  1.4 #include <cmdparams.h>
20           #include <timeio.h>
21           				    /*  sample module arguments declaration  */
22 rick  1.1 ModuleArgs_t module_args[] = {
23           				   /*  module-specific argument declarators  */
24             {ARG_STRING,	"print", "done", "message to print on successful completion"},
25           				       /*  required end (or blank) argument  */
26             {ARG_END}
27           };
28 rick  1.4        /*  required global declaration (normally included in module driver)  */
29           CmdParams_t cmdparams;
30           
31 rick  1.1 int DoIt (void) {
32             int status;
33             char *msg = cmdparams_get_str (&cmdparams, "print", &status);
34             printf ("%s\n", msg);
35             return 0;
36           }
37           
38 rick  1.4 int main (int argc, char **argv) {
39             int status = cmdparams_parse (&cmdparams, argc, argv);
40             if (status >= 0) return DoIt ();
41           }
42           
43 rick  1.1 /*
44            *  Revision History
45            *
46 rick  1.4  *  09.07.27	file created by R Bogart
47 rick  1.1  */

Karen Tian
Powered by
ViewCVS 0.9.4