2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-09 20:57:11 +00:00

fhem.pl: fix help cmd followed by cmd with different casing (Forum #74903)

git-svn-id: https://svn.fhem.de/fhem/trunk@17528 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-10-14 11:53:38 +00:00
parent 22a23a222f
commit 567fea2a0c

View File

@ -1165,14 +1165,16 @@ AnalyzeCommand($$;$)
#############
# Search for abbreviation
sub
getAbbr($$)
getAbbr($$;$)
{
my ($fn,$h) = @_;
my ($fn,$h,$isMod) = @_;
my $lcfn = lc($fn);
my $fnlen = length($fn);
return $fn if(defined($h->{$fn}));
return $fn if(defined($h->{$fn}) && ($isMod || $h->{$fn}{Fn})); # speedup
foreach my $f (sort keys %{$h}) {
if(length($f) >= $fnlen && lc(substr($f,0,$fnlen)) eq $lcfn) {
if(length($f) >= $fnlen &&
lc(substr($f,0,$fnlen)) eq $lcfn &&
($isMod || $h->{$f}{Fn})) {
Log 5, "AnalyzeCommand: trying $f for $fn";
return $f;
}
@ -1190,7 +1192,7 @@ AnalyzeCommand($$;$)
if(!$cmds{$fn} || !defined($cmds{$fn}{Fn})) {
my $modName;
$modName = $cmds{$fn}{ModuleName} if($cmds{$fn} && $cmds{$fn}{ModuleName});
$modName = getAbbr($fn,\%modules) if(!$modName);
$modName = getAbbr($fn,\%modules,1) if(!$modName);
LoadModule($modName) if($modName);
my $lfn = getAbbr($fn,\%cmds);