< prev index next >

src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Klist.java

Print this page
rev 47855 : 8189102: All tools should support -?, -h and --help

@@ -131,10 +131,18 @@
      * Parses the command line arguments.
      */
     void processArgs(String[] args) {
         Character arg;
         for (int i = 0; i < args.length; i++) {
+            if (args[i].equals("-?") ||
+                args[i].equals("-h") ||
+                args[i].equals("--help")) {
+                // -help was documented, but handled as an invalid flag.
+                // Keep handling as is, remove -help from usage.
+                printHelp();
+                System.exit(0);
+            }
             if ((args[i].length() >= 2) && (args[i].startsWith("-"))) {
                 arg = Character.valueOf(args[i].charAt(1));
                 switch (arg.charValue()) {
                 case 'c':
                     action = 'c';

@@ -348,9 +356,8 @@
         System.out.println("\t  -n \t   do not reverse-resolve addresses");
         System.out.println("   options for keytabs:");
         System.out.println("\t-t \t shows keytab entry timestamps");
         System.out.println("\t-K \t shows keytab entry key value");
         System.out.println("\t-e \t shows keytab entry key type");
-        System.out.println("\nUsage: java sun.security.krb5.tools.Klist " +
-                           "-help for help.");
+        System.out.println("\n-? -h --help print this help message and exit");
     }
 }
< prev index next >