![]() ![]() |
![]() |
File: [Development] / JSOC / proj / cookbook / smpl_00.c
(download)
Revision: 1.5, Wed Aug 26 14:05:48 2009 UTC (13 years, 9 months ago) by rick Branch: MAIN CVS Tags: Ver_5-9, Ver_5-8, Ver_5-7, Ver_5-6, Ver_5-5, Ver_5-14, Ver_5-13, Ver_5-12, Ver_5-11, Ver_5-10, NetDRMS_Ver_9-9, NetDRMS_Ver_2-7, NetDRMS_Ver_2-6, NetDRMS_Ver_2-5, NetDRMS_Ver_2-4, NetDRMS_Ver_2-3, NetDRMS_Ver_2-2, NetDRMS_Ver_2-1, NetDRMS_Ver_2-0b, NetDRMS_Ver_2-0 Changes since 1.4: +5 -2 lines finished comment |
/* * 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 */ {ARG_END} }; /* required global declaration (normally included in module driver) */ CmdParams_t cmdparams; int DoIt (void) { int status; char *msg = 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 |