kas: Don't require config for help
[openafs.git] / src / kauth / kas.c
index 8cc7f3e..027b448 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Copyright 2000, International Business Machines Corporation and others.
  * All Rights Reserved.
- * 
+ *
  * This software has been released under the terms of the IBM Public
  * License.  For details, see the LICENSE file in the top-level source
  * directory or online at http://www.openafs.org/dl/license10.html
 /* These two needed for rxgen output to work */
 #include <afsconfig.h>
 #include <afs/param.h>
+#include <afs/stds.h>
 
+#include <roken.h>
 
-#include <afs/stds.h>
-#ifdef AFS_AIX32_ENV
-#include <signal.h>
+#ifdef AFS_NT40_ENV
+#include <WINNT/afsevent.h>
 #endif
 
-#include <sys/types.h>
 #include <rx/xdr.h>
-
 #include <lock.h>
 #include <ubik.h>
-#ifndef AFS_NT40_ENV
-#include <pwd.h>
-#else
-#include <WINNT/afsevent.h>
-#endif
-#include <string.h>
 #include <afs/cellconfig.h>
 #include <afs/com_err.h>
+#include <afs/cmd.h>
 
 #include "kauth.h"
+#include "kauth_internal.h"
 #include "kautils.h"
 
-
 int
 main(int argc, char *argv[])
 {
@@ -45,8 +39,8 @@ main(int argc, char *argv[])
 
 #ifdef AFS_AIX32_ENV
     /*
-     * The following signal action for AIX is necessary so that in case of a 
-     * crash (i.e. core is generated) we can include the user's data section 
+     * The following signal action for AIX is necessary so that in case of a
+     * crash (i.e. core is generated) we can include the user's data section
      * in the core dump. Unfortunately, by default, only a partial core is
      * generated which, in many cases, isn't too useful.
      */
@@ -72,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