2 # This package impliments some of the ak1a aliases that can't
3 # be done with interpolation from the file names.
5 # Basically it takes the input and bashes down the list of aliases
6 # for that starting letter until it either matches (in which a substitution
9 # To roll your own Aliases, copy the /spider/cmd/Aliases file to
10 # /spider/local_cmd and alter it to your taste.
12 # To make it active type 'load/aliases'
15 # Copyright (c) 1998 Dirk Koopman G1TLH
27 use vars qw(%alias %newalias $fn $localfn);
32 $fn = "$main::cmd/Aliases";
33 $localfn = "$main::localcmd/Aliases";
35 use vars qw($VERSION $BRANCH);
36 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
37 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
38 $main::build += $VERSION;
39 $main::branch += $BRANCH;
46 return ($@) if $@ && ref $ref;
49 my %oldalias = %alias;
50 local %alias; # define a local one
53 return ($@) if $@ && ref $ref;
56 foreach $let (keys %alias) {
57 # stick any local definitions at the front
59 push @a, (@{$alias{$let}});
60 push @a, (@{$oldalias{$let}}) if exists $oldalias{$let};
61 $oldalias{$let} = \@a;
63 %newalias = %oldalias;
65 %alias = %newalias if -e $localfn;
75 # called as CmdAlias::get_cmd("string");
80 my ($let) = unpack "A1", $s;
86 return undef if !$ref;
89 for ($i = 0; $i < $n; $i += 3) {
90 if ($s =~ /$ref->[$i]/i) {
91 my $ri = qq{\$ro = "$ref->[$i+1]"};
101 # called as CmdAlias::get_hlp("string");
106 my ($let) = unpack "A1", $s;
112 return undef if !$ref;
115 for ($i = 0; $i < $n; $i += 3) {
116 if ($s =~ /$ref->[$i]/i) {
117 my $ri = qq{\$ro = "$ref->[$i+2]"};