diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2003-05-12 11:38:09 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2003-05-12 11:38:09 +0000 |
commit | f07f0bf18b89549cd81e7df596dd65583ece2289 (patch) | |
tree | 1b94a368814e5a16878a5ba2bb8f88fc25168847 /src/main/CommandLine.c | |
parent | c47c993fd97823d672a899632223b1648658f20e (diff) |
Produce an error message when a user asks for parameter info for
a non-existing parameter. Additionally ff the parameter exists the code returns
0 as its exit status, and if it doesn't the code returns 1, so this can also
be checked in scripts.
We need to audit the current set of exit status codes, make sure they are distinct,
and document them.
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@3213 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/CommandLine.c')
-rw-r--r-- | src/main/CommandLine.c | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/src/main/CommandLine.c b/src/main/CommandLine.c index e675db2d..3f59d388 100644 --- a/src/main/CommandLine.c +++ b/src/main/CommandLine.c @@ -187,36 +187,49 @@ void CCTKi_CommandLineDescribeAllParameters (const char *argument) @@*/ void CCTKi_CommandLineDescribeParameter (const char *argument) { + int retcode; char *thorn, *param; const char *cthorn; const cParamData *properties; - if (CCTK_MyProc (NULL) == 0) - { - Util_SplitString (þ, ¶m, argument, "::"); + Util_SplitString (þ, ¶m, argument, "::"); - if (! param) + if (! param) + { + properties = CCTK_ParameterData (argument, NULL); + } + else + { + properties = CCTK_ParameterData (param, thorn); + if (! properties) { - properties = CCTK_ParameterData (argument, NULL); + cthorn = CCTK_ImplementationThorn (thorn); + properties = CCTK_ParameterData (param, cthorn); } - else + + free (thorn); + free (param); + } + + if(properties) + { + if (CCTK_MyProc (NULL) == 0) { - properties = CCTK_ParameterData (param, thorn); - if (! properties) - { - cthorn = CCTK_ImplementationThorn (thorn); - properties = CCTK_ParameterData (param, cthorn); - } - - free (thorn); - free (param); + CommandLinePrintParameter (properties); } - - CommandLinePrintParameter (properties); + retcode = 0; } - - CCTK_Exit (NULL, 0); + else + { + if (CCTK_MyProc (NULL) == 0) + { + fprintf(stderr, "No such parameter\n"); + } + retcode = 1; + } + + CCTK_Exit (NULL, retcode); } |