2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-17 11:26:03 +00:00

fhem.pl: parseParams patch (!) from hexenmeister (Forum )

git-svn-id: https://svn.fhem.de/fhem/trunk@16291 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-02-28 21:09:20 +00:00
parent eaf352d371
commit f8d0391294

@ -128,7 +128,7 @@ sub getUniqueId();
sub latin1ToUtf8($); sub latin1ToUtf8($);
sub myrename($$$); sub myrename($$$);
sub notifyRegexpChanged($$); sub notifyRegexpChanged($$);
sub parseParams($;$$); sub parseParams($;$$$);
sub perlSyntaxCheck($%); sub perlSyntaxCheck($%);
sub readingsBeginUpdate($); sub readingsBeginUpdate($);
sub readingsBulkUpdate($$$@); sub readingsBulkUpdate($$$@);
@ -5164,11 +5164,12 @@ perlSyntaxCheck($%)
##################################### #####################################
sub sub
parseParams($;$$) parseParams($;$$$)
{ {
my($cmd, $separator, $joiner) = @_; my($cmd, $separator, $joiner, $keyvalueseparator) = @_;
$separator = ' ' if(!$separator); $separator = ' ' if(!$separator);
$joiner = $separator if(!$joiner); # needed if separator is a regexp $joiner = $separator if(!$joiner); # needed if separator is a regexp
$keyvalueseparator = '=' if(!$keyvalueseparator);
my(@a, %h); my(@a, %h);
my @params; my @params;
@ -5181,7 +5182,7 @@ parseParams($;$$)
while (@params) { while (@params) {
my $param = shift(@params); my $param = shift(@params);
next if($param eq ""); next if($param eq "");
my ($key, $value) = split( '=', $param, 2 ); my ($key, $value) = split( $keyvalueseparator, $param, 2 );
if( !defined( $value ) ) { if( !defined( $value ) ) {
$value = $key; $value = $key;