Revision: | 1.4 |
Committed: | Fri Nov 4 00:30:30 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.3: | +1 -1 lines |
Log Message: | strdup return of cmdparams_get_str() |
# | Content |
---|---|
1 | /* |
2 | * smpl_01.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 | * smpl_01 [-avVH] |
10 | * |
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:01"; |
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 | {ARG_END} |
32 | }; |
33 | /* required module declaration */ |
34 | int DoIt (void) { |
35 | int status; |
36 | |
37 | char *msg = strdup (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 | /* required status return to jsoc_main */ |
48 | return 0; |
49 | } |
50 | |
51 | /* |
52 | * Revision History |
53 | * |
54 | * 09.04.13 file created by R Bogart |
55 | */ |