equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
50 private boolean mainArgs; |
50 private boolean mainArgs; |
51 private String hostname; |
51 private String hostname; |
52 private HostIdentifier hostId; |
52 private HostIdentifier hostId; |
53 |
53 |
54 public static void printUsage(PrintStream ps) { |
54 public static void printUsage(PrintStream ps) { |
55 ps.println("usage: jps [-help]"); |
55 ps.println("usage: jps [--help]"); |
56 ps.println(" jps [-q] [-mlvV] [<hostid>]"); |
56 ps.println(" jps [-q] [-mlvV] [<hostid>]"); |
57 ps.println(); |
57 ps.println(); |
58 ps.println("Definitions:"); |
58 ps.println("Definitions:"); |
59 ps.println(" <hostid>: <hostname>[:<port>]"); |
59 ps.println(" <hostid>: <hostname>[:<port>]"); |
|
60 ps.println(" -? -h --help -help: Print this help message and exit."); |
60 } |
61 } |
61 |
62 |
62 public Arguments(String[] args) throws IllegalArgumentException { |
63 public Arguments(String[] args) throws IllegalArgumentException { |
63 int argc = 0; |
64 int argc = 0; |
64 |
65 |
65 if (args.length == 1) { |
66 if (args.length == 1) { |
66 if ((args[0].compareTo("-?") == 0) |
67 if ((args[0].compareTo("-?") == 0) |
67 || (args[0].compareTo("-help")== 0)) { |
68 || (args[0].compareTo("-h")== 0) |
|
69 || (args[0].compareTo("--help")== 0) |
|
70 // -help: legacy. |
|
71 || (args[0].compareTo("-help")== 0)) { |
68 help = true; |
72 help = true; |
69 return; |
73 return; |
70 } |
74 } |
71 } |
75 } |
72 |
76 |