home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Acorn User 10
/
AU_CD10.iso
/
Updates
/
Perl
/
RPC
/
!Perl
/
scripts
/
which
< prev
next >
Wrap
Text File
|
1998-07-14
|
890b
|
37 lines
use RISCOS::Filespec;
use RISCOS::Module 'modules_only';
$command = $ARGV[0];
die "$0 <command>\n" unless $command;
($alias_command = $command) =~ s/\.$/\*/ ;
# Abbreviated commands match the first Alias$ variable
$alias = $ENV{"Alias\$$alias_command"};
if ($command !~ s/^\%// and $alias)
{
($command, $tail) = $alias =~ /\s*(\S+)\s+(.*)/;
}
($mod_command = $command) =~ s/\.$/.*/;
# Convert trailing '.' to '.*' for perl wildcard match
foreach $modname (modules_only) {
$module = grab RISCOS::Module $modname;
if ($table = $module->CommandTable) {
foreach $com (@$table) {
$com = $com->Name;
if ($com =~ /^$mod_command$/io) {
print "$com $tail [in module '$modname']\n";
exit
}
}
}
}
$command = glob ("Run:$command");
print "$command $tail\n" if $command;
# or perl -e 'print scalar glob ("Run:$ARGV[0]") . "\n"' for a simple version!