mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 00:54:38 +02:00
8189102: All tools should support -?, -h and --help
Reviewed-by: kvn, jjg, weijun, alanb, rfield, ksrini
This commit is contained in:
parent
1655b15477
commit
22762d1cdc
59 changed files with 680 additions and 152 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -137,7 +137,11 @@ class KinitOptions {
|
|||
lifetime = getTime(Config.duration(args[++i]));
|
||||
} else if (args[i].equals("-r")) {
|
||||
renewable_lifetime = getTime(Config.duration(args[++i]));
|
||||
} else if (args[i].equalsIgnoreCase("-help")) {
|
||||
} else if (args[i].equalsIgnoreCase("-?") ||
|
||||
args[i].equalsIgnoreCase("-h") ||
|
||||
args[i].equalsIgnoreCase("--help") ||
|
||||
// -help: legacy.
|
||||
args[i].equalsIgnoreCase("-help")) {
|
||||
printHelp();
|
||||
System.exit(0);
|
||||
} else if (p == null) { // Haven't yet processed a "principal"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -133,6 +133,12 @@ public class Klist {
|
|||
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")) {
|
||||
printHelp();
|
||||
System.exit(0);
|
||||
}
|
||||
if ((args[i].length() >= 2) && (args[i].startsWith("-"))) {
|
||||
arg = Character.valueOf(args[i].charAt(1));
|
||||
switch (arg.charValue()) {
|
||||
|
@ -350,7 +356,5 @@ public class Klist {
|
|||
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.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -72,8 +72,14 @@ public class Ktab {
|
|||
*/
|
||||
public static void main(String[] args) {
|
||||
Ktab ktab = new Ktab();
|
||||
if ((args.length == 1) && (args[0].equalsIgnoreCase("-help"))) {
|
||||
if ((args.length == 1) &&
|
||||
((args[0].equalsIgnoreCase("-?")) ||
|
||||
(args[0].equalsIgnoreCase("-h")) ||
|
||||
(args[0].equalsIgnoreCase("--help")) ||
|
||||
// -help: legacy.
|
||||
(args[0].equalsIgnoreCase("-help")))) {
|
||||
ktab.printHelp();
|
||||
System.exit(0);
|
||||
return;
|
||||
} else if ((args == null) || (args.length == 0)) {
|
||||
ktab.action = 'l';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue