backup: Display general help on -help
authorAndrew Deason <adeason@sinenomine.net>
Tue, 5 Nov 2013 17:00:21 +0000 (11:00 -0600)
committerDerrick Brashear <shadow@your-file-system.com>
Thu, 7 Nov 2013 12:20:50 +0000 (04:20 -0800)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

src/bucoord/main.c

index c521b5c..d233dba 100644 (file)
@@ -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);