e30820a3189d1c5a26ab0e69de44bddb9d8e24ee
;# getopts.pl - a better getopt.pl
# This library is no longer being maintained, and is included for backward
# compatibility with Perl 4 programs which may require it.
# In particular, this should not be used as an example of modern Perl
# programming techniques.
# Suggested alternatives: Getopt::Long or Getopt::Std
;# do Getopts('a:bc'); # -a takes arg. -b & -c not. Sets opt_* as a
local($argumentative) = @_;
local(@args,$_,$first,$rest);
@args = split( / */, $argumentative );
while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
($first,$rest) = ($1,$2);
$pos = index($argumentative,$first);
if($args[$pos+1] eq ':') {
push(\@opt_$first, \$rest);
if (!defined \$opt_$first or \$opt_$first eq '') {
\$opt_$first .= ' ' . \$rest;
print STDERR
"Unknown option: $first\n";