From 472198419a0f49f29108cf32a35713b48db90a04 Mon Sep 17 00:00:00 2001
From: Steven Armstrong <steven@icarus.ethz.ch>
Date: Thu, 12 Sep 2013 22:28:29 +0200
Subject: [PATCH] don't assume first argument to be -r, fixes #200

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
---
 cdist/test/fixtures/remote/copy  | 9 +++------
 other/examples/remote/local/copy | 9 +++------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/cdist/test/fixtures/remote/copy b/cdist/test/fixtures/remote/copy
index a5b5fe6f..57369b53 100755
--- a/cdist/test/fixtures/remote/copy
+++ b/cdist/test/fixtures/remote/copy
@@ -1,6 +1,7 @@
 #!/bin/sh
 #
 # 2012-2013 Nico Schottelius (nico-cdist schottelius.org)
+# 2013 Steven Armstrong (steven-cdist armstrong.cc)
 #
 # This file is part of cdist.
 #
@@ -22,9 +23,5 @@
 # test cases
 #
 
-recursive=$1; shift
-src=$1; shift
-dst=$1; shift
-
-dst=$(echo $dst | sed "s/^${__target_host}://")
-cp --dereference "$recursive" "$src" "$dst"
+code="$(echo "$@" | sed "s|\([[:space:]]+\)$__target_host:|\1|g")"
+cp --dereference $code
diff --git a/other/examples/remote/local/copy b/other/examples/remote/local/copy
index 644fee15..0ddc44c8 100755
--- a/other/examples/remote/local/copy
+++ b/other/examples/remote/local/copy
@@ -1,6 +1,7 @@
 #!/bin/sh
 #
 # 2012 Nico Schottelius (nico-cdist schottelius.org)
+# 2013 Steven Armstrong (steven-cdist armstrong.cc)
 #
 # This file is part of cdist.
 #
@@ -19,9 +20,5 @@
 #
 #
 
-recursive=$1; shift
-src=$1; shift
-dst=$1; shift
-
-dst=$(echo $dst | sed "s/^${__target_host}://")
-cp "$recursive" "$src" "$dst"
+code="$(echo "$@" | sed "s|\([[:space:]]+\)$__target_host:|\1|g")"
+cp --dereference $code