# parsearg.rb - parse arguments
# $Date: 2007-02-13 08:01:19 +0900 (Tue, 13 Feb 2007) $
# by Yasuo OHBA(SHL Japan Inc. Technology Dept.)
warn "Warning:#{caller[0].sub(/:in `.*'\z/, '')}: parsearg is deprecated after Ruby 1.8.1; use optparse instead"
def setParenthesis(ex, opt, c)
ex = sprintf("%s$OPT_%s%s", ex, opt, c)
ex = sprintf("%s%s", ex, c)
ex = sprintf("%s$OPT_%s %s%s ", ex, opt, c, c)
ex = sprintf("%s %s%s ", ex, c, c)
def setExpression(ex, opt, op)
ex = sprintf("%s$OPT_%s", ex, opt)
ex = setParenthesis(ex, opt, op.chr)
ex = setOrAnd(ex, opt, op.chr)
# parseArgs is obsolete. Use OptionParser instead.
def parseArgs(argc, nopt, single_opts, *opts)
if (noOptions = getopts(single_opts, *opts)) == nil
for o in nopt.split(/[()|&]/)
ex = setExpression(ex, o, nopt[pos])
print "Format Error!! : \"" + nopt + "\"\t[parseArgs]\n"