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

File: [Development] / JSOC / proj / cookbook / smpl_01.c (download)
Revision: 1.4, Thu Nov 3 23:30:30 2011 UTC (11 years, 1 month ago) by rick
Branch: MAIN
CVS Tags: Ver_LATEST, Ver_DRMSLATEST, Ver_9-5, Ver_9-41, Ver_9-4, Ver_9-3, Ver_9-2, Ver_9-1, Ver_9-0, Ver_8-8, Ver_8-7, Ver_8-6, Ver_8-5, Ver_8-4, Ver_8-3, Ver_8-2, Ver_8-12, Ver_8-11, Ver_8-10, Ver_8-1, Ver_8-0, Ver_7-1, Ver_7-0, Ver_6-4, Ver_6-3, Ver_6-2, Ver_6-1, Ver_6-0, NetDRMS_Ver_LATEST, NetDRMS_Ver_9-5, NetDRMS_Ver_9-41, NetDRMS_Ver_9-4, NetDRMS_Ver_9-3, NetDRMS_Ver_9-2, NetDRMS_Ver_9-1, NetDRMS_Ver_9-0, NetDRMS_Ver_8-8, NetDRMS_Ver_8-7, NetDRMS_Ver_8-6, NetDRMS_Ver_8-5, NetDRMS_Ver_8-4, NetDRMS_Ver_8-3, NetDRMS_Ver_8-2, NetDRMS_Ver_8-12, NetDRMS_Ver_8-11, NetDRMS_Ver_8-10, NetDRMS_Ver_8-1, NetDRMS_Ver_8-0, NetDRMS_Ver_7-1, NetDRMS_Ver_7-0, NetDRMS_Ver_6-4, NetDRMS_Ver_6-3, NetDRMS_Ver_6-2, NetDRMS_Ver_6-1, NetDRMS_Ver_6-0, HEAD
Changes since 1.3: +1 -1 lines
strdup return of cmdparams_get_str()

/*
 *  smpl_01.c						$DRMS/proj/cookbook/
 *
 *  An extremely simple module that does (almost) nothing at all.
 *    It illustrates the structure of a DRMS module and exhibits
 *    return status behavior with use of the module verbose flags
 *
 *  Usage:
 *    smpl_01 [-avVH]
 *
 *  Bugs:
 *    The module is of no particular use, and exists merely for heuristic
 *      and testing purposes.
 *
 *  Revision history is at end of file.
 */
						  /*  required .h inclusion  */
#include <jsoc_main.h>
					     /*  required module identifier  */
char *module_name = "CookbookRecipe:01";
					    /*  optional version identifier
		      (recommended, and required for this particular module  */
char *version_id = "1.0";
				  /*  required module arguments declaration  */
ModuleArgs_t module_args[] = {
				   /*  module-specific argument declarators  */
  {ARG_FLAG,    "a",    "", "force an abort"},
  {ARG_FLAG,    "v",    "", "run in verbose mode"},
  {ARG_STRING,	"print", "done", "message to print on successful completion"},
				       /*  required end (or blank) argument  */
  {ARG_END}
};
					    /*  required module declaration  */
int DoIt (void) {
  int status;

  char *msg = strdup (cmdparams_get_str (&cmdparams, "print", &status));

  if (params_isflagset (&cmdparams, "v"))
    printf ("running module %s version %s\n", module_name, version_id);
  if (params_isflagset (&cmdparams, "a")) {
    printf ("aborting\n");
    return 1;
  }

  printf ("%s\n", msg);
				    /*  required status return to jsoc_main  */
  return 0;
}

/*
 *  Revision History
 *
 *  09.04.13	file created by R Bogart
 */

Karen Tian
Powered by
ViewCVS 0.9.4