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
28 use vars qw(%alias %newalias $fn $localfn);
33 $fn = "$main::cmd/Aliases";
34 $localfn = "$main::localcmd/Aliases";
41 return ($@) if $@ && ref $ref;
44 my %oldalias = %alias;
45 local %alias; # define a local one
48 return ($@) if $@ && ref $ref;
51 foreach $let (keys %alias) {
52 # stick any local definitions at the front
54 push @a, (@{$alias{$let}});
55 push @a, (@{$oldalias{$let}}) if exists $oldalias{$let};
56 $oldalias{$let} = \@a;
58 %newalias = %oldalias;
60 %alias = %newalias if -e $localfn;
70 # called as CmdAlias::get_cmd("string");
75 my ($let) = unpack "A1", $s;
81 return undef if !$ref;
84 for ($i = 0; $i < $n; $i += 3) {
85 if ($s =~ /$ref->[$i]/i) {
86 my $ri = qq{\$ro = "$ref->[$i+1]"};
96 # called as CmdAlias::get_hlp("string");
101 my ($let) = unpack "A1", $s;
107 return undef if !$ref;
110 for ($i = 0; $i < $n; $i += 3) {
111 if ($s =~ /$ref->[$i]/i) {
112 my $ri = qq{\$ro = "$ref->[$i+2]"};