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