|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T y
Length: 1274 (0x4fa)
Types: TextFile
Names: »yagrip.pl«
└─⟦4f9d7c866⟧ Bits:30007245 EUUGD6: Sikkerheds distributionen
└─⟦3da311d67⟧ »./cops/1.04/cops_104.tar.Z«
└─⟦6a2577110⟧
└─⟦4f9d7c866⟧ Bits:30007245 EUUGD6: Sikkerheds distributionen
└─⟦6a2577110⟧ »./cops/1.04/cops_104.tar«
└─⟦this⟧ »cops_104/perl/yagrip.pl«
#Yet Another Getopt Routine In Perl
# jgreely@cis.ohio-state.edu, 89/11/1
#usage:
#&getopt("f:bar") ||
# die &usage("script","f:bar","oo","[files ...]");
#
sub getopt {
local($_,$flag,$opt,$f,$r,@temp) = @_;
@temp = split(/(.):/);
while ($#temp >= $[) {
$flag .= shift(@temp);
$opt .= shift(@temp);
}
while ($_ = $ARGV[0], /^-(.)(.*)/ && shift(@ARGV)) {
($f,$r) = ($1,$2);
last if $f eq '-';
if (index($flag,$f) >= $[) {
eval "\$opt_$f++;";
$r =~ /^(.)(.*)/,redo if $r ne '';
}elsif (index($opt,$f) >= $[) {
$r = $r eq '' ? shift(@ARGV) : $r;
eval "\$opt_$f = \$r;";
}else{
print STDERR "Unrecognized switch \"-$f\".\n";
return 0;
}
}
return 1;
}
#usage: usage:
# &usage(progname,arglist,@names,@last);
#ex:
# &usage("script","f:bar","oo","[file ...]");
#would return
# "usage: script [-f oo] [-bar] [file ...]"
#
sub usage {
local($prog,$_,@list) = @_;
local($string,$flag,@string,@temp,@last) = ();
@temp = split(/(.):/);
push(@string,"usage:",$prog);
while ($#temp >= $[) {
if (($flag = shift(@temp)) ne '') {
push(@string,"[-$flag]");
}
if (($flag = shift(@temp)) ne '') {
push(@string,sprintf("[-%s %s]",$flag,shift(@list)));
}
}
push(@string,@list) if $#list >= $[;
return join(' ',@string) . "\n";
}
1;