(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            *  An extremely simple module that does (almost) nothing at all.
 5            *    It illustrates the structure of a DRMS module and exhibits
 6            *    return status behavior with use of the module verbose flags
 7            *
 8            *  Usage:
 9 rick  1.3  *    smpl_00 [-avVH]
10 rick  1.1  *
11            *  Bugs:
12            *    The module is of no particular use, and exists merely for heuristic
13            *      and testing purposes.
14            *
15            *  Revision history is at end of file.
16            */
17           						  /*  required .h inclusion  */
18           #include <jsoc_main.h>
19           					     /*  required module identifier  */
20           char *module_name = "CookbookRecipe:00";
21           					    /*  optional version identifier
22           		      (recommended, and required for this particular module  */
23           char *version_id = "1.0";
24           				  /*  required module arguments declaration  */
25           ModuleArgs_t module_args[] = {
26           				   /*  module-specific argument declarators  */
27             {ARG_FLAG,    "a",    "", "force an abort"},
28             {ARG_FLAG,    "v",    "", "run in verbose mode"},
29             {ARG_STRING,	"print", "done", "message to print on successful completion"},
30           				       /*  required end (or blank) argument  */
31 rick  1.1   {ARG_END}
32           };
33           					    /*  required module declaration  */
34           int DoIt (void) {
35             int status;
36           
37             char *msg = cmdparams_get_str (&cmdparams, "print", &status);
38           
39             if (params_isflagset (&cmdparams, "v"))
40               printf ("running module %s version %s\n", module_name, version_id);
41             if (params_isflagset (&cmdparams, "a")) {
42               printf ("aborting\n");
43               return 1;
44             }
45           
46             printf ("%s\n", msg);
47 rick  1.2 				    /*  required status return to jsoc_main  */
48 rick  1.1   return 0;
49           }
50           
51           /*
52            *  Revision History
53            *
54            *  09.04.13	file created by R Bogart
55            */

Karen Tian
Powered by
ViewCVS 0.9.4