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 $cmd_mtime $localcmd_mtime $fn $localfn);
51 $fn = "$main::cmd/Aliases";
52 $localfn = "$main::localcmd/Aliases";
57 # print "m: $m oldmtime: $cmd_mtime\n";
58 if ($m < $cmd_mtime) {
66 if ($m < $localcmd_mtime) {
75 # called as CmdAlias::get_cmd("string");
80 my ($let) = unpack "A1", $s;
88 return undef if !$ref;
91 for ($i = 0; $i < $n; $i += 3) {
92 if ($s =~ /$ref->[$i]/i) {
93 my $ri = qq{\$ro = "$ref->[$i+1]"};
103 # called as CmdAlias::get_hlp("string");
108 my ($let) = unpack "A1", $s;
116 return undef if !$ref;
119 for ($i = 0; $i < $n; $i += 3) {
120 if ($s =~ /$ref->[$i]/i) {
121 my $ri = qq{$ref->[$i+2]};