libcmd-support-version-switch-20060630
authorDerrick Brashear <shadow@dementia.org>
Fri, 30 Jun 2006 20:44:19 +0000 (20:44 +0000)
committerDerrick Brashear <shadow@dementia.org>
Fri, 30 Jun 2006 20:44:19 +0000 (20:44 +0000)
well, i guess adm will be sad until it exports AFSVersion, but, life is hard.

src/cmd/cmd.c

index a93b40a..c83aaeb 100644 (file)
@@ -165,6 +165,15 @@ PrintParmHelp(register struct cmd_parmdesc *aparm)
        printf(" <arg>+");
 }
 
+extern char *AFSVersion;
+
+static int
+VersionProc(register struct cmd_syndesc *as, char *arock)
+{
+    printf("%s\n", AFSVersion);
+    return 0;
+}
+
 void
 PrintSyntax(register struct cmd_syndesc *as)
 {
@@ -658,6 +667,16 @@ cmd_Dispatch(int argc, char **argv)
                                  "search by help text");
            cmd_AddParm(ts, "-topic", CMD_SINGLE, CMD_REQUIRED,
                        "help string");
+           ts = cmd_CreateSyntax("version", VersionProc, (char *)0,
+                                 (char *)CMD_HIDDEN);
+           ts = cmd_CreateSyntax("-version", VersionProc, (char *)0,
+                                 (char *)CMD_HIDDEN);
+           ts = cmd_CreateSyntax("-help", HelpProc, (char *)0,
+                                 (char *)CMD_HIDDEN);
+           ts = cmd_CreateSyntax("--version", VersionProc, (char *)0,
+                                 (char *)CMD_HIDDEN);
+           ts = cmd_CreateSyntax("--help", HelpProc, (char *)0,
+                                 (char *)CMD_HIDDEN);
        }
     }