summaryrefslogtreecommitdiff
path: root/lib/parsearg.rb
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-24 08:23:09 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-24 08:23:09 +0000
commitbca0b4075d53194b09ed5edef95d9ba9c3f6e62a (patch)
tree29404fd7f60a73267121b5b4f98b7d2c890bbfba /lib/parsearg.rb
parent30f1eb1856eae8b310fe6440dfcab95b6fe76046 (diff)
Mon Dec 24 17:20:34 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/{mailread.rb,getopts.rb,parsearg.rb}: removed. see [ruby-core:12535], [ruby-dev:31969]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/parsearg.rb')
-rw-r--r--lib/parsearg.rb87
1 files changed, 0 insertions, 87 deletions
diff --git a/lib/parsearg.rb b/lib/parsearg.rb
deleted file mode 100644
index cab2dba789..0000000000
--- a/lib/parsearg.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# parsearg.rb - parse arguments
-# $Release Version: $
-# $Revision$
-# $Date$
-# 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"
-
-$RCS_ID=%q$Header$
-
-require "getopts"
-
-def printUsageAndExit()
- if $USAGE
- eval($USAGE)
- end
- exit()
-end
-
-def setParenthesis(ex, opt, c)
- if opt != ""
- ex = sprintf("%s$OPT_%s%s", ex, opt, c)
- else
- ex = sprintf("%s%s", ex, c)
- end
- return ex
-end
-
-def setOrAnd(ex, opt, c)
- if opt != ""
- ex = sprintf("%s$OPT_%s %s%s ", ex, opt, c, c)
- else
- ex = sprintf("%s %s%s ", ex, c, c)
- end
- return ex
-end
-
-def setExpression(ex, opt, op)
- if !op
- ex = sprintf("%s$OPT_%s", ex, opt)
- return ex
- end
- case op.chr
- when "(", ")"
- ex = setParenthesis(ex, opt, op.chr)
- when "|", "&"
- ex = setOrAnd(ex, opt, op.chr)
- else
- return nil
- end
- return ex
-end
-
-# parseArgs is obsolete. Use OptionParser instead.
-
-def parseArgs(argc, nopt, single_opts, *opts)
- if (noOptions = getopts(single_opts, *opts)) == nil
- printUsageAndExit()
- end
- if nopt
- ex = nil
- pos = 0
- for o in nopt.split(/[()|&]/)
- pos += o.length
- ex = setExpression(ex, o, nopt[pos])
- pos += 1
- end
- begin
- if !eval(ex)
- printUsageAndExit()
- end
- rescue
- print "Format Error!! : \"" + nopt + "\"\t[parseArgs]\n"
- exit!(-1)
- end
- end
- if ARGV.length < argc
- printUsageAndExit()
- end
- return noOptions
-end