From dc4384653fed48104016a0e00fc2487851eb6806 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 5 Nov 2013 11:00:21 -0600 Subject: [PATCH] backup: Display general help on -help Currently, 'backup' tries to guess if we are running 'backup interactive' before libcmd actually parses our arguments. This is tricky, since we run 'backup interactive' if no explicit subcommand is actually given. One consequence of this is that currently, running 'backup -help' just displays the help for the 'backup interactive' command, not the help output for 'backup' itself. The current heuristics for guessing at whether we are running 'backup interactive' or not are a bit fishy, but at least for now, just make sure -help works. This should still ensure any other behavior is unchanged, but just 'backup -help' now works like other command suites. Change-Id: I31ecbcad7efffd301d23f109c66eee0417882a90 Reviewed-on: http://gerrit.openafs.org/10439 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/bucoord/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/bucoord/main.c b/src/bucoord/main.c index c521b5cc6..d233dbac9 100644 --- a/src/bucoord/main.c +++ b/src/bucoord/main.c @@ -464,7 +464,17 @@ main(int argc, char **argv) /* setup the default backup dir */ DefaultConfDir = AFSDIR_SERVER_BACKUP_DIRPATH; /* Get early warning if the command is interacive mode or not */ - interact = (((argc < 2) || (argv[1][0] == '-')) ? 1 : 0); + if (argc < 2) { + interact = 1; + } else { + interact = 0; + if (argv[1][0] == '-') { + interact = 1; + if (strcmp(argv[1], "-help") == 0) { + interact = 0; + } + } + } cmd_SetBeforeProc(MyBeforeProc, NULL); -- 2.39.5