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