Getopt.java revision 111
0N/A * The contents of this file are subject to the terms of the 0N/A * Common Development and Distribution License (the "License"). 0N/A * You may not use this file except in compliance with the License. 0N/A * language governing permissions and limitations under the License. 0N/A * When distributing Covered Code, include this CDDL HEADER in each 0N/A * If applicable, add the following below this CDDL HEADER, with the 0N/A * fields enclosed by brackets "[]" replaced with your own identifying 0N/A * information: Portions Copyright [yyyy] [name of copyright owner] 0N/A * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 0N/A * Use is subject to license terms. 0N/A * A simple implementation of the getopt(3c). It does just implement what I 0N/A * need ;-) Please note that I dislike the way GNU getopt allows mixing of 0N/A * options and arguments, so this version will stop processing options as soon 0N/A * as it encounters an argument. 0N/A * Creates a new instance of Getopt 0N/A * @param argv argument vector 0N/A * @param opts the list of allowed options * Parse the command lineoptions * @throws ParseException if an illegal argument is passed // End of command line options ;) // does this option take an argument? // next should be an argument // Rest of this is the argument // next argument vector contains the argument * Get the next option in the options string. * @return the next valid option, or -1 if all options are processed * Reset the current pointer so we may traverse all the options again.. * Get the argument to the current option * @return the argument or null if none present (or allowed) * Get the index of the first argument * @return the index of the first argument in the original array * @param args the command line arguments