2 # This package simply takes a string, looks it up in a
3 # hash and returns the value.
5 # The hash is produced by reading the Alias file in both command directories
6 # which contain entries for the %cmd hash. This file is in different forms in
7 # the two directories:-
9 # in the main cmd directory it has entries like:-
14 # sp => 'send private',
15 # s/p => 'send private',
16 # sb => 'send bulletin',
19 # for the local cmd directory you should do it like this:-
23 # $alias{'s/p'} = 'send private';
24 # $alias{'s/b'} = 'send bulletin';
26 # This will allow you to override as well as add to the basic set of commands
28 # This system works in same way as the commands, if the modification times of
29 # the two files have changed then they are re-read.
31 # Copyright (c) 1998 Dirk Koopman G1TLH
44 use vars qw(%alias $fn $localfn);
48 $fn = "$main::cmd/Aliases";
49 $localfn = "$main::localcmd/Aliases";
56 return ($@) if $@ && ref $ref;
61 return ($@) if $@ && ref $ref;
72 # called as CmdAlias::get_cmd("string");
77 my ($let) = unpack "A1", $s;
83 return undef if !$ref;
86 for ($i = 0; $i < $n; $i += 3) {
87 if ($s =~ /$ref->[$i]/i) {
88 my $ri = qq{\$ro = "$ref->[$i+1]"};
98 # called as CmdAlias::get_hlp("string");
103 my ($let) = unpack "A1", $s;
111 return undef if !$ref;
114 for ($i = 0; $i < $n; $i += 3) {
115 if ($s =~ /$ref->[$i]/i) {
116 my $ri = qq{$ref->[$i+2]};