/** * getOption * * @param sw int value switch whose option is requested */ public String getOption(int sw) { Character opt = new Character((char) sw); return getOption(opt); }
/** * Basic class constructor. Gets the flags passed, in a * notation similar to the one used by the sh, ksh, bash, * and perl getopts. * <p/> * String array 'args' is passed and * is parsed according to the flags. * <p/> * * @param progname program name for producing error messages * @param flags a string with the valid switch names * @param args array of strings (usually args) * <p/> * @throws InvalidSwitch thrown when invalid options are found * <p/> */ public Getopts(String progname, String flags, String args[]) throws InvalidSwitch { initialize(progname,flags,args); }
public static void main(String args[]) throws Exception { Getopts opts = null; try { opts = new Getopts("d", args); if (opts.getSwitch('d').set) { debug = true; } } catch (InvalidSwitch is) { throw new Exception(is); } String testdir = null; if (opts.argList().length > 0) testdir = opts.argList()[0]; else testdir = "."; new TestDConnect2().testDConnect2(); }
Getopts opts = new Getopts(args[0], args1); Enumeration names = opts.swList(); OptSwitch cs = opts.getSwitch((Character) names.nextElement()); System.out.println("args[" + i + "] : " + (char) cs.sw + " " + cs.type + " " + String argp[] = opts.argList(); for (i = 0; i < argp.length; i++) { System.out.println("argv[" + i + "] : " + argp[i]);
initialize(progname,optflags,optargv); } catch (InvalidSwitch ise) { System.err.println("new Getopts: "+ise.getMessage()); optenum = swList(); OptSwitch sw = getSwitch(c); if(sw.set) { if(sw.acceptVal()) {
Getopts opts = new Getopts(args[0], args1); Enumeration names = opts.swList(); OptSwitch cs = opts.getSwitch((Character) names.nextElement()); System.out.println("args[" + i + "] : " + (char) cs.sw + " " + cs.type + " " + String argp[] = opts.argList(); for (i = 0; i < argp.length; i++) { System.out.println("argv[" + i + "] : " + argp[i]);
initialize(progname,optflags,optargv); } catch (InvalidSwitch ise) { System.err.println("new Getopts: "+ise.getMessage()); optenum = swList(); OptSwitch sw = getSwitch(c); if(sw.set) { if(sw.acceptVal()) {
/** * getOption * * @param sw Character switch whose option is requested */ public String getOption(Character sw) { return getOption( (int) sw.charValue()); }
/** * Basic class constructor. Gets the flags passed, in a * notation similar to the one used by the sh, ksh, bash, * and perl getopts. * <p/> * String array 'args' is passed and * is parsed according to the flags. * <p/> * * @param progname program name for producing error messages * @param flags a string with the valid switch names * @param args array of strings (usually args) * <p/> * @throws InvalidSwitch thrown when invalid options are found * <p/> */ public Getopts(String progname, String flags, String args[]) throws InvalidSwitch { initialize(progname,flags,args); }
Getopts opts = new Getopts("dxaDXgVvc:m:zp", args); if (opts.getSwitch(new Character('d')).set) get_dds = true; if (opts.getSwitch(new Character('x')).set) get_ddx = true; if (opts.getSwitch(new Character('a')).set) get_das = true; if (opts.getSwitch(new Character('D')).set) get_data = true; if (opts.getSwitch(new Character('X')).set) get_dataX = true; if (opts.getSwitch(new Character('p')).set) dump_data = get_data = true; if (opts.getSwitch(new Character('V')).set) { System.err.println("geturl version: " + VERSION); System.exit(0); if (opts.getSwitch(new Character('v')).set) verbose = true; if (opts.getSwitch(new Character('g')).set) gui = true; optVal = opts.getSwitch(new Character('c')).val; if (optVal != null) { cexpr = true; optVal = opts.getSwitch(new Character('m')).val; if (optVal != null) { multi = true;
/** * getOption * * @param sw Character switch whose option is requested */ public String getOption(Character sw) { return getOption( (int) sw.charValue()); }
/** * getOption * * @param sw int value switch whose option is requested */ public String getOption(int sw) { Character opt = new Character((char) sw); return getOption(opt); }