From 0167e989f9b02650177d4be3fdc40d73e6d47c4d Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Sun, 18 May 2014 20:14:20 +0000 Subject: [PATCH] added copy command git-svn-id: https://svn.fhem.de/fhem/trunk@5888 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/98_copy.pm | 66 ++++++++++++++++++++++++++++++ fhem/MAINTAINER.txt | 1 + fhem/docs/commandref_frame.html | 1 + fhem/docs/commandref_frame_DE.html | 1 + 5 files changed, 70 insertions(+) create mode 100644 fhem/FHEM/98_copy.pm diff --git a/fhem/CHANGED b/fhem/CHANGED index 2a48ab352..0da64f8e1 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: new command copy (justme1968) - feature: enabled GIF, PNG and JPG as background image formats, enabled relative font size changed and perl specials for font size in 02_RSS.pm diff --git a/fhem/FHEM/98_copy.pm b/fhem/FHEM/98_copy.pm new file mode 100644 index 000000000..2d3f178b7 --- /dev/null +++ b/fhem/FHEM/98_copy.pm @@ -0,0 +1,66 @@ + +# $Id$ +package main; + +use strict; +use warnings; + +sub CommandCopy($$); + +sub +copy_Initialize($) +{ + my %lhash = ( Fn=>"CommandCopy", + Hlp=>" " ); + $cmds{copy} = \%lhash; +} + +sub +CommandCopy($$) +{ + my ($hash, $param) = @_; + + my @args = split(/ +/,$param); + + return "Usage: copy " if (@args != 2); + + my $d = $defs{$args[0]}; + return "$args[0] not defined" if( !$d ); + + my $cmd = "$args[1] $d->{TYPE}"; + $cmd .= " $d->{DEF}" if( $d->{DEF} ); + my $ret = CommandDefine($hash, $cmd ); + return $ret if( $ret ); + + foreach my $a (keys %{$attr{$args[0]}}) { + CommandAttr($hash, "$args[1] $a $attr{$args[0]}{$a}"); + } +} + +1; + +=pod +=begin html + + +

copy

+
    + copy <orig name> <copy name>
    +
    + Create a copy of device <orig name> with the name <copy name>. +
+ +=end html + +=begin html_DE + + +

copy

+
    + copy <orig name> <copy name>
    +
    + Erzeugt eine Kopie des Device <orig name> mit dem namen <copy name>. +
+ +=end html_DE +=cut diff --git a/fhem/MAINTAINER.txt b/fhem/MAINTAINER.txt index ff74fdcc0..b63c90ec5 100644 --- a/fhem/MAINTAINER.txt +++ b/fhem/MAINTAINER.txt @@ -223,6 +223,7 @@ FHEM/98_backup.pm mfr69bs http://forum.fhem.de Sonstiges FHEM/98_cloneDummy.pm Joachim http://forum.fhem.de Automatisierung FHEM/98_cmdalias.pm rudolfkoenig http://forum.fhem.de Automatisierung FHEM/98_configdb.pm betateilchen http://forum.fhem.de Sonstiges +FHEM/98_copy.pm justme1968 http://forum.fhem.de Sonstiges FHEM/98_dewpoint.pm wherzig http://forum.fhem.de Automatisierung FHEM/98_dummy.pm rudolfkoenig http://forum.fhem.de Automatisierung FHEM/98_fheminfo.pm mfr69bs http://forum.fhem.de Sonstiges diff --git a/fhem/docs/commandref_frame.html b/fhem/docs/commandref_frame.html index b5a47f531..dd13187be 100644 --- a/fhem/docs/commandref_frame.html +++ b/fhem/docs/commandref_frame.html @@ -39,6 +39,7 @@ CULflash   cmdalias   configdb   + copy   createlog   define   delete   diff --git a/fhem/docs/commandref_frame_DE.html b/fhem/docs/commandref_frame_DE.html index f26e3a769..7e7617d9b 100644 --- a/fhem/docs/commandref_frame_DE.html +++ b/fhem/docs/commandref_frame_DE.html @@ -38,6 +38,7 @@ CULflash   cmdalias   configdb   + copy   createlog   define   delete