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

File: [Development] / JSOC / proj / cookbook / smpl_00.c (download)
Revision: 1.6, Thu Nov 3 23:30:09 2011 UTC (11 years, 10 months 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.5: +1 -1 lines
strdup return of cmdparams_get_str()

 *  smpl_00.c						$DRMS/proj/cookbook/
 *  An extremely simple program that does (almost) nothing at all.
 *    It illustrates how a module is called from a driver program, in this
 *    case a locally-provided main program rather than jsoc_main, and the
 *    use of the command line parsing features in (and outside of) the
 *    module.
 *  Usage:
 *    smpl_00 [print= ...]
 *  Bugs:
 *    The program is of no particular use, and exists merely for heuristic
 *      and testing purposes.
 *  Revision history is at end of file.
#include <cmdparams.h>
#include <timeio.h>
				    /*  sample module arguments declaration  */
ModuleArgs_t module_args[] = {
				   /*  module-specific argument declarators  */
  {ARG_STRING,	"print", "done", "message to print on successful completion"},
				       /*  required end (or blank) argument  */
       /*  required global declaration (normally included in module driver)  */
CmdParams_t cmdparams;

int DoIt (void) {
  int status;
  char *msg = strdup (cmdparams_get_str (&cmdparams, "print", &status));
  printf ("%s\n", msg);
  return 0;

int main (int argc, char **argv) {
  int status = cmdparams_parse (&cmdparams, argc, argv);
  if (status >= 0) return DoIt ();

 *  Revision History
 *  09.07.27	file created by R Bogart

Karen Tian
Powered by
ViewCVS 0.9.4