< 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


 116                 System.exit(-1);
 117             } else {
 118                 klist.target = CredentialsCache.getInstance();
 119                 klist.name = CredentialsCache.cacheName();
 120                 if (klist.target != null) {
 121                     klist.displayCache();
 122                 } else {
 123                     klist.displayMessage("Credentials cache");
 124                     System.exit(-1);
 125                 }
 126             }
 127         }
 128     }
 129 
 130     /**
 131      * Parses the command line arguments.
 132      */
 133     void processArgs(String[] args) {
 134         Character arg;
 135         for (int i = 0; i < args.length; i++) {








 136             if ((args[i].length() >= 2) && (args[i].startsWith("-"))) {
 137                 arg = Character.valueOf(args[i].charAt(1));
 138                 switch (arg.charValue()) {
 139                 case 'c':
 140                     action = 'c';
 141                     break;
 142                 case 'k':
 143                     action = 'k';
 144                     break;
 145                 case 'a':
 146                     options[2] = 'a';
 147                     break;
 148                 case 'n':
 149                     options[3] = 'n';
 150                     break;
 151                 case 'f':
 152                     options[1] = 'f';
 153                     break;
 154                 case 'e':
 155                     options[0] = 'e';


 333      * Prints out the help information.
 334      */
 335     void printHelp() {
 336         System.out.println("\nUsage: klist " +
 337                            "[[-c] [-f] [-e] [-a [-n]]] [-k [-t] [-K]] [name]");
 338         System.out.println("   name\t name of credentials cache or " +
 339                            " keytab with the prefix. File-based cache or "
 340                            + "keytab's prefix is FILE:.");
 341         System.out.println("   -c specifies that credential cache is to be " +
 342                            "listed");
 343         System.out.println("   -k specifies that key tab is to be listed");
 344         System.out.println("   options for credentials caches:");
 345         System.out.println("\t-f \t shows credentials flags");
 346         System.out.println("\t-e \t shows the encryption type");
 347         System.out.println("\t-a \t shows addresses");
 348         System.out.println("\t  -n \t   do not reverse-resolve addresses");
 349         System.out.println("   options for keytabs:");
 350         System.out.println("\t-t \t shows keytab entry timestamps");
 351         System.out.println("\t-K \t shows keytab entry key value");
 352         System.out.println("\t-e \t shows keytab entry key type");
 353         System.out.println("\nUsage: java sun.security.krb5.tools.Klist " +
 354                            "-help for help.");
 355     }
 356 }


 116                 System.exit(-1);
 117             } else {
 118                 klist.target = CredentialsCache.getInstance();
 119                 klist.name = CredentialsCache.cacheName();
 120                 if (klist.target != null) {
 121                     klist.displayCache();
 122                 } else {
 123                     klist.displayMessage("Credentials cache");
 124                     System.exit(-1);
 125                 }
 126             }
 127         }
 128     }
 129 
 130     /**
 131      * Parses the command line arguments.
 132      */
 133     void processArgs(String[] args) {
 134         Character arg;
 135         for (int i = 0; i < args.length; i++) {
 136             if (args[i].equals("-?") ||
 137                 args[i].equals("-h") ||
 138                 args[i].equals("--help")) {
 139                 // -help was documented, but handled as an invalid flag.
 140                 // Keep handling as is, remove -help from usage.
 141                 printHelp();
 142                 System.exit(0);
 143             }
 144             if ((args[i].length() >= 2) && (args[i].startsWith("-"))) {
 145                 arg = Character.valueOf(args[i].charAt(1));
 146                 switch (arg.charValue()) {
 147                 case 'c':
 148                     action = 'c';
 149                     break;
 150                 case 'k':
 151                     action = 'k';
 152                     break;
 153                 case 'a':
 154                     options[2] = 'a';
 155                     break;
 156                 case 'n':
 157                     options[3] = 'n';
 158                     break;
 159                 case 'f':
 160                     options[1] = 'f';
 161                     break;
 162                 case 'e':
 163                     options[0] = 'e';


 341      * Prints out the help information.
 342      */
 343     void printHelp() {
 344         System.out.println("\nUsage: klist " +
 345                            "[[-c] [-f] [-e] [-a [-n]]] [-k [-t] [-K]] [name]");
 346         System.out.println("   name\t name of credentials cache or " +
 347                            " keytab with the prefix. File-based cache or "
 348                            + "keytab's prefix is FILE:.");
 349         System.out.println("   -c specifies that credential cache is to be " +
 350                            "listed");
 351         System.out.println("   -k specifies that key tab is to be listed");
 352         System.out.println("   options for credentials caches:");
 353         System.out.println("\t-f \t shows credentials flags");
 354         System.out.println("\t-e \t shows the encryption type");
 355         System.out.println("\t-a \t shows addresses");
 356         System.out.println("\t  -n \t   do not reverse-resolve addresses");
 357         System.out.println("   options for keytabs:");
 358         System.out.println("\t-t \t shows keytab entry timestamps");
 359         System.out.println("\t-K \t shows keytab entry key value");
 360         System.out.println("\t-e \t shows keytab entry key type");
 361         System.out.println("\n-? -h --help print this help message and exit");

 362     }
 363 }
< prev index next >