506 }
507 }
508
509 /*
510 * Check modifiers
511 */
512 String modifier = null;
513 int pos = flags.indexOf(':');
514 if (pos > 0) {
515 modifier = flags.substring(pos+1);
516 flags = flags.substring(0, pos);
517 }
518
519 /*
520 * command modes
521 */
522 Command c = Command.getCommand(flags);
523
524 if (c != null) {
525 command = c;
526 } else if (collator.compare(flags, "-help") == 0 ||
527 collator.compare(flags, "-h") == 0 ||
528 collator.compare(flags, "-?") == 0) {
529 help = true;
530 } else if (collator.compare(flags, "-conf") == 0) {
531 i++;
532 } else if (collator.compare(flags, "-nowarn") == 0) {
533 nowarn = true;
534 } else if (collator.compare(flags, "-keystore") == 0) {
535 ksfname = args[++i];
536 if (new File(ksfname).getCanonicalPath().equals(
537 new File(KeyStoreUtil.getCacerts()).getCanonicalPath())) {
538 System.err.println(rb.getString("warning.cacerts.option"));
539 }
540 } else if (collator.compare(flags, "-destkeystore") == 0) {
541 ksfname = args[++i];
542 } else if (collator.compare(flags, "-cacerts") == 0) {
543 cacerts = true;
544 } else if (collator.compare(flags, "-storepass") == 0 ||
545 collator.compare(flags, "-deststorepass") == 0) {
546 storePass = getPass(modifier, args[++i]);
547 passwords.add(storePass);
548 } else if (collator.compare(flags, "-storetype") == 0 ||
4577 System.err.printf(" %-" + lenLeft + "s %s\n", s1, s2);
4578 } else {
4579 System.err.printf(" %-" + lenLeft + "s %s\n", s1, s2);
4580 }
4581 }
4582 }
4583 System.err.println();
4584 System.err.println(rb.getString(
4585 "Use.keytool.help.for.all.available.commands"));
4586 } else {
4587 System.err.println(rb.getString(
4588 "Key.and.Certificate.Management.Tool"));
4589 System.err.println();
4590 System.err.println(rb.getString("Commands."));
4591 System.err.println();
4592 for (Command c: Command.values()) {
4593 if (c == KEYCLONE) break;
4594 System.err.printf(" %-20s%s\n", c, rb.getString(c.description));
4595 }
4596 System.err.println();
4597 System.err.println(rb.getString(
4598 "Use.keytool.command.name.help.for.usage.of.command.name"));
4599 }
4600 }
4601
4602 private void tinyHelp() {
4603 usage();
4604 if (debug) {
4605 throw new RuntimeException("NO BIG ERROR, SORRY");
4606 } else {
4607 System.exit(1);
4608 }
4609 }
4610
4611 private void errorNeedArgument(String flag) {
4612 Object[] source = {flag};
4613 System.err.println(new MessageFormat(
4614 rb.getString("Command.option.flag.needs.an.argument.")).format(source));
4615 tinyHelp();
4616 }
|
506 }
507 }
508
509 /*
510 * Check modifiers
511 */
512 String modifier = null;
513 int pos = flags.indexOf(':');
514 if (pos > 0) {
515 modifier = flags.substring(pos+1);
516 flags = flags.substring(0, pos);
517 }
518
519 /*
520 * command modes
521 */
522 Command c = Command.getCommand(flags);
523
524 if (c != null) {
525 command = c;
526 } else if (collator.compare(flags, "--help") == 0 ||
527 collator.compare(flags, "-h") == 0 ||
528 collator.compare(flags, "-?") == 0 ||
529 // -help: legacy.
530 collator.compare(flags, "-help") == 0) {
531 help = true;
532 } else if (collator.compare(flags, "-conf") == 0) {
533 i++;
534 } else if (collator.compare(flags, "-nowarn") == 0) {
535 nowarn = true;
536 } else if (collator.compare(flags, "-keystore") == 0) {
537 ksfname = args[++i];
538 if (new File(ksfname).getCanonicalPath().equals(
539 new File(KeyStoreUtil.getCacerts()).getCanonicalPath())) {
540 System.err.println(rb.getString("warning.cacerts.option"));
541 }
542 } else if (collator.compare(flags, "-destkeystore") == 0) {
543 ksfname = args[++i];
544 } else if (collator.compare(flags, "-cacerts") == 0) {
545 cacerts = true;
546 } else if (collator.compare(flags, "-storepass") == 0 ||
547 collator.compare(flags, "-deststorepass") == 0) {
548 storePass = getPass(modifier, args[++i]);
549 passwords.add(storePass);
550 } else if (collator.compare(flags, "-storetype") == 0 ||
4579 System.err.printf(" %-" + lenLeft + "s %s\n", s1, s2);
4580 } else {
4581 System.err.printf(" %-" + lenLeft + "s %s\n", s1, s2);
4582 }
4583 }
4584 }
4585 System.err.println();
4586 System.err.println(rb.getString(
4587 "Use.keytool.help.for.all.available.commands"));
4588 } else {
4589 System.err.println(rb.getString(
4590 "Key.and.Certificate.Management.Tool"));
4591 System.err.println();
4592 System.err.println(rb.getString("Commands."));
4593 System.err.println();
4594 for (Command c: Command.values()) {
4595 if (c == KEYCLONE) break;
4596 System.err.printf(" %-20s%s\n", c, rb.getString(c.description));
4597 }
4598 System.err.println();
4599 System.err.println(rb.getString(
4600 "Use.keytool.help.for.all.available.commands"));
4601 System.err.println(rb.getString(
4602 "Use.keytool.command.name.help.for.usage.of.command.name"));
4603 }
4604 }
4605
4606 private void tinyHelp() {
4607 usage();
4608 if (debug) {
4609 throw new RuntimeException("NO BIG ERROR, SORRY");
4610 } else {
4611 System.exit(1);
4612 }
4613 }
4614
4615 private void errorNeedArgument(String flag) {
4616 Object[] source = {flag};
4617 System.err.println(new MessageFormat(
4618 rb.getString("Command.option.flag.needs.an.argument.")).format(source));
4619 tinyHelp();
4620 }
|