]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
kas: Don't require config for help
authorSimon Wilkinson <sxw@your-file-system.com>
Sun, 8 Apr 2012 22:31:31 +0000 (18:31 -0400)
committerDerrick Brashear <shadow@dementix.org>
Mon, 9 Apr 2012 04:43:50 +0000 (21:43 -0700)
Modify the call to ka_Init in kas, so that a fully configured client
isn't required in order to generate help output. In particular, permit
kas -help, kas -version and kas apropos to run without initialising the
ka library.

This fixes a problem with running 'make check' on systems that don't
have an AFS client installed (or where the AFS client is installed in
a different location)

Change-Id: I5edd10a319ed6aee163723f99c4f37183f572b2f
Reviewed-on: http://gerrit.openafs.org/7129
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/kauth/kas.c

index fa57df58d7e2aa5b3ec99131eb7e5523f1db8ca2..027b44883c70a6b5befe7c9432708e6580960537 100644 (file)
@@ -66,10 +66,18 @@ main(int argc, char *argv[])
     }
 #endif
 
-    code = ka_Init(0);
-    if (code) {
-       afs_com_err(whoami, code, "Can't get cell info");
-       exit(1);
+    /* Don't ka_Init if we're just returning help output. */
+    if (argc== 0 ||
+         ( strcmp(argv[1], "-help") != 0 &&
+          strcmp(argv[1], "help") != 0 &&
+          strcmp(argv[1], "-version") != 0 &&
+          strcmp(argv[1], "version") !=0 &&
+          strcmp(argv[1],"apropos") != 0)) {
+       code = ka_Init(0);
+       if (code) {
+           afs_com_err(whoami, code, "Can't get cell info");
+           exit(1);
+       }
     }
 
     /* if there are no arguments or if the first argument is "-cell" or if the