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";
40 return ($@) if $@ && ref $ref;
43 my %oldalias = %alias;
44 local %alias; # define a local one
47 return ($@) if $@ && ref $ref;
50 foreach $let (keys %alias) {
51 # stick any local definitions at the front
53 push @a, (@{$alias{$let}});
54 push @a, (@{$oldalias{$let}}) if exists $oldalias{$let};
55 $oldalias{$let} = \@a;
57 %newalias = %oldalias;
59 %alias = %newalias if -e $localfn;
69 # called as CmdAlias::get_cmd("string");
74 my ($let) = unpack "A1", $s;
80 return undef if !$ref;
83 for ($i = 0; $i < $n; $i += 3) {
84 if ($s =~ /$ref->[$i]/i) {
85 my $ri = qq{\$ro = "$ref->[$i+1]"};
95 # called as CmdAlias::get_hlp("string");
100 my ($let) = unpack "A1", $s;
106 return undef if !$ref;
109 for ($i = 0; $i < $n; $i += 3) {
110 if ($s =~ /$ref->[$i]/i) {
111 my $ri = qq{\$ro = "$ref->[$i+2]"};