kas: Don't require config for help
[openafs.git] / src / kauth / kas.c
index 736b229..027b448 100644 (file)
 /* 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>
@@ -37,7 +29,6 @@
 #include "kauth_internal.h"
 #include "kautils.h"
 
-
 int
 main(int argc, char *argv[])
 {
@@ -75,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