mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 05:27:44 +00:00
cmd: exit status zero from -help
Return of an exit status of zero when running commands with -help, instead of returning an error. By general convention, and in previous versions, tools do not not treat -help as an error. The AFS::Command perl modules, use -help as an introspection technique, and fail when commands run with the -help option returns non-zero. Change-Id: I6ecd95f6ccd07218a2657dbb4dbf1c13599159f4 Reviewed-on: http://gerrit.openafs.org/8087 Reviewed-by: Derrick Brashear <shadow@your-file-system.com> Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com> Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
parent
1015a097bf
commit
d72df5a18e
@ -1018,7 +1018,7 @@ cmd_Parse(int argc, char **argv, struct cmd_syndesc **outsyntax)
|
||||
/* Display full help syntax if we don't have subcommands */
|
||||
if (noOpcodes)
|
||||
PrintFlagHelp(ts);
|
||||
code = CMD_USAGE;
|
||||
code = CMD_HELP;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1061,8 +1061,12 @@ cmd_Dispatch(int argc, char **argv)
|
||||
int code;
|
||||
|
||||
code = cmd_Parse(argc, argv, &ts);
|
||||
if (code)
|
||||
if (code) {
|
||||
if (code == CMD_HELP) {
|
||||
code = 0; /* displaying help is not an error */
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
/*
|
||||
* Before calling the beforeProc and afterProc and all the implications
|
||||
|
@ -20,4 +20,5 @@ error_table CMD
|
||||
ec CMD_TOOBIG, "Token too large"
|
||||
ec CMD_MISSING, "Option not specified on command line"
|
||||
ec CMD_BADFORMAT, "Improper format of configuration file"
|
||||
ec CMD_HELP, "Help requested"
|
||||
end
|
||||
|
@ -330,7 +330,7 @@ main(int argc, char **argv)
|
||||
code = cmd_ParseLine("-help", tv, &tc, 100);
|
||||
is_int(0, code, "cmd_ParseLine succeeds");
|
||||
code = cmd_Parse(tc, tv, &retopts);
|
||||
is_int(CMD_USAGE, code, "cmd_Parse returns usage error with help output");
|
||||
is_int(CMD_HELP, code, "cmd_Parse returns help indicator with help output");
|
||||
ok(retopts == NULL, " ... and options is empty");
|
||||
|
||||
/* Check splitting with '=' */
|
||||
|
Loading…
x
Reference in New Issue
Block a user