ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/JSOC/proj/cookbook/smpl_00.c
Revision: 1.6
Committed: Fri Nov 4 00:30:09 2011 UTC (11 years, 10 months ago) by rick
Content type: text/plain
Branch: MAIN
CVS Tags: NetDRMS_Ver_6-4, NetDRMS_Ver_8-0, NetDRMS_Ver_6-2, NetDRMS_Ver_6-3, NetDRMS_Ver_6-0, NetDRMS_Ver_6-1, Ver_6-0, Ver_6-1, Ver_6-2, Ver_6-3, Ver_6-4, NetDRMS_Ver_8-8, Ver_8-5, NetDRMS_Ver_7-0, NetDRMS_Ver_8-1, Ver_7-0, Ver_LATEST, NetDRMS_Ver_LATEST, NetDRMS_Ver_8-12, NetDRMS_Ver_8-10, NetDRMS_Ver_8-11, NetDRMS_Ver_9-1, NetDRMS_Ver_9-0, NetDRMS_Ver_9-3, NetDRMS_Ver_9-2, NetDRMS_Ver_9-5, NetDRMS_Ver_9-4, NetDRMS_Ver_8-2, NetDRMS_Ver_8-3, NetDRMS_Ver_9-41, Ver_9-41, Ver_DRMSLATEST, NetDRMS_Ver_8-4, NetDRMS_Ver_8-5, NetDRMS_Ver_8-6, Ver_8-8, NetDRMS_Ver_8-7, Ver_8-2, Ver_9-3, Ver_8-0, Ver_8-1, Ver_8-6, Ver_8-7, Ver_8-4, Ver_8-11, Ver_7-1, Ver_9-1, Ver_8-3, NetDRMS_Ver_7-1, Ver_9-5, Ver_9-4, Ver_8-10, Ver_9-2, Ver_8-12, Ver_9-0, HEAD
Changes since 1.5: +1 -1 lines
Log Message:
strdup return of cmdparams_get_str()

File Contents

# Content
1 /*
2 * smpl_00.c $DRMS/proj/cookbook/
3 *
4 * An extremely simple program that does (almost) nothing at all.
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 *
10 * Usage:
11 * smpl_00 [print= ...]
12 *
13 * Bugs:
14 * The program is of no particular use, and exists merely for heuristic
15 * and testing purposes.
16 *
17 * Revision history is at end of file.
18 */
19 #include <cmdparams.h>
20 #include <timeio.h>
21 /* sample module arguments declaration */
22 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 /* required global declaration (normally included in module driver) */
29 CmdParams_t cmdparams;
30
31 int DoIt (void) {
32 int status;
33 char *msg = strdup (cmdparams_get_str (&cmdparams, "print", &status));
34 printf ("%s\n", msg);
35 return 0;
36 }
37
38 int main (int argc, char **argv) {
39 int status = cmdparams_parse (&cmdparams, argc, argv);
40 if (status >= 0) return DoIt ();
41 }
42
43 /*
44 * Revision History
45 *
46 * 09.07.27 file created by R Bogart
47 */