summaryrefslogtreecommitdiff
path: root/net/rtorrent
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2013-05-09 14:28:25 +0000
committerjoerg <joerg@pkgsrc.org>2013-05-09 14:28:25 +0000
commite3be174188264517988a8d676922a0db8790e4de (patch)
tree8f64044f12048844af658ad847d9d9d7d6c6849f /net/rtorrent
parent2a7c3ce5ce7e164561251c5e0b57469cb28e5d6a (diff)
downloadpkgsrc-e3be174188264517988a8d676922a0db8790e4de.tar.gz
Use enums for constants to not depend on the optimizer to inline the
values. Fix C++11 vs TR1 mismatches.
Diffstat (limited to 'net/rtorrent')
-rw-r--r--net/rtorrent/Makefile6
-rw-r--r--net/rtorrent/distinfo48
-rw-r--r--net/rtorrent/patches/patch-ag36
-rw-r--r--net/rtorrent/patches/patch-rak_functional__fun.h102
-rw-r--r--net/rtorrent/patches/patch-rak_priority__queue__default.h27
-rw-r--r--net/rtorrent/patches/patch-src_command__download.cc420
-rw-r--r--net/rtorrent/patches/patch-src_command__dynamic.cc130
-rw-r--r--net/rtorrent/patches/patch-src_command__events.cc75
-rw-r--r--net/rtorrent/patches/patch-src_command__file.cc103
-rw-r--r--net/rtorrent/patches/patch-src_command__groups.cc126
-rw-r--r--net/rtorrent/patches/patch-src_command__helpers.h74
-rw-r--r--net/rtorrent/patches/patch-src_command__ip.cc51
-rw-r--r--net/rtorrent/patches/patch-src_command__local.cc183
-rw-r--r--net/rtorrent/patches/patch-src_command__network.cc146
-rw-r--r--net/rtorrent/patches/patch-src_command__peer.cc91
-rw-r--r--net/rtorrent/patches/patch-src_command__scheduler.cc32
-rw-r--r--net/rtorrent/patches/patch-src_command__throttle.cc86
-rw-r--r--net/rtorrent/patches/patch-src_command__tracker.cc123
-rw-r--r--net/rtorrent/patches/patch-src_command__ui.cc120
-rw-r--r--net/rtorrent/patches/patch-src_control.cc28
-rw-r--r--net/rtorrent/patches/patch-src_core_curl__get.cc28
-rw-r--r--net/rtorrent/patches/patch-src_core_curl__stack.cc13
-rw-r--r--net/rtorrent/patches/patch-src_core_dht__manager.cc37
-rw-r--r--net/rtorrent/patches/patch-src_core_download.cc36
-rw-r--r--net/rtorrent/patches/patch-src_core_download__factory.cc42
-rw-r--r--net/rtorrent/patches/patch-src_core_download__list.cc15
-rw-r--r--net/rtorrent/patches/patch-src_core_http__queue.cc15
-rw-r--r--net/rtorrent/patches/patch-src_core_manager.cc13
-rw-r--r--net/rtorrent/patches/patch-src_core_manager.h21
-rw-r--r--net/rtorrent/patches/patch-src_core_view.cc13
-rw-r--r--net/rtorrent/patches/patch-src_display_frame.cc47
-rw-r--r--net/rtorrent/patches/patch-src_display_manager.cc26
-rw-r--r--net/rtorrent/patches/patch-src_display_window.cc28
-rw-r--r--net/rtorrent/patches/patch-src_display_window__file__list.cc12
-rw-r--r--net/rtorrent/patches/patch-src_display_window__log.cc33
-rw-r--r--net/rtorrent/patches/patch-src_rpc_command.h42
-rw-r--r--net/rtorrent/patches/patch-src_rpc_command__scheduler.cc13
-rw-r--r--net/rtorrent/patches/patch-src_rpc_command__scheduler__item.h26
-rw-r--r--net/rtorrent/patches/patch-src_rpc_exec__file.cc19
-rw-r--r--net/rtorrent/patches/patch-src_rpc_exec__file.h24
-rw-r--r--net/rtorrent/patches/patch-src_rpc_object__storage.cc0
-rw-r--r--net/rtorrent/patches/patch-src_rpc_object__storage.h66
-rw-r--r--net/rtorrent/patches/patch-src_rpc_xmlrpc.h34
-rw-r--r--net/rtorrent/patches/patch-src_signal__handler.cc12
-rw-r--r--net/rtorrent/patches/patch-src_thread__base.cc28
-rw-r--r--net/rtorrent/patches/patch-src_ui_element__log__complete.cc30
-rw-r--r--net/rtorrent/patches/patch-src_ui_element__peer__list.cc33
47 files changed, 2707 insertions, 6 deletions
diff --git a/net/rtorrent/Makefile b/net/rtorrent/Makefile
index eee32464eb0..dab24d6192c 100644
--- a/net/rtorrent/Makefile
+++ b/net/rtorrent/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.53 2013/02/06 23:23:23 jperkin Exp $
+# $NetBSD: Makefile,v 1.54 2013/05/09 14:28:25 joerg Exp $
DISTNAME= rtorrent-0.9.2
PKGREVISION= 2
@@ -42,6 +42,10 @@ CXXFLAGS+= -fpermissive -fno-strength-reduce -fno-thread-jumps \
CXXFLAGS+= -march=i486
.endif
+.if !empty(PKGSRC_COMPILER:Mclang)
+CXXFLAGS+= -std=c++11
+.endif
+
INSTALLATION_DIRS= share/examples/rtorrent
post-install:
diff --git a/net/rtorrent/distinfo b/net/rtorrent/distinfo
index d3e012eb5f5..07da46fa6ca 100644
--- a/net/rtorrent/distinfo
+++ b/net/rtorrent/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.30 2012/05/24 17:01:43 marino Exp $
+$NetBSD: distinfo,v 1.31 2013/05/09 14:28:25 joerg Exp $
SHA1 (rtorrent-0.9.2.tar.gz) = 2a642d722745091265037ed8929a23c237a3b99f
RMD160 (rtorrent-0.9.2.tar.gz) = 130a4c7f3bd018f7247d4561170d6878ab7a120f
@@ -7,4 +7,48 @@ SHA1 (patch-ab) = 87873bb32166d00398ab0ef6421a6fe85a55c914
SHA1 (patch-ad) = f993340975dca61d5f7d7014b6959ee50b12a7b4
SHA1 (patch-ae) = a370881bfdd8534eb25fcbcff8d258b19797941f
SHA1 (patch-af) = 842a01cbc75e61092b4d33fe9155a728e7c502e6
-SHA1 (patch-ag) = b7e5fe242b19f994f013acc9ec54a65fed729c29
+SHA1 (patch-ag) = 30b3613f009a68266d82215ce0aea5ab370389ab
+SHA1 (patch-rak_functional__fun.h) = b495de4d2a3c2ef0ba3caaf8dd8dede7f322de91
+SHA1 (patch-rak_priority__queue__default.h) = 551bebdce83b2d84c31bafdb9f02217ea0df3a86
+SHA1 (patch-src_command__download.cc) = 95df3310ebf9e1aae4d46527bf7231d14824f2cf
+SHA1 (patch-src_command__dynamic.cc) = 1008ace9f654deea91be1ed6f9d2b9fef837de57
+SHA1 (patch-src_command__events.cc) = 680648dddb15f65e6a572aed24343b1f4cba816d
+SHA1 (patch-src_command__file.cc) = 1ceef7bdc5ccaec7d88ec8d1fc16e2ad613110f7
+SHA1 (patch-src_command__groups.cc) = 1c2c8cd2450281e1953bf21f1e431e8313aac9b0
+SHA1 (patch-src_command__helpers.h) = 95532bf8d42dc1779a50014bcc3a82126ca51e4f
+SHA1 (patch-src_command__ip.cc) = 370e91d7659514a4a0f431dea76718264ceec540
+SHA1 (patch-src_command__local.cc) = cb8f647e1964682bc4dbdb6816d39afe6548e206
+SHA1 (patch-src_command__network.cc) = f068eee63fe4a21402da52cb8d7b8bd1987b3dcf
+SHA1 (patch-src_command__peer.cc) = d47190cf3cde5da21066b440cc368f21ddddd3cd
+SHA1 (patch-src_command__scheduler.cc) = 87496e0ec21d398db6560870866881b901e5c398
+SHA1 (patch-src_command__throttle.cc) = 39f47456ad9be5336d68009066b3a9592e7c4a45
+SHA1 (patch-src_command__tracker.cc) = 404981b7920c70b5d7dd72d18cdbd015e7b8d43f
+SHA1 (patch-src_command__ui.cc) = 437a8ee38a1a4ff3c279b0d1228d6f4b44fdf0b9
+SHA1 (patch-src_control.cc) = 57a12b53d874bf452ba3fe015867f407ac1b2548
+SHA1 (patch-src_core_curl__get.cc) = e4d3c43c2ad25405e2cd4cfd79f13f41afa74afe
+SHA1 (patch-src_core_curl__stack.cc) = b171cd66d2b97e447a2dcb8c251e0a0f2665148d
+SHA1 (patch-src_core_dht__manager.cc) = 13d88e128b3e95871f0df2005d635c3d32f1ffc6
+SHA1 (patch-src_core_download.cc) = 07095401885edcaef27ee98ab61a414ea51ca18d
+SHA1 (patch-src_core_download__factory.cc) = 8db74e2d8a45c6b4575414df3aa030d3890cf140
+SHA1 (patch-src_core_download__list.cc) = 6b3e104e514ec86a5d3622b3719aae7d9617d7b0
+SHA1 (patch-src_core_http__queue.cc) = 2d74ce666e0dc415ac89d08ccc747c258541b504
+SHA1 (patch-src_core_manager.cc) = 767880f4d6d2183fbc3f9914926db11c57b72281
+SHA1 (patch-src_core_manager.h) = 256c12d550d7834892b7d6c2623b4219da6e79b5
+SHA1 (patch-src_core_view.cc) = 0ef92b1fe3b9fcb341327046251997b58ebcf050
+SHA1 (patch-src_display_frame.cc) = 2003fbb6679fca5e7d241375650e60a73fb6cd53
+SHA1 (patch-src_display_manager.cc) = 12a21935186ad3a2eb3287d9999c03b795fd6549
+SHA1 (patch-src_display_window.cc) = 73ddd33a509e95f3f276a58e0bd2ecc4d660409c
+SHA1 (patch-src_display_window__file__list.cc) = fe996ced6a519e8e84ef149a167f688ab2517a83
+SHA1 (patch-src_display_window__log.cc) = b916f37534c53867f9c8ffb2116ef42ef60e5cd7
+SHA1 (patch-src_rpc_command.h) = 87289f32efa98bd2fdd0093f5ffcb1d98ba11422
+SHA1 (patch-src_rpc_command__scheduler.cc) = 01be783401c822fb59201215b5596eecfce3cc3c
+SHA1 (patch-src_rpc_command__scheduler__item.h) = 727443c2601cbaf2037a933ea6dbfb1b0ff83c77
+SHA1 (patch-src_rpc_exec__file.cc) = 22bbbfabf60761196258ddefec90f9f53d9738e8
+SHA1 (patch-src_rpc_exec__file.h) = 39dd7648d2192bb228f641abfeb2b67fd0a6bf91
+SHA1 (patch-src_rpc_object__storage.cc) = da39a3ee5e6b4b0d3255bfef95601890afd80709
+SHA1 (patch-src_rpc_object__storage.h) = e338ddc4c918aac11ee0367b951e6946e6157430
+SHA1 (patch-src_rpc_xmlrpc.h) = d50426a6b1337005084b9b1fcb5eb52ae2c407d8
+SHA1 (patch-src_signal__handler.cc) = 9d83800266a8d11d6fb605b45dc431ee3adda7b2
+SHA1 (patch-src_thread__base.cc) = cf685d201d57ffe368fcdd348ae6bcb8655ccfb7
+SHA1 (patch-src_ui_element__log__complete.cc) = a8f72b8d16259224163bdcd51ce506c67c141272
+SHA1 (patch-src_ui_element__peer__list.cc) = 3e32fb4139062274252e799b8c5f4110075923d9
diff --git a/net/rtorrent/patches/patch-ag b/net/rtorrent/patches/patch-ag
index d7403833844..bf315b4c07c 100644
--- a/net/rtorrent/patches/patch-ag
+++ b/net/rtorrent/patches/patch-ag
@@ -1,12 +1,42 @@
-$NetBSD: patch-ag,v 1.2 2012/05/16 17:42:37 tron Exp $
+$NetBSD: patch-ag,v 1.3 2013/05/09 14:28:25 joerg Exp $
Fix handling of command line options. Please look here for details:
http://libtorrent.rakshasa.no/ticket/2657
--- src/main.cc.orig 2012-03-20 15:09:58.000000000 +0000
-+++ src/main.cc 2012-05-14 23:44:41.000000000 +0100
-@@ -843,14 +843,14 @@
++++ src/main.cc
+@@ -79,6 +79,14 @@
+
+ #include "thread_worker.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#endif
++
+ void handle_sigbus(int signum, siginfo_t* sa, void* ptr);
+ void do_panic(int signum);
+ void print_help();
+@@ -208,11 +216,11 @@ main(int argc, char** argv) {
+ torrent::log_add_group_output(torrent::LOG_NOTICE, "important");
+ torrent::log_add_group_output(torrent::LOG_INFO, "complete");
+
+- torrent::Poll::slot_create_poll() = std::tr1::bind(&core::create_poll);
++ torrent::Poll::slot_create_poll() = std::bind(&core::create_poll);
+
+ torrent::initialize();
+- torrent::main_thread()->slot_do_work() = tr1::bind(&client_perform);
+- torrent::main_thread()->slot_next_timeout() = tr1::bind(&client_next_timeout, control);
++ torrent::main_thread()->slot_do_work() = bind(&client_perform);
++ torrent::main_thread()->slot_next_timeout() = bind(&client_next_timeout, control);
+
+ worker_thread = new ThreadWorker();
+ worker_thread->init_thread();
+@@ -843,14 +851,14 @@ main(int argc, char** argv) {
}
#endif
diff --git a/net/rtorrent/patches/patch-rak_functional__fun.h b/net/rtorrent/patches/patch-rak_functional__fun.h
new file mode 100644
index 00000000000..50a186a0fad
--- /dev/null
+++ b/net/rtorrent/patches/patch-rak_functional__fun.h
@@ -0,0 +1,102 @@
+$NetBSD: patch-rak_functional__fun.h,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- rak/functional_fun.h.orig 2013-05-03 22:36:30.000000000 +0000
++++ rak/functional_fun.h
+@@ -53,8 +53,13 @@
+
+ #include <memory>
+ #include <functional>
+-#include <tr1/functional>
+-#include <tr1/memory>
++#if __cplusplus >= 201103L
++#include <memory>
++using std::shared_ptr;
++#else
++#include <memory>
++using std::tr1::shared_ptr;
++#endif
+
+ namespace rak {
+
+@@ -98,13 +103,13 @@ public:
+
+ bool is_valid() const { return m_base.get() != NULL; }
+
+- void set(base_type* base) { m_base = std::tr1::shared_ptr<base_type>(base); }
++ void set(base_type* base) { m_base = shared_ptr<base_type>(base); }
+ base_type* release() { return m_base.release(); }
+
+ Result operator () () { return (*m_base)(); }
+
+ private:
+- std::tr1::shared_ptr<base_type> m_base;
++ shared_ptr<base_type> m_base;
+ };
+
+ template <typename Result, typename Arg1>
+@@ -115,13 +120,13 @@ public:
+
+ bool is_valid() const { return m_base.get() != NULL; }
+
+- void set(base_type* base) { m_base = std::tr1::shared_ptr<base_type>(base); }
++ void set(base_type* base) { m_base = shared_ptr<base_type>(base); }
+ base_type* release() { return m_base.release(); }
+
+ Result operator () (Arg1 arg1) { return (*m_base)(arg1); }
+
+ private:
+- std::tr1::shared_ptr<base_type> m_base;
++ shared_ptr<base_type> m_base;
+ };
+
+ template <typename Result, typename Arg1, typename Arg2>
+@@ -132,13 +137,13 @@ public:
+
+ bool is_valid() const { return m_base.get() != NULL; }
+
+- void set(base_type* base) { m_base = std::tr1::shared_ptr<base_type>(base); }
++ void set(base_type* base) { m_base = shared_ptr<base_type>(base); }
+ base_type* release() { return m_base.release(); }
+
+ Result operator () (Arg1 arg1, Arg2 arg2) { return (*m_base)(arg1, arg2); }
+
+ private:
+- std::tr1::shared_ptr<base_type> m_base;
++ shared_ptr<base_type> m_base;
+ };
+
+ template <typename Result, typename Arg2>
+@@ -149,7 +154,7 @@ public:
+
+ bool is_valid() const { return m_base.get() != NULL; }
+
+- void set(base_type* base) { m_base = std::tr1::shared_ptr<base_type>(base); }
++ void set(base_type* base) { m_base = shared_ptr<base_type>(base); }
+ base_type* release() { return m_base.release(); }
+
+ Result operator () (Arg2 arg2) { return (*m_base)(arg2); }
+@@ -158,7 +163,7 @@ public:
+ Result operator () (Discard discard, Arg2 arg2) { return (*m_base)(arg2); }
+
+ private:
+- std::tr1::shared_ptr<base_type> m_base;
++ shared_ptr<base_type> m_base;
+ };
+
+ template <typename Result, typename Arg1, typename Arg2, typename Arg3>
+@@ -169,13 +174,13 @@ public:
+
+ bool is_valid() const { return m_base.get() != NULL; }
+
+- void set(base_type* base) { m_base = std::tr1::shared_ptr<base_type>(base); }
++ void set(base_type* base) { m_base = shared_ptr<base_type>(base); }
+ base_type* release() { return m_base.release(); }
+
+ Result operator () (Arg1 arg1, Arg2 arg2, Arg3 arg3) { return (*m_base)(arg1, arg2, arg3); }
+
+ private:
+- std::tr1::shared_ptr<base_type> m_base;
++ shared_ptr<base_type> m_base;
+ };
+
+ template <typename Result>
diff --git a/net/rtorrent/patches/patch-rak_priority__queue__default.h b/net/rtorrent/patches/patch-rak_priority__queue__default.h
new file mode 100644
index 00000000000..239cca4bc67
--- /dev/null
+++ b/net/rtorrent/patches/patch-rak_priority__queue__default.h
@@ -0,0 +1,27 @@
+$NetBSD: patch-rak_priority__queue__default.h,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- rak/priority_queue_default.h.orig 2012-02-14 03:32:01.000000000 +0000
++++ rak/priority_queue_default.h
+@@ -38,7 +38,13 @@
+ #define RAK_PRIORITY_QUEUE_DEFAULT_H
+
+ #include <stdexcept>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+ #include <rak/allocators.h>
+ #include <rak/priority_queue.h>
+ #include <rak/timer.h>
+@@ -47,7 +53,7 @@ namespace rak {
+
+ class priority_item {
+ public:
+- typedef std::tr1::function<void (void)> slot_void;
++ typedef function<void (void)> slot_void;
+
+ priority_item() {}
+ ~priority_item() {
diff --git a/net/rtorrent/patches/patch-src_command__download.cc b/net/rtorrent/patches/patch-src_command__download.cc
new file mode 100644
index 00000000000..be4260b5aef
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__download.cc
@@ -0,0 +1,420 @@
+$NetBSD: patch-src_command__download.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_download.cc.orig 2013-05-03 22:57:06.000000000 +0000
++++ src/command_download.cc
+@@ -69,6 +69,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ std::string
+ retrieve_d_base_path(core::Download* download) {
+ if (download->file_list()->is_multi_file())
+@@ -285,8 +295,8 @@ retrieve_d_bitfield(core::Download* down
+ // Just a helper function atm.
+ torrent::Object
+ cmd_d_initialize_logs(core::Download* download) {
+- download->info()->signal_network_log().push_back(tr1::bind(&core::Manager::push_log_complete, control->core(), tr1::placeholders::_1));
+- download->info()->signal_storage_error().push_back(tr1::bind(&core::Manager::push_log_complete, control->core(), tr1::placeholders::_1));
++ download->info()->signal_network_log().push_back(bind(&core::Manager::push_log_complete, control->core(), STD_PLACEHOLDERS::_1));
++ download->info()->signal_storage_error().push_back(bind(&core::Manager::push_log_complete, control->core(), STD_PLACEHOLDERS::_1));
+
+ return torrent::Object();
+ }
+@@ -363,7 +373,7 @@ f_multicall(core::Download* download, co
+ if (args.front().is_list())
+ std::transform(args.front().as_list().begin(), args.front().as_list().end(),
+ std::back_inserter(regex_list),
+- tr1::bind(&torrent::Object::as_string_c, tr1::placeholders::_1));
++ bind(&torrent::Object::as_string_c, STD_PLACEHOLDERS::_1));
+ else if (args.front().is_string() && !args.front().as_string().empty())
+ regex_list.push_back(args.front().as_string());
+ else
+@@ -372,7 +382,7 @@ f_multicall(core::Download* download, co
+ for (torrent::FileList::const_iterator itr = download->file_list()->begin(), last = download->file_list()->end(); itr != last; itr++) {
+ if (use_regex &&
+ std::find_if(regex_list.begin(), regex_list.end(),
+- tr1::bind(&rak::regex::operator(), tr1::placeholders::_1, (*itr)->path()->as_string())) == regex_list.end())
++ bind(&rak::regex::operator(), STD_PLACEHOLDERS::_1, (*itr)->path()->as_string())) == regex_list.end())
+ continue;
+
+ torrent::Object::list_type& row = result.insert(result.end(), torrent::Object::create_list())->as_list();
+@@ -588,52 +598,52 @@ d_list_remove(core::Download* download,
+ return torrent::Object();
+ }
+
+-#define CMD2_ON_INFO(func) tr1::bind(&torrent::DownloadInfo::func, tr1::bind(&core::Download::info, tr1::placeholders::_1))
+-#define CMD2_ON_DATA(func) tr1::bind(&torrent::download_data::func, tr1::bind(&core::Download::data, tr1::placeholders::_1))
+-#define CMD2_ON_DL(func) tr1::bind(&torrent::Download::func, tr1::bind(&core::Download::download, tr1::placeholders::_1))
+-#define CMD2_ON_FL(func) tr1::bind(&torrent::FileList::func, tr1::bind(&core::Download::file_list, tr1::placeholders::_1))
+-
+-#define CMD2_BIND_DL tr1::bind(&core::Download::download, tr1::placeholders::_1)
+-#define CMD2_BIND_CL tr1::bind(&core::Download::connection_list, tr1::placeholders::_1)
+-#define CMD2_BIND_FL tr1::bind(&core::Download::file_list, tr1::placeholders::_1)
+-#define CMD2_BIND_PL tr1::bind(&core::Download::c_peer_list, tr1::placeholders::_1)
+-#define CMD2_BIND_TL tr1::bind(&core::Download::tracker_list, tr1::placeholders::_1)
+-#define CMD2_BIND_TC tr1::bind(&core::Download::tracker_controller, tr1::placeholders::_1)
++#define CMD2_ON_INFO(func) bind(&torrent::DownloadInfo::func, bind(&core::Download::info, STD_PLACEHOLDERS::_1))
++#define CMD2_ON_DATA(func) bind(&torrent::download_data::func, bind(&core::Download::data, STD_PLACEHOLDERS::_1))
++#define CMD2_ON_DL(func) bind(&torrent::Download::func, bind(&core::Download::download, STD_PLACEHOLDERS::_1))
++#define CMD2_ON_FL(func) bind(&torrent::FileList::func, bind(&core::Download::file_list, STD_PLACEHOLDERS::_1))
++
++#define CMD2_BIND_DL bind(&core::Download::download, STD_PLACEHOLDERS::_1)
++#define CMD2_BIND_CL bind(&core::Download::connection_list, STD_PLACEHOLDERS::_1)
++#define CMD2_BIND_FL bind(&core::Download::file_list, STD_PLACEHOLDERS::_1)
++#define CMD2_BIND_PL bind(&core::Download::c_peer_list, STD_PLACEHOLDERS::_1)
++#define CMD2_BIND_TL bind(&core::Download::tracker_list, STD_PLACEHOLDERS::_1)
++#define CMD2_BIND_TC bind(&core::Download::tracker_controller, STD_PLACEHOLDERS::_1)
+
+-#define CMD2_BIND_INFO tr1::bind(&core::Download::info, tr1::placeholders::_1)
+-#define CMD2_BIND_DATA tr1::bind(&core::Download::data, tr1::placeholders::_1)
++#define CMD2_BIND_INFO bind(&core::Download::info, STD_PLACEHOLDERS::_1)
++#define CMD2_BIND_DATA bind(&core::Download::data, STD_PLACEHOLDERS::_1)
+
+ #define CMD2_DL_VAR_VALUE(key, first_key, second_key) \
+- CMD2_DL(key, tr1::bind(&download_get_variable, tr1::placeholders::_1, first_key, second_key)); \
+- CMD2_DL_VALUE_P(key ".set", tr1::bind(&download_set_variable_value, \
+- tr1::placeholders::_1, tr1::placeholders::_2, \
++ CMD2_DL(key, bind(&download_get_variable, STD_PLACEHOLDERS::_1, first_key, second_key)); \
++ CMD2_DL_VALUE_P(key ".set", bind(&download_set_variable_value, \
++ STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, \
+ first_key, second_key));
+
+ #define CMD2_DL_VAR_VALUE_PUBLIC(key, first_key, second_key) \
+- CMD2_DL(key, tr1::bind(&download_get_variable, tr1::placeholders::_1, first_key, second_key)); \
+- CMD2_DL_VALUE(key ".set", tr1::bind(&download_set_variable_value, \
+- tr1::placeholders::_1, tr1::placeholders::_2, \
++ CMD2_DL(key, bind(&download_get_variable, STD_PLACEHOLDERS::_1, first_key, second_key)); \
++ CMD2_DL_VALUE(key ".set", bind(&download_set_variable_value, \
++ STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, \
+ first_key, second_key));
+
+ #define CMD2_DL_TIMESTAMP(key, first_key, second_key) \
+- CMD2_DL(key, tr1::bind(&download_get_variable, tr1::placeholders::_1, first_key, second_key)); \
+- CMD2_DL_VALUE_P(key ".set", tr1::bind(&download_set_variable_value, \
+- tr1::placeholders::_1, tr1::placeholders::_2, \
++ CMD2_DL(key, bind(&download_get_variable, STD_PLACEHOLDERS::_1, first_key, second_key)); \
++ CMD2_DL_VALUE_P(key ".set", bind(&download_set_variable_value, \
++ STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, \
+ first_key, second_key)); \
+- CMD2_DL_VALUE_P(key ".set_if_z", tr1::bind(&download_set_variable_value_ifz, \
+- tr1::placeholders::_1, tr1::placeholders::_2, \
++ CMD2_DL_VALUE_P(key ".set_if_z", bind(&download_set_variable_value_ifz, \
++ STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, \
+ first_key, second_key)); \
+
+ #define CMD2_DL_VAR_STRING(key, first_key, second_key) \
+- CMD2_DL(key, tr1::bind(&download_get_variable, tr1::placeholders::_1, first_key, second_key)); \
+- CMD2_DL_STRING_P(key ".set", tr1::bind(&download_set_variable_string, \
+- tr1::placeholders::_1, tr1::placeholders::_2, \
++ CMD2_DL(key, bind(&download_get_variable, STD_PLACEHOLDERS::_1, first_key, second_key)); \
++ CMD2_DL_STRING_P(key ".set", bind(&download_set_variable_string, \
++ STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, \
+ first_key, second_key));
+
+ #define CMD2_DL_VAR_STRING_PUBLIC(key, first_key, second_key) \
+- CMD2_DL(key, tr1::bind(&download_get_variable, tr1::placeholders::_1, first_key, second_key)); \
+- CMD2_DL_STRING(key ".set", tr1::bind(&download_set_variable_string, \
+- tr1::placeholders::_1, tr1::placeholders::_2, \
++ CMD2_DL(key, bind(&download_get_variable, STD_PLACEHOLDERS::_1, first_key, second_key)); \
++ CMD2_DL_STRING(key ".set", bind(&download_set_variable_string, \
++ STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, \
+ first_key, second_key));
+
+ int64_t cg_d_group(core::Download* download);
+@@ -642,12 +652,12 @@ void cg_d_group_set(core::
+
+ void
+ initialize_command_download() {
+- CMD2_DL("d.hash", tr1::bind(&rak::transform_hex_str<torrent::HashString>, CMD2_ON_INFO(hash)));
+- CMD2_DL("d.local_id", tr1::bind(&rak::transform_hex_str<torrent::HashString>, CMD2_ON_INFO(local_id)));
+- CMD2_DL("d.local_id_html", tr1::bind(&rak::copy_escape_html_str<torrent::HashString>, CMD2_ON_INFO(local_id)));
+- CMD2_DL("d.bitfield", tr1::bind(&retrieve_d_bitfield, tr1::placeholders::_1));
+- CMD2_DL("d.base_path", tr1::bind(&retrieve_d_base_path, tr1::placeholders::_1));
+- CMD2_DL("d.base_filename", tr1::bind(&retrieve_d_base_filename, tr1::placeholders::_1));
++ CMD2_DL("d.hash", bind(&rak::transform_hex_str<torrent::HashString>, CMD2_ON_INFO(hash)));
++ CMD2_DL("d.local_id", bind(&rak::transform_hex_str<torrent::HashString>, CMD2_ON_INFO(local_id)));
++ CMD2_DL("d.local_id_html", bind(&rak::copy_escape_html_str<torrent::HashString>, CMD2_ON_INFO(local_id)));
++ CMD2_DL("d.bitfield", bind(&retrieve_d_bitfield, STD_PLACEHOLDERS::_1));
++ CMD2_DL("d.base_path", bind(&retrieve_d_base_path, STD_PLACEHOLDERS::_1));
++ CMD2_DL("d.base_filename", bind(&retrieve_d_base_filename, STD_PLACEHOLDERS::_1));
+
+ CMD2_DL("d.name", CMD2_ON_INFO(name));
+ CMD2_DL("d.creation_date", CMD2_ON_INFO(creation_date));
+@@ -657,19 +667,19 @@ initialize_command_download() {
+ // Network related:
+ //
+
+- CMD2_DL ("d.up.rate", tr1::bind(&torrent::Rate::rate, CMD2_ON_INFO(up_rate)));
+- CMD2_DL ("d.up.total", tr1::bind(&torrent::Rate::total, CMD2_ON_INFO(up_rate)));
+- CMD2_DL ("d.down.rate", tr1::bind(&torrent::Rate::rate, CMD2_ON_INFO(down_rate)));
+- CMD2_DL ("d.down.total", tr1::bind(&torrent::Rate::total, CMD2_ON_INFO(down_rate)));
+- CMD2_DL ("d.skip.rate", tr1::bind(&torrent::Rate::rate, CMD2_ON_INFO(skip_rate)));
+- CMD2_DL ("d.skip.total", tr1::bind(&torrent::Rate::total, CMD2_ON_INFO(skip_rate)));
++ CMD2_DL ("d.up.rate", bind(&torrent::Rate::rate, CMD2_ON_INFO(up_rate)));
++ CMD2_DL ("d.up.total", bind(&torrent::Rate::total, CMD2_ON_INFO(up_rate)));
++ CMD2_DL ("d.down.rate", bind(&torrent::Rate::rate, CMD2_ON_INFO(down_rate)));
++ CMD2_DL ("d.down.total", bind(&torrent::Rate::total, CMD2_ON_INFO(down_rate)));
++ CMD2_DL ("d.skip.rate", bind(&torrent::Rate::rate, CMD2_ON_INFO(skip_rate)));
++ CMD2_DL ("d.skip.total", bind(&torrent::Rate::total, CMD2_ON_INFO(skip_rate)));
+
+ CMD2_DL ("d.peer_exchange", CMD2_ON_INFO(is_pex_enabled));
+- CMD2_DL_VALUE_V ("d.peer_exchange.set", tr1::bind(&torrent::Download::set_pex_enabled, CMD2_BIND_DL, tr1::placeholders::_2));
++ CMD2_DL_VALUE_V ("d.peer_exchange.set", bind(&torrent::Download::set_pex_enabled, CMD2_BIND_DL, STD_PLACEHOLDERS::_2));
+
+- CMD2_DL_LIST ("d.create_link", tr1::bind(&apply_d_change_link, tr1::placeholders::_1, tr1::placeholders::_2, 0));
+- CMD2_DL_LIST ("d.delete_link", tr1::bind(&apply_d_change_link, tr1::placeholders::_1, tr1::placeholders::_2, 1));
+- CMD2_DL ("d.delete_tied", tr1::bind(&apply_d_delete_tied, tr1::placeholders::_1));
++ CMD2_DL_LIST ("d.create_link", bind(&apply_d_change_link, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, 0));
++ CMD2_DL_LIST ("d.delete_link", bind(&apply_d_change_link, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, 1));
++ CMD2_DL ("d.delete_tied", bind(&apply_d_delete_tied, STD_PLACEHOLDERS::_1));
+
+ CMD2_FUNC_SINGLE("d.start", "d.hashing_failed.set=0 ;view.set_visible=started");
+ CMD2_FUNC_SINGLE("d.stop", "view.set_visible=stopped");
+@@ -683,36 +693,36 @@ initialize_command_download() {
+
+ CMD2_DL ("d.is_open", CMD2_ON_INFO(is_open));
+ CMD2_DL ("d.is_active", CMD2_ON_INFO(is_active));
+- CMD2_DL ("d.is_hash_checked", tr1::bind(&torrent::Download::is_hash_checked, CMD2_BIND_DL));
+- CMD2_DL ("d.is_hash_checking", tr1::bind(&torrent::Download::is_hash_checking, CMD2_BIND_DL));
+- CMD2_DL ("d.is_multi_file", tr1::bind(&torrent::FileList::is_multi_file, CMD2_BIND_FL));
++ CMD2_DL ("d.is_hash_checked", bind(&torrent::Download::is_hash_checked, CMD2_BIND_DL));
++ CMD2_DL ("d.is_hash_checking", bind(&torrent::Download::is_hash_checking, CMD2_BIND_DL));
++ CMD2_DL ("d.is_multi_file", bind(&torrent::FileList::is_multi_file, CMD2_BIND_FL));
+ CMD2_DL ("d.is_private", CMD2_ON_INFO(is_private));
+ CMD2_DL ("d.is_pex_active", CMD2_ON_INFO(is_pex_active));
+ CMD2_DL ("d.is_partially_done", CMD2_ON_DATA(is_partially_done));
+ CMD2_DL ("d.is_not_partially_done", CMD2_ON_DATA(is_not_partially_done));
+
+- CMD2_DL_V ("d.resume", tr1::bind(&core::DownloadList::resume_default, control->core()->download_list(), tr1::placeholders::_1));
+- CMD2_DL_V ("d.pause", tr1::bind(&core::DownloadList::pause_default, control->core()->download_list(), tr1::placeholders::_1));
+- CMD2_DL_V ("d.open", tr1::bind(&core::DownloadList::open_throw, control->core()->download_list(), tr1::placeholders::_1));
+- CMD2_DL_V ("d.close", tr1::bind(&core::DownloadList::close_throw, control->core()->download_list(), tr1::placeholders::_1));
+- CMD2_DL_V ("d.close.directly", tr1::bind(&core::DownloadList::close_directly, control->core()->download_list(), tr1::placeholders::_1));
+- CMD2_DL_V ("d.erase", tr1::bind(&core::DownloadList::erase_ptr, control->core()->download_list(), tr1::placeholders::_1));
+- CMD2_DL_V ("d.check_hash", tr1::bind(&core::DownloadList::check_hash, control->core()->download_list(), tr1::placeholders::_1));
++ CMD2_DL_V ("d.resume", bind(&core::DownloadList::resume_default, control->core()->download_list(), STD_PLACEHOLDERS::_1));
++ CMD2_DL_V ("d.pause", bind(&core::DownloadList::pause_default, control->core()->download_list(), STD_PLACEHOLDERS::_1));
++ CMD2_DL_V ("d.open", bind(&core::DownloadList::open_throw, control->core()->download_list(), STD_PLACEHOLDERS::_1));
++ CMD2_DL_V ("d.close", bind(&core::DownloadList::close_throw, control->core()->download_list(), STD_PLACEHOLDERS::_1));
++ CMD2_DL_V ("d.close.directly", bind(&core::DownloadList::close_directly, control->core()->download_list(), STD_PLACEHOLDERS::_1));
++ CMD2_DL_V ("d.erase", bind(&core::DownloadList::erase_ptr, control->core()->download_list(), STD_PLACEHOLDERS::_1));
++ CMD2_DL_V ("d.check_hash", bind(&core::DownloadList::check_hash, control->core()->download_list(), STD_PLACEHOLDERS::_1));
+
+- CMD2_DL ("d.save_resume", tr1::bind(&core::DownloadStore::save_resume, control->core()->download_store(), tr1::placeholders::_1));
+- CMD2_DL ("d.save_full_session", tr1::bind(&core::DownloadStore::save_full, control->core()->download_store(), tr1::placeholders::_1));
++ CMD2_DL ("d.save_resume", bind(&core::DownloadStore::save_resume, control->core()->download_store(), STD_PLACEHOLDERS::_1));
++ CMD2_DL ("d.save_full_session", bind(&core::DownloadStore::save_full, control->core()->download_store(), STD_PLACEHOLDERS::_1));
+
+ CMD2_DL_V ("d.update_priorities", CMD2_ON_DL(update_priorities));
+
+- CMD2_DL_STRING_V("add_peer", tr1::bind(&apply_d_add_peer, tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_DL_STRING_V("add_peer", bind(&apply_d_add_peer, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+
+ //
+ // Custom settings:
+ //
+
+- CMD2_DL_STRING("d.custom", tr1::bind(&retrieve_d_custom, tr1::placeholders::_1, tr1::placeholders::_2));
+- CMD2_DL_STRING("d.custom_throw", tr1::bind(&retrieve_d_custom_throw, tr1::placeholders::_1, tr1::placeholders::_2));
+- CMD2_DL_LIST ("d.custom.set", tr1::bind(&apply_d_custom, tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_DL_STRING("d.custom", bind(&retrieve_d_custom, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
++ CMD2_DL_STRING("d.custom_throw", bind(&retrieve_d_custom_throw, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
++ CMD2_DL_LIST ("d.custom.set", bind(&apply_d_custom, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+
+ CMD2_DL_VAR_STRING_PUBLIC("d.custom1", "rtorrent", "custom1");
+ CMD2_DL_VAR_STRING_PUBLIC("d.custom2", "rtorrent", "custom2");
+@@ -757,68 +767,68 @@ initialize_command_download() {
+ CMD2_DL_TIMESTAMP("d.timestamp.started", "rtorrent", "timestamp.started");
+ CMD2_DL_TIMESTAMP("d.timestamp.finished", "rtorrent", "timestamp.finished");
+
+- CMD2_DL ("d.connection_current", tr1::bind(&torrent::option_as_string, torrent::OPTION_CONNECTION_TYPE, CMD2_ON_DL(connection_type)));
+- CMD2_DL_STRING("d.connection_current.set", tr1::bind(&apply_d_connection_type, tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_DL ("d.connection_current", bind(&torrent::option_as_string, torrent::OPTION_CONNECTION_TYPE, CMD2_ON_DL(connection_type)));
++ CMD2_DL_STRING("d.connection_current.set", bind(&apply_d_connection_type, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+
+ CMD2_DL_VAR_STRING("d.connection_leech", "rtorrent", "connection_leech");
+ CMD2_DL_VAR_STRING("d.connection_seed", "rtorrent", "connection_seed");
+
+- CMD2_DL ("d.up.choke_heuristics", tr1::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, CMD2_ON_DL(upload_choke_heuristic)));
+- CMD2_DL_STRING("d.up.choke_heuristics.set", tr1::bind(&apply_d_choke_heuristics, tr1::placeholders::_1, tr1::placeholders::_2, false));
+- CMD2_DL ("d.down.choke_heuristics", tr1::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, CMD2_ON_DL(download_choke_heuristic)));
+- CMD2_DL_STRING("d.down.choke_heuristics.set", tr1::bind(&apply_d_choke_heuristics, tr1::placeholders::_1, tr1::placeholders::_2, true));
++ CMD2_DL ("d.up.choke_heuristics", bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, CMD2_ON_DL(upload_choke_heuristic)));
++ CMD2_DL_STRING("d.up.choke_heuristics.set", bind(&apply_d_choke_heuristics, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, false));
++ CMD2_DL ("d.down.choke_heuristics", bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, CMD2_ON_DL(download_choke_heuristic)));
++ CMD2_DL_STRING("d.down.choke_heuristics.set", bind(&apply_d_choke_heuristics, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, true));
+
+ CMD2_DL_VAR_STRING("d.up.choke_heuristics.leech", "rtorrent", "choke_heuristics.up.leech");
+ CMD2_DL_VAR_STRING("d.up.choke_heuristics.seed", "rtorrent", "choke_heuristics.up.seed");
+ CMD2_DL_VAR_STRING("d.down.choke_heuristics.leech", "rtorrent", "choke_heuristics.down.leech");
+ CMD2_DL_VAR_STRING("d.down.choke_heuristics.seed", "rtorrent", "choke_heuristics.down.seed");
+
+- CMD2_DL ("d.hashing_failed", tr1::bind(&core::Download::is_hash_failed, tr1::placeholders::_1));
+- CMD2_DL_VALUE_V ("d.hashing_failed.set", tr1::bind(&core::Download::set_hash_failed, tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_DL ("d.hashing_failed", bind(&core::Download::is_hash_failed, STD_PLACEHOLDERS::_1));
++ CMD2_DL_VALUE_V ("d.hashing_failed.set", bind(&core::Download::set_hash_failed, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+
+- CMD2_DL ("d.views", tr1::bind(&download_get_variable, tr1::placeholders::_1, "rtorrent", "views"));
+- CMD2_DL ("d.views.has", tr1::bind(&d_list_has, tr1::placeholders::_1, tr1::placeholders::_2, "rtorrent", "views"));
+- CMD2_DL ("d.views.remove", tr1::bind(&d_list_remove, tr1::placeholders::_1, tr1::placeholders::_2, "rtorrent", "views"));
+- CMD2_DL ("d.views.push_back", tr1::bind(&d_list_push_back, tr1::placeholders::_1, tr1::placeholders::_2, "rtorrent", "views"));
+- CMD2_DL ("d.views.push_back_unique", tr1::bind(&d_list_push_back_unique, tr1::placeholders::_1, tr1::placeholders::_2, "rtorrent", "views"));
++ CMD2_DL ("d.views", bind(&download_get_variable, STD_PLACEHOLDERS::_1, "rtorrent", "views"));
++ CMD2_DL ("d.views.has", bind(&d_list_has, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, "rtorrent", "views"));
++ CMD2_DL ("d.views.remove", bind(&d_list_remove, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, "rtorrent", "views"));
++ CMD2_DL ("d.views.push_back", bind(&d_list_push_back, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, "rtorrent", "views"));
++ CMD2_DL ("d.views.push_back_unique", bind(&d_list_push_back_unique, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, "rtorrent", "views"));
+
+ // This command really needs to be improved, so we have proper
+ // logging support.
+- CMD2_DL ("d.message", tr1::bind(&core::Download::message, tr1::placeholders::_1));
+- CMD2_DL_STRING_V("d.message.set", tr1::bind(&core::Download::set_message, tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_DL ("d.message", bind(&core::Download::message, STD_PLACEHOLDERS::_1));
++ CMD2_DL_STRING_V("d.message.set", bind(&core::Download::set_message, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+
+ CMD2_DL ("d.max_file_size", CMD2_ON_FL(max_file_size));
+- CMD2_DL_VALUE_V ("d.max_file_size.set", tr1::bind(&torrent::FileList::set_max_file_size, CMD2_BIND_FL, tr1::placeholders::_2));
++ CMD2_DL_VALUE_V ("d.max_file_size.set", bind(&torrent::FileList::set_max_file_size, CMD2_BIND_FL, STD_PLACEHOLDERS::_2));
+
+- CMD2_DL ("d.peers_min", tr1::bind(&torrent::ConnectionList::min_size, CMD2_BIND_CL));
+- CMD2_DL_VALUE_V ("d.peers_min.set", tr1::bind(&torrent::ConnectionList::set_min_size, CMD2_BIND_CL, tr1::placeholders::_2));
+- CMD2_DL ("d.peers_max", tr1::bind(&torrent::ConnectionList::max_size, CMD2_BIND_CL));
+- CMD2_DL_VALUE_V ("d.peers_max.set", tr1::bind(&torrent::ConnectionList::set_max_size, CMD2_BIND_CL, tr1::placeholders::_2));
+- CMD2_DL ("d.uploads_max", tr1::bind(&torrent::Download::uploads_max, CMD2_BIND_DL));
+- CMD2_DL_VALUE_V ("d.uploads_max.set", tr1::bind(&torrent::Download::set_uploads_max, CMD2_BIND_DL, tr1::placeholders::_2));
+- CMD2_DL ("d.uploads_min", tr1::bind(&torrent::Download::uploads_min, CMD2_BIND_DL));
+- CMD2_DL_VALUE_V ("d.uploads_min.set", tr1::bind(&torrent::Download::set_uploads_min, CMD2_BIND_DL, tr1::placeholders::_2));
+- CMD2_DL ("d.downloads_max", tr1::bind(&torrent::Download::downloads_max, CMD2_BIND_DL));
+- CMD2_DL_VALUE_V ("d.downloads_max.set", tr1::bind(&torrent::Download::set_downloads_max, CMD2_BIND_DL, tr1::placeholders::_2));
+- CMD2_DL ("d.downloads_min", tr1::bind(&torrent::Download::downloads_min, CMD2_BIND_DL));
+- CMD2_DL_VALUE_V ("d.downloads_min.set", tr1::bind(&torrent::Download::set_downloads_min, CMD2_BIND_DL, tr1::placeholders::_2));
+- CMD2_DL ("d.peers_connected", tr1::bind(&torrent::ConnectionList::size, CMD2_BIND_CL));
+- CMD2_DL ("d.peers_not_connected", tr1::bind(&torrent::PeerList::available_list_size, CMD2_BIND_PL));
++ CMD2_DL ("d.peers_min", bind(&torrent::ConnectionList::min_size, CMD2_BIND_CL));
++ CMD2_DL_VALUE_V ("d.peers_min.set", bind(&torrent::ConnectionList::set_min_size, CMD2_BIND_CL, STD_PLACEHOLDERS::_2));
++ CMD2_DL ("d.peers_max", bind(&torrent::ConnectionList::max_size, CMD2_BIND_CL));
++ CMD2_DL_VALUE_V ("d.peers_max.set", bind(&torrent::ConnectionList::set_max_size, CMD2_BIND_CL, STD_PLACEHOLDERS::_2));
++ CMD2_DL ("d.uploads_max", bind(&torrent::Download::uploads_max, CMD2_BIND_DL));
++ CMD2_DL_VALUE_V ("d.uploads_max.set", bind(&torrent::Download::set_uploads_max, CMD2_BIND_DL, STD_PLACEHOLDERS::_2));
++ CMD2_DL ("d.uploads_min", bind(&torrent::Download::uploads_min, CMD2_BIND_DL));
++ CMD2_DL_VALUE_V ("d.uploads_min.set", bind(&torrent::Download::set_uploads_min, CMD2_BIND_DL, STD_PLACEHOLDERS::_2));
++ CMD2_DL ("d.downloads_max", bind(&torrent::Download::downloads_max, CMD2_BIND_DL));
++ CMD2_DL_VALUE_V ("d.downloads_max.set", bind(&torrent::Download::set_downloads_max, CMD2_BIND_DL, STD_PLACEHOLDERS::_2));
++ CMD2_DL ("d.downloads_min", bind(&torrent::Download::downloads_min, CMD2_BIND_DL));
++ CMD2_DL_VALUE_V ("d.downloads_min.set", bind(&torrent::Download::set_downloads_min, CMD2_BIND_DL, STD_PLACEHOLDERS::_2));
++ CMD2_DL ("d.peers_connected", bind(&torrent::ConnectionList::size, CMD2_BIND_CL));
++ CMD2_DL ("d.peers_not_connected", bind(&torrent::PeerList::available_list_size, CMD2_BIND_PL));
+
+ CMD2_DL ("d.peers_complete", CMD2_ON_DL(peers_complete));
+ CMD2_DL ("d.peers_accounted", CMD2_ON_DL(peers_accounted));
+
+- CMD2_DL_V ("d.disconnect.seeders", tr1::bind(&torrent::ConnectionList::erase_seeders, CMD2_BIND_CL));
++ CMD2_DL_V ("d.disconnect.seeders", bind(&torrent::ConnectionList::erase_seeders, CMD2_BIND_CL));
+
+ CMD2_DL ("d.accepting_seeders", CMD2_ON_INFO(is_accepting_seeders));
+- CMD2_DL_V ("d.accepting_seeders.enable", tr1::bind(&torrent::DownloadInfo::public_set_flags, CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders));
+- CMD2_DL_V ("d.accepting_seeders.disable", tr1::bind(&torrent::DownloadInfo::public_unset_flags, CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders));
++ CMD2_DL_V ("d.accepting_seeders.enable", bind(&torrent::DownloadInfo::public_set_flags, CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders));
++ CMD2_DL_V ("d.accepting_seeders.disable", bind(&torrent::DownloadInfo::public_unset_flags, CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders));
+
+- CMD2_DL ("d.throttle_name", tr1::bind(&download_get_variable, tr1::placeholders::_1, "rtorrent", "throttle_name"));
+- CMD2_DL_STRING_V("d.throttle_name.set", tr1::bind(&core::Download::set_throttle_name, tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_DL ("d.throttle_name", bind(&download_get_variable, STD_PLACEHOLDERS::_1, "rtorrent", "throttle_name"));
++ CMD2_DL_STRING_V("d.throttle_name.set", bind(&core::Download::set_throttle_name, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+
+ CMD2_DL ("d.bytes_done", CMD2_ON_DL(bytes_done));
+- CMD2_DL ("d.ratio", tr1::bind(&retrieve_d_ratio, tr1::placeholders::_1));
++ CMD2_DL ("d.ratio", bind(&retrieve_d_ratio, STD_PLACEHOLDERS::_1));
+ CMD2_DL ("d.chunks_hashed", CMD2_ON_DL(chunks_hashed));
+ CMD2_DL ("d.free_diskspace", CMD2_ON_FL(free_diskspace));
+
+@@ -829,7 +839,7 @@ initialize_command_download() {
+ CMD2_DL ("d.size_pex", CMD2_ON_DL(size_pex));
+ CMD2_DL ("d.max_size_pex", CMD2_ON_DL(max_size_pex));
+
+- CMD2_DL ("d.chunks_seen", tr1::bind(&d_chunks_seen, tr1::placeholders::_1));
++ CMD2_DL ("d.chunks_seen", bind(&d_chunks_seen, STD_PLACEHOLDERS::_1));
+
+ CMD2_DL ("d.completed_bytes", CMD2_ON_FL(completed_bytes));
+ CMD2_DL ("d.completed_chunks", CMD2_ON_FL(completed_chunks));
+@@ -837,44 +847,44 @@ initialize_command_download() {
+
+ CMD2_DL ("d.wanted_chunks", CMD2_ON_DATA(wanted_chunks));
+
+- CMD2_DL_V ("d.tracker_announce", tr1::bind(&torrent::Download::manual_request, CMD2_BIND_DL, false));
+- CMD2_DL ("d.tracker_numwant", tr1::bind(&torrent::TrackerList::numwant, CMD2_BIND_TL));
+- CMD2_DL_VALUE_V ("d.tracker_numwant.set", tr1::bind(&torrent::TrackerList::set_numwant, CMD2_BIND_TL, tr1::placeholders::_2));
++ CMD2_DL_V ("d.tracker_announce", bind(&torrent::Download::manual_request, CMD2_BIND_DL, false));
++ CMD2_DL ("d.tracker_numwant", bind(&torrent::TrackerList::numwant, CMD2_BIND_TL));
++ CMD2_DL_VALUE_V ("d.tracker_numwant.set", bind(&torrent::TrackerList::set_numwant, CMD2_BIND_TL, STD_PLACEHOLDERS::_2));
+ // TODO: Deprecate 'd.tracker_focus'.
+- CMD2_DL ("d.tracker_focus", tr1::bind(&core::Download::tracker_list_size, tr1::placeholders::_1));
+- CMD2_DL ("d.tracker_size", tr1::bind(&core::Download::tracker_list_size, tr1::placeholders::_1));
++ CMD2_DL ("d.tracker_focus", bind(&core::Download::tracker_list_size, STD_PLACEHOLDERS::_1));
++ CMD2_DL ("d.tracker_size", bind(&core::Download::tracker_list_size, STD_PLACEHOLDERS::_1));
+
+- CMD2_DL_LIST ("d.tracker.insert", tr1::bind(&download_tracker_insert, tr1::placeholders::_1, tr1::placeholders::_2));
+- CMD2_DL_VALUE_V ("d.tracker.send_scrape", tr1::bind(&torrent::TrackerController::scrape_request, CMD2_BIND_TC, tr1::placeholders::_2));
++ CMD2_DL_LIST ("d.tracker.insert", bind(&download_tracker_insert, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
++ CMD2_DL_VALUE_V ("d.tracker.send_scrape", bind(&torrent::TrackerController::scrape_request, CMD2_BIND_TC, STD_PLACEHOLDERS::_2));
+
+ CMD2_DL ("d.directory", CMD2_ON_FL(root_dir));
+- CMD2_DL_STRING_V("d.directory.set", tr1::bind(&apply_d_directory, tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_DL_STRING_V("d.directory.set", bind(&apply_d_directory, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+ CMD2_DL ("d.directory_base", CMD2_ON_FL(root_dir));
+- CMD2_DL_STRING_V("d.directory_base.set", tr1::bind(&core::Download::set_root_directory, tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_DL_STRING_V("d.directory_base.set", bind(&core::Download::set_root_directory, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+
+- CMD2_DL ("d.priority", tr1::bind(&core::Download::priority, tr1::placeholders::_1));
+- CMD2_DL ("d.priority_str", tr1::bind(&retrieve_d_priority_str, tr1::placeholders::_1));
+- CMD2_DL_VALUE_V ("d.priority.set", tr1::bind(&core::Download::set_priority, tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_DL ("d.priority", bind(&core::Download::priority, STD_PLACEHOLDERS::_1));
++ CMD2_DL ("d.priority_str", bind(&retrieve_d_priority_str, STD_PLACEHOLDERS::_1));
++ CMD2_DL_VALUE_V ("d.priority.set", bind(&core::Download::set_priority, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+
+- // CMD2_DL ("d.group", tr1::bind(&torrent::resource_manager_entry::group,
+- // tr1::bind(&torrent::ResourceManager::entry_at, torrent::resource_manager(),
+- // tr1::bind(&core::Download::main, tr1::placeholders::_1))));
++ // CMD2_DL ("d.group", bind(&torrent::resource_manager_entry::group,
++ // bind(&torrent::ResourceManager::entry_at, torrent::resource_manager(),
++ // bind(&core::Download::main, STD_PLACEHOLDERS::_1))));
+
+- // CMD2_DL_V ("d.group.set", tr1::bind(&torrent::ResourceManager::set_group,
++ // CMD2_DL_V ("d.group.set", bind(&torrent::ResourceManager::set_group,
+ // torrent::resource_manager(),
+- // tr1::bind(&torrent::ResourceManager::find_throw, torrent::resource_manager(),
+- // tr1::bind(&core::Download::main, tr1::placeholders::_1)),
++ // bind(&torrent::ResourceManager::find_throw, torrent::resource_manager(),
++ // bind(&core::Download::main, STD_PLACEHOLDERS::_1)),
+ // CG_GROUP_INDEX()));
+
+- CMD2_DL ("d.group", tr1::bind(&cg_d_group, tr1::placeholders::_1));
+- CMD2_DL ("d.group.name", tr1::bind(&cg_d_group, tr1::placeholders::_1));
+- CMD2_DL_V ("d.group.set", tr1::bind(&cg_d_group_set, tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_DL ("d.group", bind(&cg_d_group, STD_PLACEHOLDERS::_1));
++ CMD2_DL ("d.group.name", bind(&cg_d_group, STD_PLACEHOLDERS::_1));
++ CMD2_DL_V ("d.group.set", bind(&cg_d_group_set, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+
+- CMD2_DL ("d.initialize_logs", tr1::bind(&cmd_d_initialize_logs, tr1::placeholders::_1));
++ CMD2_DL ("d.initialize_logs", bind(&cmd_d_initialize_logs, STD_PLACEHOLDERS::_1));
+
+- CMD2_DL_LIST ("f.multicall", tr1::bind(&f_multicall, tr1::placeholders::_1, tr1::placeholders::_2));
+- CMD2_DL_LIST ("p.multicall", tr1::bind(&p_multicall, tr1::placeholders::_1, tr1::placeholders::_2));
+- CMD2_DL_LIST ("t.multicall", tr1::bind(&t_multicall, tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_DL_LIST ("f.multicall", bind(&f_multicall, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
++ CMD2_DL_LIST ("p.multicall", bind(&p_multicall, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
++ CMD2_DL_LIST ("t.multicall", bind(&t_multicall, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+
+- CMD2_ANY_LIST ("p.call_target", tr1::bind(&p_call_target, tr1::placeholders::_2));
++ CMD2_ANY_LIST ("p.call_target", bind(&p_call_target, STD_PLACEHOLDERS::_2));
+ }
diff --git a/net/rtorrent/patches/patch-src_command__dynamic.cc b/net/rtorrent/patches/patch-src_command__dynamic.cc
new file mode 100644
index 00000000000..45bdeea5142
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__dynamic.cc
@@ -0,0 +1,130 @@
+$NetBSD: patch-src_command__dynamic.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_dynamic.cc.orig 2013-05-03 23:01:52.000000000 +0000
++++ src/command_dynamic.cc
+@@ -43,6 +43,16 @@
+ #include "command_helpers.h"
+ #include "rpc/parse.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ std::string
+ system_method_generate_command(torrent::Object::list_const_iterator first, torrent::Object::list_const_iterator last) {
+ std::string command;
+@@ -157,15 +167,15 @@ system_method_insert_object(const torren
+
+ rpc::commands.insert_slot<rpc::command_base_is_type<rpc::command_base_call<rpc::target_type> >::type>
+ (create_new_key(rawKey),
+- tr1::bind(&rpc::object_storage::call_function_str, control->object_storage(),
+- rawKey, tr1::placeholders::_1, tr1::placeholders::_2),
++ bind(&rpc::object_storage::call_function_str, control->object_storage(),
++ rawKey, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2),
+ &rpc::command_base_call<rpc::target_type>,
+ cmd_flags, NULL, NULL);
+
+ } else {
+ rpc::commands.insert_slot<rpc::command_base_is_type<rpc::command_base_call<rpc::target_type> >::type>
+ (create_new_key(rawKey),
+- tr1::bind(&rpc::object_storage::get_str, control->object_storage(), rawKey),
++ bind(&rpc::object_storage::get_str, control->object_storage(), rawKey),
+ &rpc::command_base_call<rpc::target_type>,
+ cmd_flags, NULL, NULL);
+ }
+@@ -174,7 +184,7 @@ system_method_insert_object(const torren
+ // if (flags & rpc::object_storage::flag_rlookup) {
+ // rpc::commands.insert_slot<rpc::command_base_is_type<rpc::command_base_call_string<rpc::target_type> >::type>
+ // (create_new_key<9>(rawKey, ".rlookup"),
+- // tr1::bind(&rpc::object_storage::rlookup_obj_list, control->object_storage(), rawKey),
++ // bind(&rpc::object_storage::rlookup_obj_list, control->object_storage(), rawKey),
+ // &rpc::command_base_call_string<rpc::target_type>,
+ // cmd_flags, NULL, NULL);
+ // }
+@@ -188,21 +198,21 @@ system_method_insert_object(const torren
+ case rpc::object_storage::flag_bool_type:
+ rpc::commands.insert_slot<rpc::command_base_is_type<rpc::command_base_call_value<rpc::target_type> >::type>
+ (create_new_key<5>(rawKey, ".set"),
+- tr1::bind(&rpc::object_storage::set_str_bool, control->object_storage(), rawKey, tr1::placeholders::_2),
++ bind(&rpc::object_storage::set_str_bool, control->object_storage(), rawKey, STD_PLACEHOLDERS::_2),
+ &rpc::command_base_call_value<rpc::target_type>,
+ cmd_flags, NULL, NULL);
+ break;
+ case rpc::object_storage::flag_value_type:
+ rpc::commands.insert_slot<rpc::command_base_is_type<rpc::command_base_call_value<rpc::target_type> >::type>
+ (create_new_key<5>(rawKey, ".set"),
+- tr1::bind(&rpc::object_storage::set_str_value, control->object_storage(), rawKey, tr1::placeholders::_2),
++ bind(&rpc::object_storage::set_str_value, control->object_storage(), rawKey, STD_PLACEHOLDERS::_2),
+ &rpc::command_base_call_value<rpc::target_type>,
+ cmd_flags, NULL, NULL);
+ break;
+ case rpc::object_storage::flag_string_type:
+ rpc::commands.insert_slot<rpc::command_base_is_type<rpc::command_base_call_string<rpc::target_type> >::type>
+ (create_new_key<5>(rawKey, ".set"),
+- tr1::bind(&rpc::object_storage::set_str_string, control->object_storage(), rawKey, tr1::placeholders::_2),
++ bind(&rpc::object_storage::set_str_string, control->object_storage(), rawKey, STD_PLACEHOLDERS::_2),
+ &rpc::command_base_call_string<rpc::target_type>,
+ cmd_flags, NULL, NULL);
+ break;
+@@ -423,36 +433,36 @@ system_method_list_keys(const torrent::O
+ }
+
+ #define CMD2_METHOD_INSERT(key, flags) \
+- CMD2_ANY_LIST(key, tr1::bind(&system_method_insert_object, tr1::placeholders::_2, flags));
++ CMD2_ANY_LIST(key, bind(&system_method_insert_object, STD_PLACEHOLDERS::_2, flags));
+
+ void
+ initialize_command_dynamic() {
+ CMD2_VAR_BOOL ("method.use_deprecated", true);
+ CMD2_VAR_VALUE ("method.use_intermediate", 1);
+
+- CMD2_ANY_LIST ("method.insert", tr1::bind(&system_method_insert, tr1::placeholders::_2));
+- CMD2_ANY_LIST ("method.insert.value", tr1::bind(&system_method_insert_object, tr1::placeholders::_2, rpc::object_storage::flag_value_type));
++ CMD2_ANY_LIST ("method.insert", bind(&system_method_insert, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST ("method.insert.value", bind(&system_method_insert_object, STD_PLACEHOLDERS::_2, rpc::object_storage::flag_value_type));
+
+ CMD2_METHOD_INSERT("method.insert.simple", rpc::object_storage::flag_function_type);
+ CMD2_METHOD_INSERT("method.insert.c_simple", rpc::object_storage::flag_constant | rpc::object_storage::flag_function_type);
+ CMD2_METHOD_INSERT("method.insert.s_c_simple", rpc::object_storage::flag_static |
+ rpc::object_storage::flag_constant |rpc::object_storage::flag_function_type);
+
+- CMD2_ANY_STRING ("method.erase", tr1::bind(&system_method_erase, tr1::placeholders::_2));
+- CMD2_ANY_LIST ("method.redirect", tr1::bind(&system_method_redirect, tr1::placeholders::_2));
+- CMD2_ANY_STRING ("method.get", tr1::bind(&rpc::object_storage::get_str, control->object_storage(),
+- tr1::placeholders::_2));
+- CMD2_ANY_LIST ("method.set", tr1::bind(&system_method_set_function, tr1::placeholders::_2));
+-
+- CMD2_ANY_STRING ("method.const", tr1::bind(&rpc::object_storage::has_flag_str, control->object_storage(),
+- tr1::placeholders::_2, rpc::object_storage::flag_constant));
+- CMD2_ANY_STRING_V("method.const.enable", tr1::bind(&rpc::object_storage::enable_flag_str, control->object_storage(),
+- tr1::placeholders::_2, rpc::object_storage::flag_constant));
+-
+- CMD2_ANY_LIST ("method.has_key", tr1::bind(&system_method_has_key, tr1::placeholders::_2));
+- CMD2_ANY_LIST ("method.set_key", tr1::bind(&system_method_set_key, tr1::placeholders::_2));
+- CMD2_ANY_STRING ("method.list_keys", tr1::bind(&system_method_list_keys, tr1::placeholders::_2));
++ CMD2_ANY_STRING ("method.erase", bind(&system_method_erase, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST ("method.redirect", bind(&system_method_redirect, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_STRING ("method.get", bind(&rpc::object_storage::get_str, control->object_storage(),
++ STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST ("method.set", bind(&system_method_set_function, STD_PLACEHOLDERS::_2));
++
++ CMD2_ANY_STRING ("method.const", bind(&rpc::object_storage::has_flag_str, control->object_storage(),
++ STD_PLACEHOLDERS::_2, rpc::object_storage::flag_constant));
++ CMD2_ANY_STRING_V("method.const.enable", bind(&rpc::object_storage::enable_flag_str, control->object_storage(),
++ STD_PLACEHOLDERS::_2, rpc::object_storage::flag_constant));
++
++ CMD2_ANY_LIST ("method.has_key", bind(&system_method_has_key, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST ("method.set_key", bind(&system_method_set_key, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_STRING ("method.list_keys", bind(&system_method_list_keys, STD_PLACEHOLDERS::_2));
+
+- CMD2_ANY_STRING ("method.rlookup", tr1::bind(&rpc::object_storage::rlookup_obj_list, control->object_storage(), tr1::placeholders::_2));
+- CMD2_ANY_STRING_V("method.rlookup.clear", tr1::bind(&rpc::object_storage::rlookup_clear, control->object_storage(), tr1::placeholders::_2));
++ CMD2_ANY_STRING ("method.rlookup", bind(&rpc::object_storage::rlookup_obj_list, control->object_storage(), STD_PLACEHOLDERS::_2));
++ CMD2_ANY_STRING_V("method.rlookup.clear", bind(&rpc::object_storage::rlookup_clear, control->object_storage(), STD_PLACEHOLDERS::_2));
+ }
diff --git a/net/rtorrent/patches/patch-src_command__events.cc b/net/rtorrent/patches/patch-src_command__events.cc
new file mode 100644
index 00000000000..f0fb3bd6e76
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__events.cc
@@ -0,0 +1,75 @@
+$NetBSD: patch-src_command__events.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_events.cc.orig 2013-05-03 23:02:24.000000000 +0000
++++ src/command_events.cc
+@@ -60,6 +60,16 @@
+
+ #include "thread_worker.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ torrent::Object
+ apply_on_ratio(const torrent::Object& rawArgs) {
+ const std::string& groupName = rawArgs.as_string();
+@@ -308,31 +318,31 @@ d_multicall(const torrent::Object::list_
+
+ void
+ initialize_command_events() {
+- CMD2_ANY_STRING ("on_ratio", tr1::bind(&apply_on_ratio, tr1::placeholders::_2));
++ CMD2_ANY_STRING ("on_ratio", bind(&apply_on_ratio, STD_PLACEHOLDERS::_2));
+
+- CMD2_ANY ("start_tied", tr1::bind(&apply_start_tied));
+- CMD2_ANY ("stop_untied", tr1::bind(&apply_stop_untied));
+- CMD2_ANY ("close_untied", tr1::bind(&apply_close_untied));
+- CMD2_ANY ("remove_untied", tr1::bind(&apply_remove_untied));
+-
+- CMD2_ANY_LIST ("schedule2", tr1::bind(&apply_schedule, tr1::placeholders::_2));
+- CMD2_ANY_STRING_V("schedule_remove2", tr1::bind(&rpc::CommandScheduler::erase_str, control->command_scheduler(), tr1::placeholders::_2));
+-
+- CMD2_ANY_STRING_V("import", tr1::bind(&apply_import, tr1::placeholders::_2));
+- CMD2_ANY_STRING_V("try_import", tr1::bind(&apply_try_import, tr1::placeholders::_2));
+-
+- CMD2_ANY_LIST ("load.normal", tr1::bind(&apply_load, tr1::placeholders::_2, core::Manager::create_quiet | core::Manager::create_tied));
+- CMD2_ANY_LIST ("load.verbose", tr1::bind(&apply_load, tr1::placeholders::_2, core::Manager::create_tied));
+- CMD2_ANY_LIST ("load.start", tr1::bind(&apply_load, tr1::placeholders::_2,
++ CMD2_ANY ("start_tied", bind(&apply_start_tied));
++ CMD2_ANY ("stop_untied", bind(&apply_stop_untied));
++ CMD2_ANY ("close_untied", bind(&apply_close_untied));
++ CMD2_ANY ("remove_untied", bind(&apply_remove_untied));
++
++ CMD2_ANY_LIST ("schedule2", bind(&apply_schedule, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_STRING_V("schedule_remove2", bind(&rpc::CommandScheduler::erase_str, control->command_scheduler(), STD_PLACEHOLDERS::_2));
++
++ CMD2_ANY_STRING_V("import", bind(&apply_import, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_STRING_V("try_import", bind(&apply_try_import, STD_PLACEHOLDERS::_2));
++
++ CMD2_ANY_LIST ("load.normal", bind(&apply_load, STD_PLACEHOLDERS::_2, core::Manager::create_quiet | core::Manager::create_tied));
++ CMD2_ANY_LIST ("load.verbose", bind(&apply_load, STD_PLACEHOLDERS::_2, core::Manager::create_tied));
++ CMD2_ANY_LIST ("load.start", bind(&apply_load, STD_PLACEHOLDERS::_2,
+ core::Manager::create_quiet | core::Manager::create_tied | core::Manager::create_start));
+- CMD2_ANY_LIST ("load.start_verbose", tr1::bind(&apply_load, tr1::placeholders::_2, core::Manager::create_tied | core::Manager::create_start));
+- CMD2_ANY_LIST ("load.raw", tr1::bind(&apply_load, tr1::placeholders::_2, core::Manager::create_quiet | core::Manager::create_raw_data));
+- CMD2_ANY_LIST ("load.raw_verbose", tr1::bind(&apply_load, tr1::placeholders::_2, core::Manager::create_raw_data));
+- CMD2_ANY_LIST ("load.raw_start", tr1::bind(&apply_load, tr1::placeholders::_2,
++ CMD2_ANY_LIST ("load.start_verbose", bind(&apply_load, STD_PLACEHOLDERS::_2, core::Manager::create_tied | core::Manager::create_start));
++ CMD2_ANY_LIST ("load.raw", bind(&apply_load, STD_PLACEHOLDERS::_2, core::Manager::create_quiet | core::Manager::create_raw_data));
++ CMD2_ANY_LIST ("load.raw_verbose", bind(&apply_load, STD_PLACEHOLDERS::_2, core::Manager::create_raw_data));
++ CMD2_ANY_LIST ("load.raw_start", bind(&apply_load, STD_PLACEHOLDERS::_2,
+ core::Manager::create_quiet | core::Manager::create_start | core::Manager::create_raw_data));
+
+- CMD2_ANY_VALUE ("close_low_diskspace", tr1::bind(&apply_close_low_diskspace, tr1::placeholders::_2));
++ CMD2_ANY_VALUE ("close_low_diskspace", bind(&apply_close_low_diskspace, STD_PLACEHOLDERS::_2));
+
+- CMD2_ANY_LIST ("download_list", tr1::bind(&apply_download_list, tr1::placeholders::_2));
+- CMD2_ANY_LIST ("d.multicall2", tr1::bind(&d_multicall, tr1::placeholders::_2));
++ CMD2_ANY_LIST ("download_list", bind(&apply_download_list, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST ("d.multicall2", bind(&d_multicall, STD_PLACEHOLDERS::_2));
+ }
diff --git a/net/rtorrent/patches/patch-src_command__file.cc b/net/rtorrent/patches/patch-src_command__file.cc
new file mode 100644
index 00000000000..f8a44fb9f08
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__file.cc
@@ -0,0 +1,103 @@
+$NetBSD: patch-src_command__file.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_file.cc.orig 2013-05-03 23:02:54.000000000 +0000
++++ src/command_file.cc
+@@ -48,6 +48,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ void
+ apply_f_set_priority(torrent::File* file, uint32_t value) {
+ if (value > torrent::PRIORITY_HIGH)
+@@ -100,45 +110,45 @@ apply_fi_filename_last(torrent::FileList
+
+ void
+ initialize_command_file() {
+- CMD2_FILE("f.is_created", tr1::bind(&torrent::File::is_created, tr1::placeholders::_1));
+- CMD2_FILE("f.is_open", tr1::bind(&torrent::File::is_open, tr1::placeholders::_1));
++ CMD2_FILE("f.is_created", bind(&torrent::File::is_created, STD_PLACEHOLDERS::_1));
++ CMD2_FILE("f.is_open", bind(&torrent::File::is_open, STD_PLACEHOLDERS::_1));
+
+- CMD2_FILE("f.is_create_queued", tr1::bind(&torrent::File::is_create_queued, tr1::placeholders::_1));
+- CMD2_FILE("f.is_resize_queued", tr1::bind(&torrent::File::is_resize_queued, tr1::placeholders::_1));
++ CMD2_FILE("f.is_create_queued", bind(&torrent::File::is_create_queued, STD_PLACEHOLDERS::_1));
++ CMD2_FILE("f.is_resize_queued", bind(&torrent::File::is_resize_queued, STD_PLACEHOLDERS::_1));
+
+- CMD2_FILE_VALUE_V("f.set_create_queued", tr1::bind(&torrent::File::set_flags, tr1::placeholders::_1, torrent::File::flag_create_queued));
+- CMD2_FILE_VALUE_V("f.set_resize_queued", tr1::bind(&torrent::File::set_flags, tr1::placeholders::_1, torrent::File::flag_resize_queued));
+- CMD2_FILE_VALUE_V("f.unset_create_queued", tr1::bind(&torrent::File::unset_flags, tr1::placeholders::_1, torrent::File::flag_create_queued));
+- CMD2_FILE_VALUE_V("f.unset_resize_queued", tr1::bind(&torrent::File::unset_flags, tr1::placeholders::_1, torrent::File::flag_resize_queued));
+-
+- CMD2_FILE ("f.prioritize_first", tr1::bind(&torrent::File::has_flags, tr1::placeholders::_1, torrent::File::flag_prioritize_first));
+- CMD2_FILE_V("f.prioritize_first.enable", tr1::bind(&torrent::File::set_flags, tr1::placeholders::_1, torrent::File::flag_prioritize_first));
+- CMD2_FILE_V("f.prioritize_first.disable", tr1::bind(&torrent::File::unset_flags, tr1::placeholders::_1, torrent::File::flag_prioritize_first));
+- CMD2_FILE ("f.prioritize_last", tr1::bind(&torrent::File::has_flags, tr1::placeholders::_1, torrent::File::flag_prioritize_last));
+- CMD2_FILE_V("f.prioritize_last.enable", tr1::bind(&torrent::File::set_flags, tr1::placeholders::_1, torrent::File::flag_prioritize_last));
+- CMD2_FILE_V("f.prioritize_last.disable", tr1::bind(&torrent::File::unset_flags, tr1::placeholders::_1, torrent::File::flag_prioritize_last));
+-
+- CMD2_FILE("f.size_bytes", tr1::bind(&torrent::File::size_bytes, tr1::placeholders::_1));
+- CMD2_FILE("f.size_chunks", tr1::bind(&torrent::File::size_chunks, tr1::placeholders::_1));
+- CMD2_FILE("f.completed_chunks", tr1::bind(&torrent::File::completed_chunks, tr1::placeholders::_1));
+-
+- CMD2_FILE("f.offset", tr1::bind(&torrent::File::offset, tr1::placeholders::_1));
+- CMD2_FILE("f.range_first", tr1::bind(&torrent::File::range_first, tr1::placeholders::_1));
+- CMD2_FILE("f.range_second", tr1::bind(&torrent::File::range_second, tr1::placeholders::_1));
+-
+- CMD2_FILE("f.priority", tr1::bind(&torrent::File::priority, tr1::placeholders::_1));
+- CMD2_FILE_VALUE_V("f.priority.set", tr1::bind(&apply_f_set_priority, tr1::placeholders::_1, tr1::placeholders::_2));
+-
+- CMD2_FILE("f.path", tr1::bind(&apply_f_path, tr1::placeholders::_1));
+- CMD2_FILE("f.path_components", tr1::bind(&apply_f_path_components, tr1::placeholders::_1));
+- CMD2_FILE("f.path_depth", tr1::bind(&apply_f_path_depth, tr1::placeholders::_1));
+- CMD2_FILE("f.frozen_path", tr1::bind(&torrent::File::frozen_path, tr1::placeholders::_1));
++ CMD2_FILE_VALUE_V("f.set_create_queued", bind(&torrent::File::set_flags, STD_PLACEHOLDERS::_1, torrent::File::flag_create_queued));
++ CMD2_FILE_VALUE_V("f.set_resize_queued", bind(&torrent::File::set_flags, STD_PLACEHOLDERS::_1, torrent::File::flag_resize_queued));
++ CMD2_FILE_VALUE_V("f.unset_create_queued", bind(&torrent::File::unset_flags, STD_PLACEHOLDERS::_1, torrent::File::flag_create_queued));
++ CMD2_FILE_VALUE_V("f.unset_resize_queued", bind(&torrent::File::unset_flags, STD_PLACEHOLDERS::_1, torrent::File::flag_resize_queued));
++
++ CMD2_FILE ("f.prioritize_first", bind(&torrent::File::has_flags, STD_PLACEHOLDERS::_1, torrent::File::flag_prioritize_first));
++ CMD2_FILE_V("f.prioritize_first.enable", bind(&torrent::File::set_flags, STD_PLACEHOLDERS::_1, torrent::File::flag_prioritize_first));
++ CMD2_FILE_V("f.prioritize_first.disable", bind(&torrent::File::unset_flags, STD_PLACEHOLDERS::_1, torrent::File::flag_prioritize_first));
++ CMD2_FILE ("f.prioritize_last", bind(&torrent::File::has_flags, STD_PLACEHOLDERS::_1, torrent::File::flag_prioritize_last));
++ CMD2_FILE_V("f.prioritize_last.enable", bind(&torrent::File::set_flags, STD_PLACEHOLDERS::_1, torrent::File::flag_prioritize_last));
++ CMD2_FILE_V("f.prioritize_last.disable", bind(&torrent::File::unset_flags, STD_PLACEHOLDERS::_1, torrent::File::flag_prioritize_last));
++
++ CMD2_FILE("f.size_bytes", bind(&torrent::File::size_bytes, STD_PLACEHOLDERS::_1));
++ CMD2_FILE("f.size_chunks", bind(&torrent::File::size_chunks, STD_PLACEHOLDERS::_1));
++ CMD2_FILE("f.completed_chunks", bind(&torrent::File::completed_chunks, STD_PLACEHOLDERS::_1));
++
++ CMD2_FILE("f.offset", bind(&torrent::File::offset, STD_PLACEHOLDERS::_1));
++ CMD2_FILE("f.range_first", bind(&torrent::File::range_first, STD_PLACEHOLDERS::_1));
++ CMD2_FILE("f.range_second", bind(&torrent::File::range_second, STD_PLACEHOLDERS::_1));
++
++ CMD2_FILE("f.priority", bind(&torrent::File::priority, STD_PLACEHOLDERS::_1));
++ CMD2_FILE_VALUE_V("f.priority.set", bind(&apply_f_set_priority, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
++
++ CMD2_FILE("f.path", bind(&apply_f_path, STD_PLACEHOLDERS::_1));
++ CMD2_FILE("f.path_components", bind(&apply_f_path_components, STD_PLACEHOLDERS::_1));
++ CMD2_FILE("f.path_depth", bind(&apply_f_path_depth, STD_PLACEHOLDERS::_1));
++ CMD2_FILE("f.frozen_path", bind(&torrent::File::frozen_path, STD_PLACEHOLDERS::_1));
+
+- CMD2_FILE("f.match_depth_prev", tr1::bind(&torrent::File::match_depth_prev, tr1::placeholders::_1));
+- CMD2_FILE("f.match_depth_next", tr1::bind(&torrent::File::match_depth_next, tr1::placeholders::_1));
++ CMD2_FILE("f.match_depth_prev", bind(&torrent::File::match_depth_prev, STD_PLACEHOLDERS::_1));
++ CMD2_FILE("f.match_depth_next", bind(&torrent::File::match_depth_next, STD_PLACEHOLDERS::_1));
+
+- CMD2_FILE("f.last_touched", tr1::bind(&torrent::File::last_touched, tr1::placeholders::_1));
++ CMD2_FILE("f.last_touched", bind(&torrent::File::last_touched, STD_PLACEHOLDERS::_1));
+
+- CMD2_FILEITR("fi.filename_last", tr1::bind(&apply_fi_filename_last, tr1::placeholders::_1));
+- CMD2_FILEITR("fi.is_file", tr1::bind(&torrent::FileListIterator::is_file, tr1::placeholders::_1));
++ CMD2_FILEITR("fi.filename_last", bind(&apply_fi_filename_last, STD_PLACEHOLDERS::_1));
++ CMD2_FILEITR("fi.is_file", bind(&torrent::FileListIterator::is_file, STD_PLACEHOLDERS::_1));
+ }
diff --git a/net/rtorrent/patches/patch-src_command__groups.cc b/net/rtorrent/patches/patch-src_command__groups.cc
new file mode 100644
index 00000000000..c92d835bbb9
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__groups.cc
@@ -0,0 +1,126 @@
+$NetBSD: patch-src_command__groups.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_groups.cc.orig 2013-05-03 23:08:09.000000000 +0000
++++ src/command_groups.cc
+@@ -52,6 +52,16 @@
+ // For cg_d_group.
+ #include "core/download.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ // A hack to allow testing of the new choke_group API without the
+ // working parts present.
+ #define USE_CHOKE_GROUP 0
+@@ -264,8 +274,8 @@ apply_cg_tracker_mode_set(const torrent:
+ return torrent::Object();
+ }
+
+-#define CG_GROUP_AT() tr1::bind(&cg_get_group, tr1::placeholders::_2)
+-#define CHOKE_GROUP(direction) tr1::bind(direction, CG_GROUP_AT())
++#define CG_GROUP_AT() bind(&cg_get_group, STD_PLACEHOLDERS::_2)
++#define CHOKE_GROUP(direction) bind(direction, CG_GROUP_AT())
+
+ /*
+
+@@ -336,54 +346,54 @@ options.
+ void
+ initialize_command_groups() {
+ // Move somewhere else?
+- CMD2_ANY ("strings.choke_heuristics", tr1::bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS));
+- CMD2_ANY ("strings.choke_heuristics.upload", tr1::bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS_UPLOAD));
+- CMD2_ANY ("strings.choke_heuristics.download", tr1::bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS_DOWNLOAD));
+- CMD2_ANY ("strings.tracker_mode", tr1::bind(&torrent::option_list_strings, torrent::OPTION_TRACKER_MODE));
++ CMD2_ANY ("strings.choke_heuristics", bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS));
++ CMD2_ANY ("strings.choke_heuristics.upload", bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS_UPLOAD));
++ CMD2_ANY ("strings.choke_heuristics.download", bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS_DOWNLOAD));
++ CMD2_ANY ("strings.tracker_mode", bind(&torrent::option_list_strings, torrent::OPTION_TRACKER_MODE));
+
+- CMD2_ANY ("choke_group.list", tr1::bind(&apply_cg_list));
+- CMD2_ANY_STRING ("choke_group.insert", tr1::bind(&apply_cg_insert, tr1::placeholders::_2));
++ CMD2_ANY ("choke_group.list", bind(&apply_cg_list));
++ CMD2_ANY_STRING ("choke_group.insert", bind(&apply_cg_insert, STD_PLACEHOLDERS::_2));
+
+ #if USE_CHOKE_GROUP
+- CMD2_ANY ("choke_group.size", tr1::bind(&torrent::ResourceManager::group_size, torrent::resource_manager()));
+- CMD2_ANY_STRING ("choke_group.index_of", tr1::bind(&torrent::ResourceManager::group_index_of, torrent::resource_manager(), tr1::placeholders::_2));
++ CMD2_ANY ("choke_group.size", bind(&torrent::ResourceManager::group_size, torrent::resource_manager()));
++ CMD2_ANY_STRING ("choke_group.index_of", bind(&torrent::ResourceManager::group_index_of, torrent::resource_manager(), STD_PLACEHOLDERS::_2));
+ #else
+ apply_cg_insert("default");
+
+- CMD2_ANY ("choke_group.size", tr1::bind(&std::vector<torrent::choke_group*>::size, cg_list_hack));
+- CMD2_ANY_STRING ("choke_group.index_of", tr1::bind(&apply_cg_index_of, tr1::placeholders::_2));
++ CMD2_ANY ("choke_group.size", bind(&std::vector<torrent::choke_group*>::size, cg_list_hack));
++ CMD2_ANY_STRING ("choke_group.index_of", bind(&apply_cg_index_of, STD_PLACEHOLDERS::_2));
+ #endif
+
+ // Commands specific for a group. Supports as the first argument the
+ // name, the index or a negative index.
+- CMD2_ANY ("choke_group.general.size", tr1::bind(&torrent::choke_group::size, CG_GROUP_AT()));
++ CMD2_ANY ("choke_group.general.size", bind(&torrent::choke_group::size, CG_GROUP_AT()));
+
+- CMD2_ANY ("choke_group.tracker.mode", tr1::bind(&torrent::option_as_string, torrent::OPTION_TRACKER_MODE,
+- tr1::bind(&torrent::choke_group::tracker_mode, CG_GROUP_AT())));
+- CMD2_ANY_LIST ("choke_group.tracker.mode.set", tr1::bind(&apply_cg_tracker_mode_set, tr1::placeholders::_2));
+-
+- CMD2_ANY ("choke_group.up.rate", tr1::bind(&torrent::choke_group::up_rate, CG_GROUP_AT()));
+- CMD2_ANY ("choke_group.down.rate", tr1::bind(&torrent::choke_group::down_rate, CG_GROUP_AT()));
+-
+- CMD2_ANY ("choke_group.up.max.unlimited", tr1::bind(&torrent::choke_queue::is_unlimited, CHOKE_GROUP(&torrent::choke_group::up_queue)));
+- CMD2_ANY ("choke_group.up.max", tr1::bind(&torrent::choke_queue::max_unchoked_signed, CHOKE_GROUP(&torrent::choke_group::up_queue)));
+- CMD2_ANY_LIST ("choke_group.up.max.set", tr1::bind(&apply_cg_max_set, tr1::placeholders::_2, true));
+-
+- CMD2_ANY ("choke_group.up.total", tr1::bind(&torrent::choke_queue::size_total, CHOKE_GROUP(&torrent::choke_group::up_queue)));
+- CMD2_ANY ("choke_group.up.queued", tr1::bind(&torrent::choke_queue::size_queued, CHOKE_GROUP(&torrent::choke_group::up_queue)));
+- CMD2_ANY ("choke_group.up.unchoked", tr1::bind(&torrent::choke_queue::size_unchoked, CHOKE_GROUP(&torrent::choke_group::up_queue)));
+- CMD2_ANY ("choke_group.up.heuristics", tr1::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS,
+- tr1::bind(&torrent::choke_queue::heuristics, CHOKE_GROUP(&torrent::choke_group::up_queue))));
+- CMD2_ANY_LIST ("choke_group.up.heuristics.set", tr1::bind(&apply_cg_heuristics_set, tr1::placeholders::_2, true));
+-
+- CMD2_ANY ("choke_group.down.max.unlimited", tr1::bind(&torrent::choke_queue::is_unlimited, CHOKE_GROUP(&torrent::choke_group::down_queue)));
+- CMD2_ANY ("choke_group.down.max", tr1::bind(&torrent::choke_queue::max_unchoked_signed, CHOKE_GROUP(&torrent::choke_group::down_queue)));
+- CMD2_ANY_LIST ("choke_group.down.max.set", tr1::bind(&apply_cg_max_set, tr1::placeholders::_2, false));
+-
+- CMD2_ANY ("choke_group.down.total", tr1::bind(&torrent::choke_queue::size_total, CHOKE_GROUP(&torrent::choke_group::down_queue)));
+- CMD2_ANY ("choke_group.down.queued", tr1::bind(&torrent::choke_queue::size_queued, CHOKE_GROUP(&torrent::choke_group::down_queue)));
+- CMD2_ANY ("choke_group.down.unchoked", tr1::bind(&torrent::choke_queue::size_unchoked, CHOKE_GROUP(&torrent::choke_group::down_queue)));
+- CMD2_ANY ("choke_group.down.heuristics", tr1::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS,
+- tr1::bind(&torrent::choke_queue::heuristics, CHOKE_GROUP(&torrent::choke_group::down_queue))));
+- CMD2_ANY_LIST ("choke_group.down.heuristics.set", tr1::bind(&apply_cg_heuristics_set, tr1::placeholders::_2, false));
++ CMD2_ANY ("choke_group.tracker.mode", bind(&torrent::option_as_string, torrent::OPTION_TRACKER_MODE,
++ bind(&torrent::choke_group::tracker_mode, CG_GROUP_AT())));
++ CMD2_ANY_LIST ("choke_group.tracker.mode.set", bind(&apply_cg_tracker_mode_set, STD_PLACEHOLDERS::_2));
++
++ CMD2_ANY ("choke_group.up.rate", bind(&torrent::choke_group::up_rate, CG_GROUP_AT()));
++ CMD2_ANY ("choke_group.down.rate", bind(&torrent::choke_group::down_rate, CG_GROUP_AT()));
++
++ CMD2_ANY ("choke_group.up.max.unlimited", bind(&torrent::choke_queue::is_unlimited, CHOKE_GROUP(&torrent::choke_group::up_queue)));
++ CMD2_ANY ("choke_group.up.max", bind(&torrent::choke_queue::max_unchoked_signed, CHOKE_GROUP(&torrent::choke_group::up_queue)));
++ CMD2_ANY_LIST ("choke_group.up.max.set", bind(&apply_cg_max_set, STD_PLACEHOLDERS::_2, true));
++
++ CMD2_ANY ("choke_group.up.total", bind(&torrent::choke_queue::size_total, CHOKE_GROUP(&torrent::choke_group::up_queue)));
++ CMD2_ANY ("choke_group.up.queued", bind(&torrent::choke_queue::size_queued, CHOKE_GROUP(&torrent::choke_group::up_queue)));
++ CMD2_ANY ("choke_group.up.unchoked", bind(&torrent::choke_queue::size_unchoked, CHOKE_GROUP(&torrent::choke_group::up_queue)));
++ CMD2_ANY ("choke_group.up.heuristics", bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS,
++ bind(&torrent::choke_queue::heuristics, CHOKE_GROUP(&torrent::choke_group::up_queue))));
++ CMD2_ANY_LIST ("choke_group.up.heuristics.set", bind(&apply_cg_heuristics_set, STD_PLACEHOLDERS::_2, true));
++
++ CMD2_ANY ("choke_group.down.max.unlimited", bind(&torrent::choke_queue::is_unlimited, CHOKE_GROUP(&torrent::choke_group::down_queue)));
++ CMD2_ANY ("choke_group.down.max", bind(&torrent::choke_queue::max_unchoked_signed, CHOKE_GROUP(&torrent::choke_group::down_queue)));
++ CMD2_ANY_LIST ("choke_group.down.max.set", bind(&apply_cg_max_set, STD_PLACEHOLDERS::_2, false));
++
++ CMD2_ANY ("choke_group.down.total", bind(&torrent::choke_queue::size_total, CHOKE_GROUP(&torrent::choke_group::down_queue)));
++ CMD2_ANY ("choke_group.down.queued", bind(&torrent::choke_queue::size_queued, CHOKE_GROUP(&torrent::choke_group::down_queue)));
++ CMD2_ANY ("choke_group.down.unchoked", bind(&torrent::choke_queue::size_unchoked, CHOKE_GROUP(&torrent::choke_group::down_queue)));
++ CMD2_ANY ("choke_group.down.heuristics", bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS,
++ bind(&torrent::choke_queue::heuristics, CHOKE_GROUP(&torrent::choke_group::down_queue))));
++ CMD2_ANY_LIST ("choke_group.down.heuristics.set", bind(&apply_cg_heuristics_set, STD_PLACEHOLDERS::_2, false));
+ }
diff --git a/net/rtorrent/patches/patch-src_command__helpers.h b/net/rtorrent/patches/patch-src_command__helpers.h
new file mode 100644
index 00000000000..33159a9757b
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__helpers.h
@@ -0,0 +1,74 @@
+$NetBSD: patch-src_command__helpers.h,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_helpers.h.orig 2013-05-03 22:59:40.000000000 +0000
++++ src/command_helpers.h
+@@ -41,8 +41,6 @@
+ #include "rpc/parse_commands.h"
+ #include "rpc/object_storage.h"
+
+-namespace tr1 { using namespace std::tr1; }
+-
+ void initialize_commands();
+
+ //
+@@ -100,43 +98,43 @@ void initialize_commands();
+
+ #define CMD2_VAR_BOOL(key, value) \
+ control->object_storage()->insert_c_str(key, int64_t(value), rpc::object_storage::flag_bool_type); \
+- CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \
++ CMD2_ANY(key, bind(&rpc::object_storage::get, control->object_storage(), \
+ torrent::raw_string::from_c_str(key))); \
+- CMD2_ANY_VALUE(key ".set", tr1::bind(&rpc::object_storage::set_bool, control->object_storage(), \
+- torrent::raw_string::from_c_str(key), tr1::placeholders::_2));
++ CMD2_ANY_VALUE(key ".set", bind(&rpc::object_storage::set_bool, control->object_storage(), \
++ torrent::raw_string::from_c_str(key), STD_PLACEHOLDERS::_2));
+
+ #define CMD2_VAR_VALUE(key, value) \
+ control->object_storage()->insert_c_str(key, int64_t(value), rpc::object_storage::flag_value_type); \
+- CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \
++ CMD2_ANY(key, bind(&rpc::object_storage::get, control->object_storage(), \
+ torrent::raw_string::from_c_str(key))); \
+- CMD2_ANY_VALUE(key ".set", tr1::bind(&rpc::object_storage::set_value, control->object_storage(), \
+- torrent::raw_string::from_c_str(key), tr1::placeholders::_2));
++ CMD2_ANY_VALUE(key ".set", bind(&rpc::object_storage::set_value, control->object_storage(), \
++ torrent::raw_string::from_c_str(key), STD_PLACEHOLDERS::_2));
+
+ #define CMD2_VAR_STRING(key, value) \
+ control->object_storage()->insert_c_str(key, value, rpc::object_storage::flag_string_type); \
+- CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \
++ CMD2_ANY(key, bind(&rpc::object_storage::get, control->object_storage(), \
+ torrent::raw_string::from_c_str(key))); \
+- CMD2_ANY_STRING(key ".set", tr1::bind(&rpc::object_storage::set_string, control->object_storage(), \
+- torrent::raw_string::from_c_str(key), tr1::placeholders::_2));
++ CMD2_ANY_STRING(key ".set", bind(&rpc::object_storage::set_string, control->object_storage(), \
++ torrent::raw_string::from_c_str(key), STD_PLACEHOLDERS::_2));
+
+
+ #define CMD2_VAR_C_STRING(key, value) \
+ control->object_storage()->insert_c_str(key, value, rpc::object_storage::flag_string_type); \
+- CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \
++ CMD2_ANY(key, bind(&rpc::object_storage::get, control->object_storage(), \
+ torrent::raw_string::from_c_str(key)));
+
+ #define CMD2_VAR_LIST(key) \
+ control->object_storage()->insert_c_str(key, torrent::Object::create_list(), rpc::object_storage::flag_list_type); \
+- CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \
++ CMD2_ANY(key, bind(&rpc::object_storage::get, control->object_storage(), \
+ torrent::raw_string::from_c_str(key))); \
+- CMD2_ANY_LIST(key ".set", tr1::bind(&rpc::object_storage::set_list, control->object_storage(), \
+- torrent::raw_string::from_c_str(key), tr1::placeholders::_2)); \
+- CMD2_ANY_VOID(key ".push_back", tr1::bind(&rpc::object_storage::list_push_back, control->object_storage(), \
+- torrent::raw_string::from_c_str(key), tr1::placeholders::_2));
++ CMD2_ANY_LIST(key ".set", bind(&rpc::object_storage::set_list, control->object_storage(), \
++ torrent::raw_string::from_c_str(key), STD_PLACEHOLDERS::_2)); \
++ CMD2_ANY_VOID(key ".push_back", bind(&rpc::object_storage::list_push_back, control->object_storage(), \
++ torrent::raw_string::from_c_str(key), STD_PLACEHOLDERS::_2));
+
+ #define CMD2_FUNC_SINGLE(key, cmds) \
+- CMD2_ANY(key, tr1::bind(&rpc::command_function_call, torrent::raw_string::from_c_str(cmds), \
+- tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_ANY(key, bind(&rpc::command_function_call, torrent::raw_string::from_c_str(cmds), \
++ STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+
+ #define CMD2_REDIRECT(from_key, to_key) \
+ rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_dont_delete);
diff --git a/net/rtorrent/patches/patch-src_command__ip.cc b/net/rtorrent/patches/patch-src_command__ip.cc
new file mode 100644
index 00000000000..ad8d7f3693a
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__ip.cc
@@ -0,0 +1,51 @@
+$NetBSD: patch-src_command__ip.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_ip.cc.orig 2013-05-03 23:03:23.000000000 +0000
++++ src/command_ip.cc
+@@ -45,6 +45,16 @@
+ #include "globals.h"
+ #include "command_helpers.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ void
+ ipv4_filter_parse(const char* address, int value) {
+ uint32_t ip_values[4] = { 0, 0, 0, 0 };
+@@ -287,17 +297,17 @@ apply_ipv4_filter_dump() {
+
+ void
+ initialize_command_ip() {
+- CMD2_ANY ("strings.ip_filter", tr1::bind(&torrent::option_list_strings, torrent::OPTION_IP_FILTER));
+- CMD2_ANY ("strings.ip_tos", tr1::bind(&torrent::option_list_strings, torrent::OPTION_IP_TOS));
++ CMD2_ANY ("strings.ip_filter", bind(&torrent::option_list_strings, torrent::OPTION_IP_FILTER));
++ CMD2_ANY ("strings.ip_tos", bind(&torrent::option_list_strings, torrent::OPTION_IP_TOS));
+
+- CMD2_ANY_STRING ("ip_tables.insert_table", tr1::bind(&apply_ip_tables_insert_table, tr1::placeholders::_2));
+- CMD2_ANY_STRING ("ip_tables.size_data", tr1::bind(&apply_ip_tables_size_data, tr1::placeholders::_2));
+- CMD2_ANY_LIST ("ip_tables.get", tr1::bind(&apply_ip_tables_get, tr1::placeholders::_2));
+- CMD2_ANY_LIST ("ip_tables.add_address", tr1::bind(&apply_ip_tables_add_address, tr1::placeholders::_2));
+-
+- CMD2_ANY ("ipv4_filter.size_data", tr1::bind(&apply_ipv4_filter_size_data));
+- CMD2_ANY_STRING ("ipv4_filter.get", tr1::bind(&apply_ipv4_filter_get, tr1::placeholders::_2));
+- CMD2_ANY_LIST ("ipv4_filter.add_address", tr1::bind(&apply_ipv4_filter_add_address, tr1::placeholders::_2));
+- CMD2_ANY_LIST ("ipv4_filter.load", tr1::bind(&apply_ipv4_filter_load, tr1::placeholders::_2));
+- CMD2_ANY_LIST ("ipv4_filter.dump", tr1::bind(&apply_ipv4_filter_dump));
++ CMD2_ANY_STRING ("ip_tables.insert_table", bind(&apply_ip_tables_insert_table, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_STRING ("ip_tables.size_data", bind(&apply_ip_tables_size_data, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST ("ip_tables.get", bind(&apply_ip_tables_get, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST ("ip_tables.add_address", bind(&apply_ip_tables_add_address, STD_PLACEHOLDERS::_2));
++
++ CMD2_ANY ("ipv4_filter.size_data", bind(&apply_ipv4_filter_size_data));
++ CMD2_ANY_STRING ("ipv4_filter.get", bind(&apply_ipv4_filter_get, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST ("ipv4_filter.add_address", bind(&apply_ipv4_filter_add_address, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST ("ipv4_filter.load", bind(&apply_ipv4_filter_load, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST ("ipv4_filter.dump", bind(&apply_ipv4_filter_dump));
+ }
diff --git a/net/rtorrent/patches/patch-src_command__local.cc b/net/rtorrent/patches/patch-src_command__local.cc
new file mode 100644
index 00000000000..b4b2702de8a
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__local.cc
@@ -0,0 +1,183 @@
+$NetBSD: patch-src_command__local.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_local.cc.orig 2013-05-03 23:06:13.000000000 +0000
++++ src/command_local.cc
+@@ -65,6 +65,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ typedef torrent::ChunkManager CM_t;
+ typedef torrent::FileManager FM_t;
+
+@@ -326,8 +336,8 @@ initialize_command_local() {
+ core::DownloadList* dList = control->core()->download_list();
+ core::DownloadStore* dStore = control->core()->download_store();
+
+- CMD2_ANY ("system.hostname", tr1::bind(&system_hostname));
+- CMD2_ANY ("system.pid", tr1::bind(&getpid));
++ CMD2_ANY ("system.hostname", bind(&system_hostname));
++ CMD2_ANY ("system.pid", bind(&getpid));
+
+ CMD2_VAR_C_STRING("system.api_version", (int64_t)API_VERSION);
+ CMD2_VAR_C_STRING("system.client_version", PACKAGE_VERSION);
+@@ -337,54 +347,54 @@ initialize_command_local() {
+ CMD2_VAR_VALUE ("system.file.split_size", -1);
+ CMD2_VAR_STRING ("system.file.split_suffix", ".part");
+
+- CMD2_ANY ("system.file_status_cache.size", tr1::bind(&utils::FileStatusCache::size,
++ CMD2_ANY ("system.file_status_cache.size", bind(&utils::FileStatusCache::size,
+ (utils::FileStatusCache::base_type*)control->core()->file_status_cache()));
+- CMD2_ANY_V ("system.file_status_cache.prune", tr1::bind(&utils::FileStatusCache::prune, control->core()->file_status_cache()));
++ CMD2_ANY_V ("system.file_status_cache.prune", bind(&utils::FileStatusCache::prune, control->core()->file_status_cache()));
+
+ CMD2_VAR_BOOL ("file.prioritize_toc", 0);
+ CMD2_VAR_LIST ("file.prioritize_toc.first");
+ CMD2_VAR_LIST ("file.prioritize_toc.last");
+
+- CMD2_ANY ("system.files.opened_counter", tr1::bind(&FM_t::files_opened_counter, fileManager));
+- CMD2_ANY ("system.files.closed_counter", tr1::bind(&FM_t::files_closed_counter, fileManager));
+- CMD2_ANY ("system.files.failed_counter", tr1::bind(&FM_t::files_failed_counter, fileManager));
+-
+- CMD2_ANY ("system.time", tr1::bind(&rak::timer::seconds, &cachedTime));
+- CMD2_ANY ("system.time_seconds", tr1::bind(&rak::timer::current_seconds));
+- CMD2_ANY ("system.time_usec", tr1::bind(&rak::timer::current_usec));
+-
+- CMD2_ANY_VALUE_V ("system.umask.set", tr1::bind(&umask, tr1::placeholders::_2));
+-
+- CMD2_ANY ("system.cwd", tr1::bind(&system_get_cwd));
+- CMD2_ANY_STRING ("system.cwd.set", tr1::bind(&system_set_cwd, tr1::placeholders::_2));
+-
+- CMD2_ANY ("pieces.sync.always_safe", tr1::bind(&CM_t::safe_sync, chunkManager));
+- CMD2_ANY_VALUE_V ("pieces.sync.always_safe.set", tr1::bind(&CM_t::set_safe_sync, chunkManager, tr1::placeholders::_2));
+- CMD2_ANY ("pieces.sync.safe_free_diskspace", tr1::bind(&CM_t::safe_free_diskspace, chunkManager));
+- CMD2_ANY ("pieces.sync.timeout", tr1::bind(&CM_t::timeout_sync, chunkManager));
+- CMD2_ANY_VALUE_V ("pieces.sync.timeout.set", tr1::bind(&CM_t::set_timeout_sync, chunkManager, tr1::placeholders::_2));
+- CMD2_ANY ("pieces.sync.timeout_safe", tr1::bind(&CM_t::timeout_safe_sync, chunkManager));
+- CMD2_ANY_VALUE_V ("pieces.sync.timeout_safe.set", tr1::bind(&CM_t::set_timeout_safe_sync, chunkManager, tr1::placeholders::_2));
+- CMD2_ANY ("pieces.sync.queue_size", tr1::bind(&CM_t::sync_queue_size, chunkManager));
+-
+- CMD2_ANY ("pieces.preload.type", tr1::bind(&CM_t::preload_type, chunkManager));
+- CMD2_ANY_VALUE_V ("pieces.preload.type.set", tr1::bind(&CM_t::set_preload_type, chunkManager, tr1::placeholders::_2));
+- CMD2_ANY ("pieces.preload.min_size", tr1::bind(&CM_t::preload_min_size, chunkManager));
+- CMD2_ANY_VALUE_V ("pieces.preload.min_size.set", tr1::bind(&CM_t::set_preload_min_size, chunkManager, tr1::placeholders::_2));
+- CMD2_ANY ("pieces.preload.min_rate", tr1::bind(&CM_t::preload_required_rate, chunkManager));
+- CMD2_ANY_VALUE_V ("pieces.preload.min_rate.set", tr1::bind(&CM_t::set_preload_required_rate, chunkManager, tr1::placeholders::_2));
+-
+- CMD2_ANY ("pieces.memory.current", tr1::bind(&CM_t::memory_usage, chunkManager));
+- CMD2_ANY ("pieces.memory.sync_queue", tr1::bind(&CM_t::sync_queue_memory_usage, chunkManager));
+- CMD2_ANY ("pieces.memory.block_count", tr1::bind(&CM_t::memory_block_count, chunkManager));
+- CMD2_ANY ("pieces.memory.max", tr1::bind(&CM_t::max_memory_usage, chunkManager));
+- CMD2_ANY_VALUE_V ("pieces.memory.max.set", tr1::bind(&CM_t::set_max_memory_usage, chunkManager, tr1::placeholders::_2));
+- CMD2_ANY ("pieces.stats_preloaded", tr1::bind(&CM_t::stats_preloaded, chunkManager));
+- CMD2_ANY ("pieces.stats_not_preloaded", tr1::bind(&CM_t::stats_not_preloaded, chunkManager));
++ CMD2_ANY ("system.files.opened_counter", bind(&FM_t::files_opened_counter, fileManager));
++ CMD2_ANY ("system.files.closed_counter", bind(&FM_t::files_closed_counter, fileManager));
++ CMD2_ANY ("system.files.failed_counter", bind(&FM_t::files_failed_counter, fileManager));
++
++ CMD2_ANY ("system.time", bind(&rak::timer::seconds, &cachedTime));
++ CMD2_ANY ("system.time_seconds", bind(&rak::timer::current_seconds));
++ CMD2_ANY ("system.time_usec", bind(&rak::timer::current_usec));
++
++ CMD2_ANY_VALUE_V ("system.umask.set", bind(&umask, STD_PLACEHOLDERS::_2));
++
++ CMD2_ANY ("system.cwd", bind(&system_get_cwd));
++ CMD2_ANY_STRING ("system.cwd.set", bind(&system_set_cwd, STD_PLACEHOLDERS::_2));
++
++ CMD2_ANY ("pieces.sync.always_safe", bind(&CM_t::safe_sync, chunkManager));
++ CMD2_ANY_VALUE_V ("pieces.sync.always_safe.set", bind(&CM_t::set_safe_sync, chunkManager, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("pieces.sync.safe_free_diskspace", bind(&CM_t::safe_free_diskspace, chunkManager));
++ CMD2_ANY ("pieces.sync.timeout", bind(&CM_t::timeout_sync, chunkManager));
++ CMD2_ANY_VALUE_V ("pieces.sync.timeout.set", bind(&CM_t::set_timeout_sync, chunkManager, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("pieces.sync.timeout_safe", bind(&CM_t::timeout_safe_sync, chunkManager));
++ CMD2_ANY_VALUE_V ("pieces.sync.timeout_safe.set", bind(&CM_t::set_timeout_safe_sync, chunkManager, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("pieces.sync.queue_size", bind(&CM_t::sync_queue_size, chunkManager));
++
++ CMD2_ANY ("pieces.preload.type", bind(&CM_t::preload_type, chunkManager));
++ CMD2_ANY_VALUE_V ("pieces.preload.type.set", bind(&CM_t::set_preload_type, chunkManager, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("pieces.preload.min_size", bind(&CM_t::preload_min_size, chunkManager));
++ CMD2_ANY_VALUE_V ("pieces.preload.min_size.set", bind(&CM_t::set_preload_min_size, chunkManager, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("pieces.preload.min_rate", bind(&CM_t::preload_required_rate, chunkManager));
++ CMD2_ANY_VALUE_V ("pieces.preload.min_rate.set", bind(&CM_t::set_preload_required_rate, chunkManager, STD_PLACEHOLDERS::_2));
++
++ CMD2_ANY ("pieces.memory.current", bind(&CM_t::memory_usage, chunkManager));
++ CMD2_ANY ("pieces.memory.sync_queue", bind(&CM_t::sync_queue_memory_usage, chunkManager));
++ CMD2_ANY ("pieces.memory.block_count", bind(&CM_t::memory_block_count, chunkManager));
++ CMD2_ANY ("pieces.memory.max", bind(&CM_t::max_memory_usage, chunkManager));
++ CMD2_ANY_VALUE_V ("pieces.memory.max.set", bind(&CM_t::set_max_memory_usage, chunkManager, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("pieces.stats_preloaded", bind(&CM_t::stats_preloaded, chunkManager));
++ CMD2_ANY ("pieces.stats_not_preloaded", bind(&CM_t::stats_not_preloaded, chunkManager));
+
+- CMD2_ANY ("pieces.stats.total_size", tr1::bind(&apply_pieces_stats_total_size));
++ CMD2_ANY ("pieces.stats.total_size", bind(&apply_pieces_stats_total_size));
+
+- CMD2_ANY ("pieces.hash.queue_size", tr1::bind(&torrent::hash_queue_size));
++ CMD2_ANY ("pieces.hash.queue_size", bind(&torrent::hash_queue_size));
+ CMD2_VAR_BOOL ("pieces.hash.on_completion", true);
+
+ CMD2_VAR_STRING ("directory.default", "./");
+@@ -393,13 +403,13 @@ initialize_command_local() {
+ CMD2_VAR_BOOL ("session.use_lock", true);
+ CMD2_VAR_BOOL ("session.on_completion", true);
+
+- CMD2_ANY ("session.path", tr1::bind(&core::DownloadStore::path, dStore));
+- CMD2_ANY_STRING_V("session.path.set", tr1::bind(&core::DownloadStore::set_path, dStore, tr1::placeholders::_2));
++ CMD2_ANY ("session.path", bind(&core::DownloadStore::path, dStore));
++ CMD2_ANY_STRING_V("session.path.set", bind(&core::DownloadStore::set_path, dStore, STD_PLACEHOLDERS::_2));
+
+- CMD2_ANY_V ("session.save", tr1::bind(&core::DownloadList::session_save, dList));
++ CMD2_ANY_V ("session.save", bind(&core::DownloadList::session_save, dList));
+
+ #define CMD2_EXECUTE(key, flags) \
+- CMD2_ANY(key, tr1::bind(&rpc::ExecFile::execute_object, &rpc::execFile, tr1::placeholders::_2, flags));
++ CMD2_ANY(key, bind(&rpc::ExecFile::execute_object, &rpc::execFile, STD_PLACEHOLDERS::_2, flags));
+
+ CMD2_EXECUTE ("execute2", rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_throw);
+ CMD2_EXECUTE ("execute.throw", rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_throw);
+@@ -413,25 +423,25 @@ initialize_command_local() {
+ CMD2_EXECUTE ("execute.capture", rpc::ExecFile::flag_throw | rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_capture);
+ CMD2_EXECUTE ("execute.capture_nothrow", rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_capture);
+
+- CMD2_ANY_LIST ("log.open_file", tr1::bind(&apply_log_open_file, tr1::placeholders::_2));
+- CMD2_ANY_LIST ("log.add_output", tr1::bind(&apply_log_add_output, tr1::placeholders::_2));
++ CMD2_ANY_LIST ("log.open_file", bind(&apply_log_open_file, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST ("log.add_output", bind(&apply_log_add_output, STD_PLACEHOLDERS::_2));
+
+- CMD2_ANY_STRING ("log.execute", tr1::bind(&apply_log, tr1::placeholders::_2, 0));
+- CMD2_ANY_STRING ("log.vmmap.dump", tr1::bind(&log_vmmap_dump, tr1::placeholders::_2));
+- CMD2_ANY_STRING_V("log.xmlrpc", tr1::bind(&ThreadWorker::set_xmlrpc_log, worker_thread, tr1::placeholders::_2));
+- CMD2_ANY_LIST ("log.libtorrent", tr1::bind(&apply_log_libtorrent, tr1::placeholders::_2));
++ CMD2_ANY_STRING ("log.execute", bind(&apply_log, STD_PLACEHOLDERS::_2, 0));
++ CMD2_ANY_STRING ("log.vmmap.dump", bind(&log_vmmap_dump, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_STRING_V("log.xmlrpc", bind(&ThreadWorker::set_xmlrpc_log, worker_thread, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST ("log.libtorrent", bind(&apply_log_libtorrent, STD_PLACEHOLDERS::_2));
+
+- CMD2_ANY_LIST ("file.append", tr1::bind(&cmd_file_append, tr1::placeholders::_2));
++ CMD2_ANY_LIST ("file.append", bind(&cmd_file_append, STD_PLACEHOLDERS::_2));
+
+ // TODO: Convert to new command types:
+ *rpc::command_base::argument(0) = "placeholder.0";
+ *rpc::command_base::argument(1) = "placeholder.1";
+ *rpc::command_base::argument(2) = "placeholder.2";
+ *rpc::command_base::argument(3) = "placeholder.3";
+- CMD2_ANY_P("argument.0", tr1::bind(&rpc::command_base::argument_ref, 0));
+- CMD2_ANY_P("argument.1", tr1::bind(&rpc::command_base::argument_ref, 1));
+- CMD2_ANY_P("argument.2", tr1::bind(&rpc::command_base::argument_ref, 2));
+- CMD2_ANY_P("argument.3", tr1::bind(&rpc::command_base::argument_ref, 3));
++ CMD2_ANY_P("argument.0", bind(&rpc::command_base::argument_ref, 0));
++ CMD2_ANY_P("argument.1", bind(&rpc::command_base::argument_ref, 1));
++ CMD2_ANY_P("argument.2", bind(&rpc::command_base::argument_ref, 2));
++ CMD2_ANY_P("argument.3", bind(&rpc::command_base::argument_ref, 3));
+
+- CMD2_ANY_LIST ("group.insert", tr1::bind(&group_insert, tr1::placeholders::_2));
++ CMD2_ANY_LIST ("group.insert", bind(&group_insert, STD_PLACEHOLDERS::_2));
+ }
diff --git a/net/rtorrent/patches/patch-src_command__network.cc b/net/rtorrent/patches/patch-src_command__network.cc
new file mode 100644
index 00000000000..7a5c02472b2
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__network.cc
@@ -0,0 +1,146 @@
+$NetBSD: patch-src_command__network.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_network.cc.orig 2013-05-03 23:07:09.000000000 +0000
++++ src/command_network.cc
+@@ -62,7 +62,15 @@
+ #include "control.h"
+ #include "command_helpers.h"
+
+-namespace tr1 { using namespace std::tr1; }
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
+
+ torrent::Object
+ apply_encryption(const torrent::Object::list_type& args) {
+@@ -126,10 +134,10 @@ xmlrpc_find_peer(core::Download* downloa
+ void
+ initialize_xmlrpc() {
+ rpc::xmlrpc.initialize();
+- rpc::xmlrpc.slot_find_download() = tr1::bind(&core::DownloadList::find_hex_ptr, control->core()->download_list(), tr1::placeholders::_1);
+- rpc::xmlrpc.slot_find_file() = tr1::bind(&xmlrpc_find_file, tr1::placeholders::_1, tr1::placeholders::_2);
+- rpc::xmlrpc.slot_find_tracker() = tr1::bind(&xmlrpc_find_tracker, tr1::placeholders::_1, tr1::placeholders::_2);
+- rpc::xmlrpc.slot_find_peer() = tr1::bind(&xmlrpc_find_peer, tr1::placeholders::_1, tr1::placeholders::_2);
++ rpc::xmlrpc.slot_find_download() = bind(&core::DownloadList::find_hex_ptr, control->core()->download_list(), STD_PLACEHOLDERS::_1);
++ rpc::xmlrpc.slot_find_file() = bind(&xmlrpc_find_file, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2);
++ rpc::xmlrpc.slot_find_tracker() = bind(&xmlrpc_find_tracker, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2);
++ rpc::xmlrpc.slot_find_peer() = bind(&xmlrpc_find_peer, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2);
+
+ unsigned int count = 0;
+
+@@ -236,23 +244,23 @@ initialize_command_network() {
+ torrent::FileManager* fileManager = torrent::file_manager();
+ core::CurlStack* httpStack = control->core()->http_stack();
+
+- CMD2_ANY ("strings.connection_type", tr1::bind(&torrent::option_list_strings, torrent::OPTION_CONNECTION_TYPE));
+- CMD2_ANY ("strings.encryption", tr1::bind(&torrent::option_list_strings, torrent::OPTION_ENCRYPTION));
++ CMD2_ANY ("strings.connection_type", bind(&torrent::option_list_strings, torrent::OPTION_CONNECTION_TYPE));
++ CMD2_ANY ("strings.encryption", bind(&torrent::option_list_strings, torrent::OPTION_ENCRYPTION));
+
+ CMD2_VAR_BOOL ("log.handshake", false);
+
+- // CMD2_ANY_STRING ("encoding_list", tr1::bind(&apply_encoding_list, tr1::placeholders::_2));
+- CMD2_ANY_STRING ("encoding.add", tr1::bind(&apply_encoding_list, tr1::placeholders::_2));
++ // CMD2_ANY_STRING ("encoding_list", bind(&apply_encoding_list, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_STRING ("encoding.add", bind(&apply_encoding_list, STD_PLACEHOLDERS::_2));
+
+ // Isn't port_open used?
+ CMD2_VAR_BOOL ("network.port_open", true);
+ CMD2_VAR_BOOL ("network.port_random", true);
+ CMD2_VAR_STRING ("network.port_range", "6881-6999");
+
+- CMD2_ANY ("network.listen.port", tr1::bind(&torrent::ConnectionManager::listen_port, cm));
++ CMD2_ANY ("network.listen.port", bind(&torrent::ConnectionManager::listen_port, cm));
+
+ CMD2_VAR_BOOL ("protocol.pex", true);
+- CMD2_ANY_LIST ("protocol.encryption.set", tr1::bind(&apply_encryption, tr1::placeholders::_2));
++ CMD2_ANY_LIST ("protocol.encryption.set", bind(&apply_encryption, STD_PLACEHOLDERS::_2));
+
+ CMD2_VAR_STRING ("protocol.connection.leech", "leech");
+ CMD2_VAR_STRING ("protocol.connection.seed", "seed");
+@@ -262,43 +270,43 @@ initialize_command_network() {
+ CMD2_VAR_STRING ("protocol.choke_heuristics.down.leech", "download_leech");
+ CMD2_VAR_STRING ("protocol.choke_heuristics.down.seed", "download_leech");
+
+- CMD2_ANY ("network.http.capath", tr1::bind(&core::CurlStack::http_capath, httpStack));
+- CMD2_ANY_STRING_V("network.http.capath.set", tr1::bind(&core::CurlStack::set_http_capath, httpStack, tr1::placeholders::_2));
+- CMD2_ANY ("network.http.cacert", tr1::bind(&core::CurlStack::http_cacert, httpStack));
+- CMD2_ANY_STRING_V("network.http.cacert.set", tr1::bind(&core::CurlStack::set_http_cacert, httpStack, tr1::placeholders::_2));
+- CMD2_ANY ("network.http.proxy_address", tr1::bind(&core::CurlStack::http_proxy, httpStack));
+- CMD2_ANY_STRING_V("network.http.proxy_address.set", tr1::bind(&core::CurlStack::set_http_proxy, httpStack, tr1::placeholders::_2));
+- CMD2_ANY ("network.http.max_open", tr1::bind(&core::CurlStack::max_active, httpStack));
+- CMD2_ANY_VALUE_V ("network.http.max_open.set", tr1::bind(&core::CurlStack::set_max_active, httpStack, tr1::placeholders::_2));
+- CMD2_ANY ("network.http.ssl_verify_peer", tr1::bind(&core::CurlStack::ssl_verify_peer, httpStack));
+- CMD2_ANY_VALUE_V ("network.http.ssl_verify_peer.set", tr1::bind(&core::CurlStack::set_ssl_verify_peer, httpStack, tr1::placeholders::_2));
+- CMD2_ANY ("network.http.dns_cache_timeout", tr1::bind(&core::CurlStack::dns_timeout, httpStack));
+- CMD2_ANY_VALUE_V ("network.http.dns_cache_timeout.set", tr1::bind(&core::CurlStack::set_dns_timeout, httpStack, tr1::placeholders::_2));
+-
+- CMD2_ANY ("network.send_buffer.size", tr1::bind(&torrent::ConnectionManager::send_buffer_size, cm));
+- CMD2_ANY_VALUE_V ("network.send_buffer.size.set", tr1::bind(&torrent::ConnectionManager::set_send_buffer_size, cm, tr1::placeholders::_2));
+- CMD2_ANY ("network.receive_buffer.size", tr1::bind(&torrent::ConnectionManager::receive_buffer_size, cm));
+- CMD2_ANY_VALUE_V ("network.receive_buffer.size.set", tr1::bind(&torrent::ConnectionManager::set_receive_buffer_size, cm, tr1::placeholders::_2));
+- CMD2_ANY_STRING ("network.tos.set", tr1::bind(&apply_tos, tr1::placeholders::_2));
+-
+- CMD2_ANY ("network.bind_address", tr1::bind(&core::Manager::bind_address, control->core()));
+- CMD2_ANY_STRING_V("network.bind_address.set", tr1::bind(&core::Manager::set_bind_address, control->core(), tr1::placeholders::_2));
+- CMD2_ANY ("network.local_address", tr1::bind(&core::Manager::local_address, control->core()));
+- CMD2_ANY_STRING_V("network.local_address.set", tr1::bind(&core::Manager::set_local_address, control->core(), tr1::placeholders::_2));
+- CMD2_ANY ("network.proxy_address", tr1::bind(&core::Manager::proxy_address, control->core()));
+- CMD2_ANY_STRING_V("network.proxy_address.set", tr1::bind(&core::Manager::set_proxy_address, control->core(), tr1::placeholders::_2));
+-
+- CMD2_ANY ("network.max_open_files", tr1::bind(&torrent::FileManager::max_open_files, fileManager));
+- CMD2_ANY_VALUE_V ("network.max_open_files.set", tr1::bind(&torrent::FileManager::set_max_open_files, fileManager, tr1::placeholders::_2));
+- CMD2_ANY ("network.open_sockets", tr1::bind(&torrent::ConnectionManager::size, cm));
+- CMD2_ANY ("network.max_open_sockets", tr1::bind(&torrent::ConnectionManager::max_size, cm));
+- CMD2_ANY_VALUE_V ("network.max_open_sockets.set", tr1::bind(&torrent::ConnectionManager::set_max_size, cm, tr1::placeholders::_2));
++ CMD2_ANY ("network.http.capath", bind(&core::CurlStack::http_capath, httpStack));
++ CMD2_ANY_STRING_V("network.http.capath.set", bind(&core::CurlStack::set_http_capath, httpStack, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("network.http.cacert", bind(&core::CurlStack::http_cacert, httpStack));
++ CMD2_ANY_STRING_V("network.http.cacert.set", bind(&core::CurlStack::set_http_cacert, httpStack, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("network.http.proxy_address", bind(&core::CurlStack::http_proxy, httpStack));
++ CMD2_ANY_STRING_V("network.http.proxy_address.set", bind(&core::CurlStack::set_http_proxy, httpStack, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("network.http.max_open", bind(&core::CurlStack::max_active, httpStack));
++ CMD2_ANY_VALUE_V ("network.http.max_open.set", bind(&core::CurlStack::set_max_active, httpStack, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("network.http.ssl_verify_peer", bind(&core::CurlStack::ssl_verify_peer, httpStack));
++ CMD2_ANY_VALUE_V ("network.http.ssl_verify_peer.set", bind(&core::CurlStack::set_ssl_verify_peer, httpStack, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("network.http.dns_cache_timeout", bind(&core::CurlStack::dns_timeout, httpStack));
++ CMD2_ANY_VALUE_V ("network.http.dns_cache_timeout.set", bind(&core::CurlStack::set_dns_timeout, httpStack, STD_PLACEHOLDERS::_2));
++
++ CMD2_ANY ("network.send_buffer.size", bind(&torrent::ConnectionManager::send_buffer_size, cm));
++ CMD2_ANY_VALUE_V ("network.send_buffer.size.set", bind(&torrent::ConnectionManager::set_send_buffer_size, cm, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("network.receive_buffer.size", bind(&torrent::ConnectionManager::receive_buffer_size, cm));
++ CMD2_ANY_VALUE_V ("network.receive_buffer.size.set", bind(&torrent::ConnectionManager::set_receive_buffer_size, cm, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_STRING ("network.tos.set", bind(&apply_tos, STD_PLACEHOLDERS::_2));
++
++ CMD2_ANY ("network.bind_address", bind(&core::Manager::bind_address, control->core()));
++ CMD2_ANY_STRING_V("network.bind_address.set", bind(&core::Manager::set_bind_address, control->core(), STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("network.local_address", bind(&core::Manager::local_address, control->core()));
++ CMD2_ANY_STRING_V("network.local_address.set", bind(&core::Manager::set_local_address, control->core(), STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("network.proxy_address", bind(&core::Manager::proxy_address, control->core()));
++ CMD2_ANY_STRING_V("network.proxy_address.set", bind(&core::Manager::set_proxy_address, control->core(), STD_PLACEHOLDERS::_2));
++
++ CMD2_ANY ("network.max_open_files", bind(&torrent::FileManager::max_open_files, fileManager));
++ CMD2_ANY_VALUE_V ("network.max_open_files.set", bind(&torrent::FileManager::set_max_open_files, fileManager, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("network.open_sockets", bind(&torrent::ConnectionManager::size, cm));
++ CMD2_ANY ("network.max_open_sockets", bind(&torrent::ConnectionManager::max_size, cm));
++ CMD2_ANY_VALUE_V ("network.max_open_sockets.set", bind(&torrent::ConnectionManager::set_max_size, cm, STD_PLACEHOLDERS::_2));
+
+- CMD2_ANY_STRING ("network.scgi.open_port", tr1::bind(&apply_scgi, tr1::placeholders::_2, 1));
+- CMD2_ANY_STRING ("network.scgi.open_local", tr1::bind(&apply_scgi, tr1::placeholders::_2, 2));
++ CMD2_ANY_STRING ("network.scgi.open_port", bind(&apply_scgi, STD_PLACEHOLDERS::_2, 1));
++ CMD2_ANY_STRING ("network.scgi.open_local", bind(&apply_scgi, STD_PLACEHOLDERS::_2, 2));
+ CMD2_VAR_BOOL ("network.scgi.dont_route", false);
+
+- CMD2_ANY_STRING ("network.xmlrpc.dialect.set", tr1::bind(&apply_xmlrpc_dialect, tr1::placeholders::_2));
+- CMD2_ANY ("network.xmlrpc.size_limit", tr1::bind(&rpc::XmlRpc::size_limit));
+- CMD2_ANY_VALUE_V ("network.xmlrpc.size_limit.set", tr1::bind(&rpc::XmlRpc::set_size_limit, tr1::placeholders::_2));
++ CMD2_ANY_STRING ("network.xmlrpc.dialect.set", bind(&apply_xmlrpc_dialect, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("network.xmlrpc.size_limit", bind(&rpc::XmlRpc::size_limit));
++ CMD2_ANY_VALUE_V ("network.xmlrpc.size_limit.set", bind(&rpc::XmlRpc::set_size_limit, STD_PLACEHOLDERS::_2));
+ }
diff --git a/net/rtorrent/patches/patch-src_command__peer.cc b/net/rtorrent/patches/patch-src_command__peer.cc
new file mode 100644
index 00000000000..1a0f3f8664a
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__peer.cc
@@ -0,0 +1,91 @@
+$NetBSD: patch-src_command__peer.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_peer.cc.orig 2013-05-03 23:06:44.000000000 +0000
++++ src/command_peer.cc
+@@ -53,6 +53,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ torrent::Object
+ retrieve_p_id(torrent::Peer* peer) {
+ const torrent::HashString* hashString = &peer->id();
+@@ -97,37 +107,37 @@ retrieve_p_completed_percent(torrent::Pe
+
+ void
+ initialize_command_peer() {
+- CMD2_PEER("p.id", tr1::bind(&retrieve_p_id, tr1::placeholders::_1));
+- CMD2_PEER("p.id_html", tr1::bind(&retrieve_p_id_html, tr1::placeholders::_1));
+- CMD2_PEER("p.client_version", tr1::bind(&retrieve_p_client_version, tr1::placeholders::_1));
+-
+- CMD2_PEER("p.options_str", tr1::bind(&retrieve_p_options_str, tr1::placeholders::_1));
+-
+- CMD2_PEER("p.is_encrypted", tr1::bind(&torrent::Peer::is_encrypted, tr1::placeholders::_1));
+- CMD2_PEER("p.is_incoming", tr1::bind(&torrent::Peer::is_incoming, tr1::placeholders::_1));
+- CMD2_PEER("p.is_obfuscated", tr1::bind(&torrent::Peer::is_obfuscated, tr1::placeholders::_1));
+- CMD2_PEER("p.is_snubbed", tr1::bind(&torrent::Peer::is_snubbed, tr1::placeholders::_1));
+-
+- CMD2_PEER("p.is_unwanted", tr1::bind(&torrent::PeerInfo::is_unwanted, tr1::bind(&torrent::Peer::peer_info, tr1::placeholders::_1)));
+- CMD2_PEER("p.is_preferred", tr1::bind(&torrent::PeerInfo::is_preferred, tr1::bind(&torrent::Peer::peer_info, tr1::placeholders::_1)));
+-
+- CMD2_PEER("p.address", tr1::bind(&retrieve_p_address, tr1::placeholders::_1));
+- CMD2_PEER("p.port", tr1::bind(&retrieve_p_port, tr1::placeholders::_1));
+-
+- CMD2_PEER("p.completed_percent", tr1::bind(&retrieve_p_completed_percent, tr1::placeholders::_1));
+-
+- CMD2_PEER("p.up_rate", tr1::bind(&torrent::Rate::rate, tr1::bind(&torrent::Peer::up_rate, tr1::placeholders::_1)));
+- CMD2_PEER("p.up_total", tr1::bind(&torrent::Rate::total, tr1::bind(&torrent::Peer::up_rate, tr1::placeholders::_1)));
+- CMD2_PEER("p.down_rate", tr1::bind(&torrent::Rate::rate, tr1::bind(&torrent::Peer::down_rate, tr1::placeholders::_1)));
+- CMD2_PEER("p.down_total", tr1::bind(&torrent::Rate::total, tr1::bind(&torrent::Peer::down_rate, tr1::placeholders::_1)));
+- CMD2_PEER("p.peer_rate", tr1::bind(&torrent::Rate::rate, tr1::bind(&torrent::Peer::peer_rate, tr1::placeholders::_1)));
+- CMD2_PEER("p.peer_total", tr1::bind(&torrent::Rate::total, tr1::bind(&torrent::Peer::peer_rate, tr1::placeholders::_1)));
+-
+- CMD2_PEER ("p.snubbed", tr1::bind(&torrent::Peer::is_snubbed, tr1::placeholders::_1));
+- CMD2_PEER_VALUE_V("p.snubbed.set", tr1::bind(&torrent::Peer::set_snubbed, tr1::placeholders::_1, tr1::placeholders::_2));
+- CMD2_PEER ("p.banned", tr1::bind(&torrent::Peer::is_banned, tr1::placeholders::_1));
+- CMD2_PEER_VALUE_V("p.banned.set", tr1::bind(&torrent::Peer::set_banned, tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_PEER("p.id", bind(&retrieve_p_id, STD_PLACEHOLDERS::_1));
++ CMD2_PEER("p.id_html", bind(&retrieve_p_id_html, STD_PLACEHOLDERS::_1));
++ CMD2_PEER("p.client_version", bind(&retrieve_p_client_version, STD_PLACEHOLDERS::_1));
++
++ CMD2_PEER("p.options_str", bind(&retrieve_p_options_str, STD_PLACEHOLDERS::_1));
++
++ CMD2_PEER("p.is_encrypted", bind(&torrent::Peer::is_encrypted, STD_PLACEHOLDERS::_1));
++ CMD2_PEER("p.is_incoming", bind(&torrent::Peer::is_incoming, STD_PLACEHOLDERS::_1));
++ CMD2_PEER("p.is_obfuscated", bind(&torrent::Peer::is_obfuscated, STD_PLACEHOLDERS::_1));
++ CMD2_PEER("p.is_snubbed", bind(&torrent::Peer::is_snubbed, STD_PLACEHOLDERS::_1));
++
++ CMD2_PEER("p.is_unwanted", bind(&torrent::PeerInfo::is_unwanted, bind(&torrent::Peer::peer_info, STD_PLACEHOLDERS::_1)));
++ CMD2_PEER("p.is_preferred", bind(&torrent::PeerInfo::is_preferred, bind(&torrent::Peer::peer_info, STD_PLACEHOLDERS::_1)));
++
++ CMD2_PEER("p.address", bind(&retrieve_p_address, STD_PLACEHOLDERS::_1));
++ CMD2_PEER("p.port", bind(&retrieve_p_port, STD_PLACEHOLDERS::_1));
++
++ CMD2_PEER("p.completed_percent", bind(&retrieve_p_completed_percent, STD_PLACEHOLDERS::_1));
++
++ CMD2_PEER("p.up_rate", bind(&torrent::Rate::rate, bind(&torrent::Peer::up_rate, STD_PLACEHOLDERS::_1)));
++ CMD2_PEER("p.up_total", bind(&torrent::Rate::total, bind(&torrent::Peer::up_rate, STD_PLACEHOLDERS::_1)));
++ CMD2_PEER("p.down_rate", bind(&torrent::Rate::rate, bind(&torrent::Peer::down_rate, STD_PLACEHOLDERS::_1)));
++ CMD2_PEER("p.down_total", bind(&torrent::Rate::total, bind(&torrent::Peer::down_rate, STD_PLACEHOLDERS::_1)));
++ CMD2_PEER("p.peer_rate", bind(&torrent::Rate::rate, bind(&torrent::Peer::peer_rate, STD_PLACEHOLDERS::_1)));
++ CMD2_PEER("p.peer_total", bind(&torrent::Rate::total, bind(&torrent::Peer::peer_rate, STD_PLACEHOLDERS::_1)));
++
++ CMD2_PEER ("p.snubbed", bind(&torrent::Peer::is_snubbed, STD_PLACEHOLDERS::_1));
++ CMD2_PEER_VALUE_V("p.snubbed.set", bind(&torrent::Peer::set_snubbed, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
++ CMD2_PEER ("p.banned", bind(&torrent::Peer::is_banned, STD_PLACEHOLDERS::_1));
++ CMD2_PEER_VALUE_V("p.banned.set", bind(&torrent::Peer::set_banned, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+
+- CMD2_PEER_V("p.disconnect", tr1::bind(&torrent::Peer::disconnect, tr1::placeholders::_1, 0));
+- CMD2_PEER_V("p.disconnect_delayed", tr1::bind(&torrent::Peer::disconnect, tr1::placeholders::_1, torrent::ConnectionList::disconnect_delayed));
++ CMD2_PEER_V("p.disconnect", bind(&torrent::Peer::disconnect, STD_PLACEHOLDERS::_1, 0));
++ CMD2_PEER_V("p.disconnect_delayed", bind(&torrent::Peer::disconnect, STD_PLACEHOLDERS::_1, torrent::ConnectionList::disconnect_delayed));
+ }
diff --git a/net/rtorrent/patches/patch-src_command__scheduler.cc b/net/rtorrent/patches/patch-src_command__scheduler.cc
new file mode 100644
index 00000000000..1b80b17cbd8
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__scheduler.cc
@@ -0,0 +1,32 @@
+$NetBSD: patch-src_command__scheduler.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_scheduler.cc.orig 2012-03-20 16:25:05.000000000 +0000
++++ src/command_scheduler.cc
+@@ -48,6 +48,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ torrent::Object
+ cmd_scheduler_simple_added(core::Download* download) {
+ unsigned int numActive = (*control->view_manager()->find("active"))->size_visible();
+@@ -115,7 +125,7 @@ void
+ initialize_command_scheduler() {
+ CMD2_VAR_VALUE("scheduler.max_active", int64_t(-1));
+
+- CMD2_DL("scheduler.simple.added", tr1::bind(&cmd_scheduler_simple_added, tr1::placeholders::_1));
+- CMD2_DL("scheduler.simple.removed", tr1::bind(&cmd_scheduler_simple_removed, tr1::placeholders::_1));
+- CMD2_DL("scheduler.simple.update", tr1::bind(&cmd_scheduler_simple_update, tr1::placeholders::_1));
++ CMD2_DL("scheduler.simple.added", bind(&cmd_scheduler_simple_added, STD_PLACEHOLDERS::_1));
++ CMD2_DL("scheduler.simple.removed", bind(&cmd_scheduler_simple_removed, STD_PLACEHOLDERS::_1));
++ CMD2_DL("scheduler.simple.update", bind(&cmd_scheduler_simple_update, STD_PLACEHOLDERS::_1));
+ }
diff --git a/net/rtorrent/patches/patch-src_command__throttle.cc b/net/rtorrent/patches/patch-src_command__throttle.cc
new file mode 100644
index 00000000000..4aedbd67999
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__throttle.cc
@@ -0,0 +1,86 @@
+$NetBSD: patch-src_command__throttle.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_throttle.cc.orig 2013-05-03 23:08:41.000000000 +0000
++++ src/command_throttle.cc
+@@ -51,6 +51,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ std::pair<uint32_t, uint32_t>
+ parse_address_range(const torrent::Object::list_type& args, torrent::Object::list_type::const_iterator itr) {
+ unsigned int prefixWidth, ret;
+@@ -173,8 +183,8 @@ throttle_update(const char* variable, in
+
+ void
+ initialize_command_throttle() {
+- CMD2_ANY ("throttle.unchoked_uploads", tr1::bind(&torrent::ResourceManager::currently_upload_unchoked, torrent::resource_manager()));
+- CMD2_ANY ("throttle.unchoked_downloads", tr1::bind(&torrent::ResourceManager::currently_download_unchoked, torrent::resource_manager()));
++ CMD2_ANY ("throttle.unchoked_uploads", bind(&torrent::ResourceManager::currently_upload_unchoked, torrent::resource_manager()));
++ CMD2_ANY ("throttle.unchoked_downloads", bind(&torrent::ResourceManager::currently_download_unchoked, torrent::resource_manager()));
+
+ CMD2_VAR_VALUE ("throttle.min_peers.normal", 100);
+ CMD2_VAR_VALUE ("throttle.max_peers.normal", 200);
+@@ -196,31 +206,31 @@ initialize_command_throttle() {
+ CMD2_REDIRECT_GENERIC("throttle.max_downloads.div", "throttle.max_downloads.div._val");
+ CMD2_REDIRECT_GENERIC("throttle.max_downloads.global", "throttle.max_downloads.global._val");
+
+- CMD2_ANY_VALUE ("throttle.max_uploads.div.set", tr1::bind(&throttle_update, "throttle.max_uploads.div._val.set", tr1::placeholders::_2));
+- CMD2_ANY_VALUE ("throttle.max_uploads.global.set", tr1::bind(&throttle_update, "throttle.max_uploads.global._val.set", tr1::placeholders::_2));
+- CMD2_ANY_VALUE ("throttle.max_downloads.div.set", tr1::bind(&throttle_update, "throttle.max_downloads.div._val.set", tr1::placeholders::_2));
+- CMD2_ANY_VALUE ("throttle.max_downloads.global.set", tr1::bind(&throttle_update, "throttle.max_downloads.global._val.set", tr1::placeholders::_2));
++ CMD2_ANY_VALUE ("throttle.max_uploads.div.set", bind(&throttle_update, "throttle.max_uploads.div._val.set", STD_PLACEHOLDERS::_2));
++ CMD2_ANY_VALUE ("throttle.max_uploads.global.set", bind(&throttle_update, "throttle.max_uploads.global._val.set", STD_PLACEHOLDERS::_2));
++ CMD2_ANY_VALUE ("throttle.max_downloads.div.set", bind(&throttle_update, "throttle.max_downloads.div._val.set", STD_PLACEHOLDERS::_2));
++ CMD2_ANY_VALUE ("throttle.max_downloads.global.set", bind(&throttle_update, "throttle.max_downloads.global._val.set", STD_PLACEHOLDERS::_2));
+
+ // TODO: Move the logic into some libtorrent function.
+- CMD2_ANY ("throttle.global_up.rate", tr1::bind(&torrent::Rate::rate, torrent::up_rate()));
+- CMD2_ANY ("throttle.global_up.total", tr1::bind(&torrent::Rate::total, torrent::up_rate()));
+- CMD2_ANY ("throttle.global_up.max_rate", tr1::bind(&torrent::Throttle::max_rate, torrent::up_throttle_global()));
+- CMD2_ANY_VALUE_V ("throttle.global_up.max_rate.set", tr1::bind(&ui::Root::set_up_throttle_i64, control->ui(), tr1::placeholders::_2));
+- CMD2_ANY_VALUE_KB("throttle.global_up.max_rate.set_kb", tr1::bind(&ui::Root::set_up_throttle_i64, control->ui(), tr1::placeholders::_2));
+- CMD2_ANY ("throttle.global_down.rate", tr1::bind(&torrent::Rate::rate, torrent::down_rate()));
+- CMD2_ANY ("throttle.global_down.total", tr1::bind(&torrent::Rate::total, torrent::down_rate()));
+- CMD2_ANY ("throttle.global_down.max_rate", tr1::bind(&torrent::Throttle::max_rate, torrent::down_throttle_global()));
+- CMD2_ANY_VALUE_V ("throttle.global_down.max_rate.set", tr1::bind(&ui::Root::set_down_throttle_i64, control->ui(), tr1::placeholders::_2));
+- CMD2_ANY_VALUE_KB("throttle.global_down.max_rate.set_kb", tr1::bind(&ui::Root::set_down_throttle_i64, control->ui(), tr1::placeholders::_2));
++ CMD2_ANY ("throttle.global_up.rate", bind(&torrent::Rate::rate, torrent::up_rate()));
++ CMD2_ANY ("throttle.global_up.total", bind(&torrent::Rate::total, torrent::up_rate()));
++ CMD2_ANY ("throttle.global_up.max_rate", bind(&torrent::Throttle::max_rate, torrent::up_throttle_global()));
++ CMD2_ANY_VALUE_V ("throttle.global_up.max_rate.set", bind(&ui::Root::set_up_throttle_i64, control->ui(), STD_PLACEHOLDERS::_2));
++ CMD2_ANY_VALUE_KB("throttle.global_up.max_rate.set_kb", bind(&ui::Root::set_up_throttle_i64, control->ui(), STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("throttle.global_down.rate", bind(&torrent::Rate::rate, torrent::down_rate()));
++ CMD2_ANY ("throttle.global_down.total", bind(&torrent::Rate::total, torrent::down_rate()));
++ CMD2_ANY ("throttle.global_down.max_rate", bind(&torrent::Throttle::max_rate, torrent::down_throttle_global()));
++ CMD2_ANY_VALUE_V ("throttle.global_down.max_rate.set", bind(&ui::Root::set_down_throttle_i64, control->ui(), STD_PLACEHOLDERS::_2));
++ CMD2_ANY_VALUE_KB("throttle.global_down.max_rate.set_kb", bind(&ui::Root::set_down_throttle_i64, control->ui(), STD_PLACEHOLDERS::_2));
+
+ // Temporary names, need to change this to accept real rates rather
+ // than kB.
+- CMD2_ANY_LIST ("throttle.up", tr1::bind(&apply_throttle, tr1::placeholders::_2, true));
+- CMD2_ANY_LIST ("throttle.down", tr1::bind(&apply_throttle, tr1::placeholders::_2, false));
+- CMD2_ANY_LIST ("throttle.ip", tr1::bind(&apply_address_throttle, tr1::placeholders::_2));
+-
+- CMD2_ANY_STRING ("throttle.up.max", tr1::bind(&retrieve_throttle_info, tr1::placeholders::_2, throttle_info_up | throttle_info_max));
+- CMD2_ANY_STRING ("throttle.up.rate", tr1::bind(&retrieve_throttle_info, tr1::placeholders::_2, throttle_info_up | throttle_info_rate));
+- CMD2_ANY_STRING ("throttle.down.max", tr1::bind(&retrieve_throttle_info, tr1::placeholders::_2, throttle_info_down | throttle_info_max));
+- CMD2_ANY_STRING ("throttle.down.rate", tr1::bind(&retrieve_throttle_info, tr1::placeholders::_2, throttle_info_down | throttle_info_rate));
++ CMD2_ANY_LIST ("throttle.up", bind(&apply_throttle, STD_PLACEHOLDERS::_2, true));
++ CMD2_ANY_LIST ("throttle.down", bind(&apply_throttle, STD_PLACEHOLDERS::_2, false));
++ CMD2_ANY_LIST ("throttle.ip", bind(&apply_address_throttle, STD_PLACEHOLDERS::_2));
++
++ CMD2_ANY_STRING ("throttle.up.max", bind(&retrieve_throttle_info, STD_PLACEHOLDERS::_2, throttle_info_up | throttle_info_max));
++ CMD2_ANY_STRING ("throttle.up.rate", bind(&retrieve_throttle_info, STD_PLACEHOLDERS::_2, throttle_info_up | throttle_info_rate));
++ CMD2_ANY_STRING ("throttle.down.max", bind(&retrieve_throttle_info, STD_PLACEHOLDERS::_2, throttle_info_down | throttle_info_max));
++ CMD2_ANY_STRING ("throttle.down.rate", bind(&retrieve_throttle_info, STD_PLACEHOLDERS::_2, throttle_info_down | throttle_info_rate));
+ }
diff --git a/net/rtorrent/patches/patch-src_command__tracker.cc b/net/rtorrent/patches/patch-src_command__tracker.cc
new file mode 100644
index 00000000000..bc8a42ec702
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__tracker.cc
@@ -0,0 +1,123 @@
+$NetBSD: patch-src_command__tracker.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_tracker.cc.orig 2013-05-03 23:08:53.000000000 +0000
++++ src/command_tracker.cc
+@@ -51,6 +51,16 @@
+ #include "command_helpers.h"
+ #include "core/dht_manager.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ void
+ tracker_set_enabled(torrent::Tracker* tracker, bool state) {
+ if (state)
+@@ -111,59 +121,59 @@ apply_enable_trackers(int64_t arg) {
+
+ void
+ initialize_command_tracker() {
+- CMD2_TRACKER ("t.is_open", tr1::bind(&torrent::Tracker::is_busy, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.is_enabled", tr1::bind(&torrent::Tracker::is_enabled, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.is_usable", tr1::bind(&torrent::Tracker::is_usable, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.is_busy", tr1::bind(&torrent::Tracker::is_busy, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.is_extra_tracker", tr1::bind(&torrent::Tracker::is_extra_tracker, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.can_scrape", tr1::bind(&torrent::Tracker::can_scrape, tr1::placeholders::_1));
+-
+- CMD2_TRACKER_V ("t.enable", tr1::bind(&torrent::Tracker::enable, tr1::placeholders::_1));
+- CMD2_TRACKER_V ("t.disable", tr1::bind(&torrent::Tracker::disable, tr1::placeholders::_1));
+-
+- CMD2_TRACKER_VALUE_V("t.is_enabled.set", tr1::bind(&tracker_set_enabled, tr1::placeholders::_1, tr1::placeholders::_2));
+-
+- CMD2_TRACKER ("t.url", tr1::bind(&torrent::Tracker::url, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.group", tr1::bind(&torrent::Tracker::group, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.type", tr1::bind(&torrent::Tracker::type, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.id", tr1::bind(&torrent::Tracker::tracker_id, tr1::placeholders::_1));
+-
+- CMD2_TRACKER ("t.latest_event", tr1::bind(&torrent::Tracker::latest_event, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.latest_new_peers", tr1::bind(&torrent::Tracker::latest_new_peers, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.latest_sum_peers", tr1::bind(&torrent::Tracker::latest_sum_peers, tr1::placeholders::_1));
++ CMD2_TRACKER ("t.is_open", bind(&torrent::Tracker::is_busy, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.is_enabled", bind(&torrent::Tracker::is_enabled, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.is_usable", bind(&torrent::Tracker::is_usable, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.is_busy", bind(&torrent::Tracker::is_busy, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.is_extra_tracker", bind(&torrent::Tracker::is_extra_tracker, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.can_scrape", bind(&torrent::Tracker::can_scrape, STD_PLACEHOLDERS::_1));
++
++ CMD2_TRACKER_V ("t.enable", bind(&torrent::Tracker::enable, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER_V ("t.disable", bind(&torrent::Tracker::disable, STD_PLACEHOLDERS::_1));
++
++ CMD2_TRACKER_VALUE_V("t.is_enabled.set", bind(&tracker_set_enabled, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
++
++ CMD2_TRACKER ("t.url", bind(&torrent::Tracker::url, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.group", bind(&torrent::Tracker::group, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.type", bind(&torrent::Tracker::type, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.id", bind(&torrent::Tracker::tracker_id, STD_PLACEHOLDERS::_1));
++
++ CMD2_TRACKER ("t.latest_event", bind(&torrent::Tracker::latest_event, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.latest_new_peers", bind(&torrent::Tracker::latest_new_peers, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.latest_sum_peers", bind(&torrent::Tracker::latest_sum_peers, STD_PLACEHOLDERS::_1));
+
+ // Time since last connection, connection attempt.
+
+- CMD2_TRACKER ("t.normal_interval", tr1::bind(&torrent::Tracker::normal_interval, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.min_interval", tr1::bind(&torrent::Tracker::min_interval, tr1::placeholders::_1));
++ CMD2_TRACKER ("t.normal_interval", bind(&torrent::Tracker::normal_interval, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.min_interval", bind(&torrent::Tracker::min_interval, STD_PLACEHOLDERS::_1));
+
+- CMD2_TRACKER ("t.activity_time_next", tr1::bind(&torrent::Tracker::activity_time_next, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.activity_time_last", tr1::bind(&torrent::Tracker::activity_time_last, tr1::placeholders::_1));
++ CMD2_TRACKER ("t.activity_time_next", bind(&torrent::Tracker::activity_time_next, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.activity_time_last", bind(&torrent::Tracker::activity_time_last, STD_PLACEHOLDERS::_1));
+
+- CMD2_TRACKER ("t.success_time_next", tr1::bind(&torrent::Tracker::success_time_next, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.success_time_last", tr1::bind(&torrent::Tracker::success_time_last, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.success_counter", tr1::bind(&torrent::Tracker::success_counter, tr1::placeholders::_1));
++ CMD2_TRACKER ("t.success_time_next", bind(&torrent::Tracker::success_time_next, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.success_time_last", bind(&torrent::Tracker::success_time_last, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.success_counter", bind(&torrent::Tracker::success_counter, STD_PLACEHOLDERS::_1));
+
+- CMD2_TRACKER ("t.failed_time_next", tr1::bind(&torrent::Tracker::failed_time_next, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.failed_time_last", tr1::bind(&torrent::Tracker::failed_time_last, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.failed_counter", tr1::bind(&torrent::Tracker::failed_counter, tr1::placeholders::_1));
++ CMD2_TRACKER ("t.failed_time_next", bind(&torrent::Tracker::failed_time_next, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.failed_time_last", bind(&torrent::Tracker::failed_time_last, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.failed_counter", bind(&torrent::Tracker::failed_counter, STD_PLACEHOLDERS::_1));
+
+- CMD2_TRACKER ("t.scrape_time_last", tr1::bind(&torrent::Tracker::scrape_time_last, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.scrape_counter", tr1::bind(&torrent::Tracker::scrape_counter, tr1::placeholders::_1));
++ CMD2_TRACKER ("t.scrape_time_last", bind(&torrent::Tracker::scrape_time_last, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.scrape_counter", bind(&torrent::Tracker::scrape_counter, STD_PLACEHOLDERS::_1));
+
+- CMD2_TRACKER ("t.scrape_complete", tr1::bind(&torrent::Tracker::scrape_complete, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.scrape_incomplete", tr1::bind(&torrent::Tracker::scrape_incomplete, tr1::placeholders::_1));
+- CMD2_TRACKER ("t.scrape_downloaded", tr1::bind(&torrent::Tracker::scrape_downloaded, tr1::placeholders::_1));
++ CMD2_TRACKER ("t.scrape_complete", bind(&torrent::Tracker::scrape_complete, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.scrape_incomplete", bind(&torrent::Tracker::scrape_incomplete, STD_PLACEHOLDERS::_1));
++ CMD2_TRACKER ("t.scrape_downloaded", bind(&torrent::Tracker::scrape_downloaded, STD_PLACEHOLDERS::_1));
+
+- CMD2_ANY_VALUE ("trackers.enable", tr1::bind(&apply_enable_trackers, int64_t(1)));
+- CMD2_ANY_VALUE ("trackers.disable", tr1::bind(&apply_enable_trackers, int64_t(0)));
++ CMD2_ANY_VALUE ("trackers.enable", bind(&apply_enable_trackers, int64_t(1)));
++ CMD2_ANY_VALUE ("trackers.disable", bind(&apply_enable_trackers, int64_t(0)));
+ CMD2_VAR_VALUE ("trackers.numwant", -1);
+ CMD2_VAR_BOOL ("trackers.use_udp", true);
+
+- CMD2_ANY_STRING_V ("dht.mode.set", tr1::bind(&core::DhtManager::set_mode, control->dht_manager(), tr1::placeholders::_2));
++ CMD2_ANY_STRING_V ("dht.mode.set", bind(&core::DhtManager::set_mode, control->dht_manager(), STD_PLACEHOLDERS::_2));
+ CMD2_VAR_VALUE ("dht.port", int64_t(6881));
+- CMD2_ANY_STRING ("dht.add_node", tr1::bind(&apply_dht_add_node, tr1::placeholders::_2));
+- CMD2_ANY ("dht.statistics", tr1::bind(&core::DhtManager::dht_statistics, control->dht_manager()));
+- CMD2_ANY ("dht.throttle.name", tr1::bind(&core::DhtManager::throttle_name, control->dht_manager()));
+- CMD2_ANY_STRING_V ("dht.throttle.name.set", tr1::bind(&core::DhtManager::set_throttle_name, control->dht_manager(), tr1::placeholders::_2));
++ CMD2_ANY_STRING ("dht.add_node", bind(&apply_dht_add_node, STD_PLACEHOLDERS::_2));
++ CMD2_ANY ("dht.statistics", bind(&core::DhtManager::dht_statistics, control->dht_manager()));
++ CMD2_ANY ("dht.throttle.name", bind(&core::DhtManager::throttle_name, control->dht_manager()));
++ CMD2_ANY_STRING_V ("dht.throttle.name.set", bind(&core::DhtManager::set_throttle_name, control->dht_manager(), STD_PLACEHOLDERS::_2));
+ }
diff --git a/net/rtorrent/patches/patch-src_command__ui.cc b/net/rtorrent/patches/patch-src_command__ui.cc
new file mode 100644
index 00000000000..c027e593a97
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_command__ui.cc
@@ -0,0 +1,120 @@
+$NetBSD: patch-src_command__ui.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/command_ui.cc.orig 2013-05-03 23:09:03.000000000 +0000
++++ src/command_ui.cc
+@@ -53,6 +53,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ typedef void (core::ViewManager::*view_cfilter_slot)(const std::string&, const torrent::Object&);
+ typedef void (core::ViewManager::*view_event_slot)(const std::string&, const std::string&);
+
+@@ -541,41 +551,41 @@ void
+ initialize_command_ui() {
+ CMD2_VAR_STRING("keys.layout", "qwerty");
+
+- CMD2_ANY_STRING("view.add", object_convert_void(tr1::bind(&core::ViewManager::insert_throw, control->view_manager(), tr1::placeholders::_2)));
++ CMD2_ANY_STRING("view.add", object_convert_void(bind(&core::ViewManager::insert_throw, control->view_manager(), STD_PLACEHOLDERS::_2)));
+
+- CMD2_ANY_L ("view.list", tr1::bind(&apply_view_list));
+- CMD2_ANY_LIST("view.set", tr1::bind(&apply_view_set, tr1::placeholders::_2));
++ CMD2_ANY_L ("view.list", bind(&apply_view_list));
++ CMD2_ANY_LIST("view.set", bind(&apply_view_set, STD_PLACEHOLDERS::_2));
+
+- CMD2_ANY_LIST("view.filter", tr1::bind(&apply_view_cfilter, &core::ViewManager::set_filter, tr1::placeholders::_2));
+- CMD2_ANY_LIST("view.filter_on", tr1::bind(&apply_view_filter_on, tr1::placeholders::_2));
++ CMD2_ANY_LIST("view.filter", bind(&apply_view_cfilter, &core::ViewManager::set_filter, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST("view.filter_on", bind(&apply_view_filter_on, STD_PLACEHOLDERS::_2));
+
+- CMD2_ANY_LIST("view.sort", tr1::bind(&apply_view_sort, tr1::placeholders::_2));
+- CMD2_ANY_LIST("view.sort_new", tr1::bind(&apply_view_cfilter, &core::ViewManager::set_sort_new, tr1::placeholders::_2));
+- CMD2_ANY_LIST("view.sort_current", tr1::bind(&apply_view_cfilter, &core::ViewManager::set_sort_current, tr1::placeholders::_2));
++ CMD2_ANY_LIST("view.sort", bind(&apply_view_sort, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST("view.sort_new", bind(&apply_view_cfilter, &core::ViewManager::set_sort_new, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST("view.sort_current", bind(&apply_view_cfilter, &core::ViewManager::set_sort_current, STD_PLACEHOLDERS::_2));
+
+- CMD2_ANY_LIST("view.event_added", tr1::bind(&apply_view_event, &core::ViewManager::set_event_added, tr1::placeholders::_2));
+- CMD2_ANY_LIST("view.event_removed", tr1::bind(&apply_view_event, &core::ViewManager::set_event_removed, tr1::placeholders::_2));
++ CMD2_ANY_LIST("view.event_added", bind(&apply_view_event, &core::ViewManager::set_event_added, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST("view.event_removed", bind(&apply_view_event, &core::ViewManager::set_event_removed, STD_PLACEHOLDERS::_2));
+
+ // Cleanup and add . to view.
+
+- CMD2_ANY_STRING("view.size", tr1::bind(&cmd_view_size, tr1::placeholders::_2));
+- CMD2_ANY_STRING("view.size_not_visible", tr1::bind(&cmd_view_size_not_visible, tr1::placeholders::_2));
+- CMD2_ANY_STRING("view.persistent", tr1::bind(&cmd_view_persistent, tr1::placeholders::_2));
+-
+- CMD2_ANY_STRING_V("view.filter_all", tr1::bind(&core::View::filter, tr1::bind(&core::ViewManager::find_ptr_throw, control->view_manager(), tr1::placeholders::_2)));
+-
+- CMD2_DL_STRING ("view.filter_download", tr1::bind(&cmd_view_filter_download, tr1::placeholders::_1, tr1::placeholders::_2));
+- CMD2_DL_STRING ("view.set_visible", tr1::bind(&cmd_view_set_visible, tr1::placeholders::_1, tr1::placeholders::_2));
+- CMD2_DL_STRING ("view.set_not_visible", tr1::bind(&cmd_view_set_not_visible, tr1::placeholders::_1, tr1::placeholders::_2));
++ CMD2_ANY_STRING("view.size", bind(&cmd_view_size, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_STRING("view.size_not_visible", bind(&cmd_view_size_not_visible, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_STRING("view.persistent", bind(&cmd_view_persistent, STD_PLACEHOLDERS::_2));
++
++ CMD2_ANY_STRING_V("view.filter_all", bind(&core::View::filter, bind(&core::ViewManager::find_ptr_throw, control->view_manager(), STD_PLACEHOLDERS::_2)));
++
++ CMD2_DL_STRING ("view.filter_download", bind(&cmd_view_filter_download, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
++ CMD2_DL_STRING ("view.set_visible", bind(&cmd_view_set_visible, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
++ CMD2_DL_STRING ("view.set_not_visible", bind(&cmd_view_set_not_visible, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+
+ // Commands that affect the default rtorrent UI.
+- CMD2_DL ("ui.unfocus_download", tr1::bind(&cmd_ui_unfocus_download, tr1::placeholders::_1));
+- CMD2_ANY_STRING("ui.current_view.set", tr1::bind(&cmd_ui_set_view, tr1::placeholders::_2));
++ CMD2_DL ("ui.unfocus_download", bind(&cmd_ui_unfocus_download, STD_PLACEHOLDERS::_1));
++ CMD2_ANY_STRING("ui.current_view.set", bind(&cmd_ui_set_view, STD_PLACEHOLDERS::_2));
+
+ // Move.
+ CMD2_ANY("print", &apply_print);
+ CMD2_ANY("cat", &apply_cat);
+- CMD2_ANY("if", tr1::bind(&apply_if, tr1::placeholders::_1, tr1::placeholders::_2, 0));
++ CMD2_ANY("if", bind(&apply_if, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, 0));
+ CMD2_ANY("not", &apply_not);
+ CMD2_ANY("false", &apply_false);
+ CMD2_ANY("and", &apply_and);
+@@ -583,22 +593,22 @@ initialize_command_ui() {
+
+ // A temporary command for handling stuff until we get proper
+ // support for seperation of commands and literals.
+- CMD2_ANY("branch", tr1::bind(&apply_if, tr1::placeholders::_1, tr1::placeholders::_2, 1));
++ CMD2_ANY("branch", bind(&apply_if, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2, 1));
+
+ CMD2_ANY_LIST("less", &apply_less);
+ CMD2_ANY_LIST("greater", &apply_greater);
+ CMD2_ANY_LIST("equal", &apply_equal);
+
+- CMD2_ANY_VALUE("convert.gm_time", tr1::bind(&apply_to_time, tr1::placeholders::_2, 0));
+- CMD2_ANY_VALUE("convert.gm_date", tr1::bind(&apply_to_time, tr1::placeholders::_2, 0x2));
+- CMD2_ANY_VALUE("convert.time", tr1::bind(&apply_to_time, tr1::placeholders::_2, 0x1));
+- CMD2_ANY_VALUE("convert.date", tr1::bind(&apply_to_time, tr1::placeholders::_2, 0x1 | 0x2));
+- CMD2_ANY_VALUE("convert.elapsed_time", tr1::bind(&apply_to_elapsed_time, tr1::placeholders::_2));
+- CMD2_ANY_VALUE("convert.kb", tr1::bind(&apply_to_kb, tr1::placeholders::_2));
+- CMD2_ANY_VALUE("convert.mb", tr1::bind(&apply_to_mb, tr1::placeholders::_2));
+- CMD2_ANY_VALUE("convert.xb", tr1::bind(&apply_to_xb, tr1::placeholders::_2));
+- CMD2_ANY_VALUE("convert.throttle", tr1::bind(&apply_to_throttle, tr1::placeholders::_2));
++ CMD2_ANY_VALUE("convert.gm_time", bind(&apply_to_time, STD_PLACEHOLDERS::_2, 0));
++ CMD2_ANY_VALUE("convert.gm_date", bind(&apply_to_time, STD_PLACEHOLDERS::_2, 0x2));
++ CMD2_ANY_VALUE("convert.time", bind(&apply_to_time, STD_PLACEHOLDERS::_2, 0x1));
++ CMD2_ANY_VALUE("convert.date", bind(&apply_to_time, STD_PLACEHOLDERS::_2, 0x1 | 0x2));
++ CMD2_ANY_VALUE("convert.elapsed_time", bind(&apply_to_elapsed_time, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_VALUE("convert.kb", bind(&apply_to_kb, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_VALUE("convert.mb", bind(&apply_to_mb, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_VALUE("convert.xb", bind(&apply_to_xb, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_VALUE("convert.throttle", bind(&apply_to_throttle, STD_PLACEHOLDERS::_2));
+
+- CMD2_ANY_LIST ("elapsed.less", tr1::bind(&apply_elapsed_less, tr1::placeholders::_2));
+- CMD2_ANY_LIST ("elapsed.greater", tr1::bind(&apply_elapsed_greater, tr1::placeholders::_2));
++ CMD2_ANY_LIST ("elapsed.less", bind(&apply_elapsed_less, STD_PLACEHOLDERS::_2));
++ CMD2_ANY_LIST ("elapsed.greater", bind(&apply_elapsed_greater, STD_PLACEHOLDERS::_2));
+ }
diff --git a/net/rtorrent/patches/patch-src_control.cc b/net/rtorrent/patches/patch-src_control.cc
new file mode 100644
index 00000000000..5fb157ad2a1
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_control.cc
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_control.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/control.cc.orig 2013-05-03 23:09:27.000000000 +0000
++++ src/control.cc
+@@ -58,6 +58,14 @@
+
+ #include "control.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#endif
++
+ Control::Control() :
+ m_ui(new ui::Root()),
+ m_display(new display::Manager()),
+@@ -77,7 +85,7 @@ Control::Control() :
+
+ m_inputStdin->slot_pressed(sigc::mem_fun(m_input, &input::Manager::pressed));
+
+- m_taskShutdown.slot() = std::tr1::bind(&Control::handle_shutdown, this);
++ m_taskShutdown.slot() = std::bind(&Control::handle_shutdown, this);
+
+ m_commandScheduler->set_slot_error_message(rak::mem_fn(m_core, &core::Manager::push_log_std));
+ }
diff --git a/net/rtorrent/patches/patch-src_core_curl__get.cc b/net/rtorrent/patches/patch-src_core_curl__get.cc
new file mode 100644
index 00000000000..5f81c1ec448
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_core_curl__get.cc
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_core_curl__get.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/core/curl_get.cc.orig 2013-05-03 22:43:40.000000000 +0000
++++ src/core/curl_get.cc
+@@ -45,6 +45,14 @@
+ #include "curl_get.h"
+ #include "curl_stack.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#endif
++
+ namespace core {
+
+ size_t
+@@ -82,7 +90,7 @@ CurlGet::start() {
+
+ // Normally libcurl should handle the timeout. But sometimes that doesn't
+ // work right so we do a fallback timeout that just aborts the transfer.
+- m_taskTimeout.slot() = std::tr1::bind(&CurlGet::receive_timeout, this);
++ m_taskTimeout.slot() = bind(&CurlGet::receive_timeout, this);
+ priority_queue_erase(&taskScheduler, &m_taskTimeout);
+ priority_queue_insert(&taskScheduler, &m_taskTimeout, cachedTime + rak::timer::from_seconds(m_timeout + 5));
+ }
diff --git a/net/rtorrent/patches/patch-src_core_curl__stack.cc b/net/rtorrent/patches/patch-src_core_curl__stack.cc
new file mode 100644
index 00000000000..f4d87e5dd6e
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_core_curl__stack.cc
@@ -0,0 +1,13 @@
+$NetBSD: patch-src_core_curl__stack.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/core/curl_stack.cc.orig 2013-05-03 22:43:15.000000000 +0000
++++ src/core/curl_stack.cc
+@@ -55,7 +55,7 @@ CurlStack::CurlStack() :
+ m_ssl_verify_peer(true),
+ m_dns_timeout(60) {
+
+- m_taskTimeout.slot() = std::tr1::bind(&CurlStack::receive_timeout, this);
++ m_taskTimeout.slot() = bind(&CurlStack::receive_timeout, this);
+
+ #if (LIBCURL_VERSION_NUM >= 0x071000)
+ curl_multi_setopt((CURLM*)m_handle, CURLMOPT_TIMERDATA, this);
diff --git a/net/rtorrent/patches/patch-src_core_dht__manager.cc b/net/rtorrent/patches/patch-src_core_dht__manager.cc
new file mode 100644
index 00000000000..5644b8eff78
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_core_dht__manager.cc
@@ -0,0 +1,37 @@
+$NetBSD: patch-src_core_dht__manager.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/core/dht_manager.cc.orig 2013-05-03 22:44:37.000000000 +0000
++++ src/core/dht_manager.cc
+@@ -54,6 +54,14 @@
+ #include "download_store.h"
+ #include "manager.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#endif
++
+ namespace core {
+
+ const char* DhtManager::dht_settings[dht_settings_num] = { "disable", "off", "auto", "on" };
+@@ -114,7 +122,7 @@ DhtManager::start_dht() {
+ torrent::dht_manager()->start(port);
+ torrent::dht_manager()->reset_statistics();
+
+- m_updateTimeout.slot() = std::tr1::bind(&DhtManager::update, this);
++ m_updateTimeout.slot() = bind(&DhtManager::update, this);
+ priority_queue_insert(&taskScheduler, &m_updateTimeout, (cachedTime + rak::timer::from_seconds(60)).round_seconds());
+
+ m_dhtPrevCycle = 0;
+@@ -197,7 +205,7 @@ DhtManager::update() {
+ break;
+
+ if (itr == end) {
+- m_stopTimeout.slot() = std::tr1::bind(&DhtManager::stop_dht, this);
++ m_stopTimeout.slot() = bind(&DhtManager::stop_dht, this);
+ priority_queue_insert(&taskScheduler, &m_stopTimeout, (cachedTime + rak::timer::from_seconds(15 * 60)).round_seconds());
+ }
+ }
diff --git a/net/rtorrent/patches/patch-src_core_download.cc b/net/rtorrent/patches/patch-src_core_download.cc
new file mode 100644
index 00000000000..8280030c482
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_core_download.cc
@@ -0,0 +1,36 @@
+$NetBSD: patch-src_core_download.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/core/download.cc.orig 2013-05-03 22:45:22.000000000 +0000
++++ src/core/download.cc
+@@ -53,6 +53,16 @@
+ #include "download.h"
+ #include "manager.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ namespace core {
+
+ Download::Download(download_type d) :
+@@ -63,10 +73,10 @@ Download::Download(download_type d) :
+ m_resumeFlags(~uint32_t()),
+ m_group(0) {
+
+- m_download.info()->signal_tracker_success().push_back(tr1::bind(&Download::receive_tracker_msg, this, ""));
+- m_download.info()->signal_tracker_failed().push_back(tr1::bind(&Download::receive_tracker_msg, this, tr1::placeholders::_1));
+- m_download.info()->signal_storage_error().push_back(tr1::bind(&Download::receive_storage_error, this, tr1::placeholders::_1));
+- m_download.info()->signal_chunk_failed().push_back(tr1::bind(&Download::receive_chunk_failed, this, tr1::placeholders::_1));
++ m_download.info()->signal_tracker_success().push_back(bind(&Download::receive_tracker_msg, this, ""));
++ m_download.info()->signal_tracker_failed().push_back(bind(&Download::receive_tracker_msg, this, STD_PLACEHOLDERS::_1));
++ m_download.info()->signal_storage_error().push_back(bind(&Download::receive_storage_error, this, STD_PLACEHOLDERS::_1));
++ m_download.info()->signal_chunk_failed().push_back(bind(&Download::receive_chunk_failed, this, STD_PLACEHOLDERS::_1));
+ }
+
+ Download::~Download() {
diff --git a/net/rtorrent/patches/patch-src_core_download__factory.cc b/net/rtorrent/patches/patch-src_core_download__factory.cc
new file mode 100644
index 00000000000..eb0abbc130f
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_core_download__factory.cc
@@ -0,0 +1,42 @@
+$NetBSD: patch-src_core_download__factory.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/core/download_factory.cc.orig 2013-05-03 22:37:54.000000000 +0000
++++ src/core/download_factory.cc
+@@ -41,7 +41,15 @@
+ #include <sstream>
+ #include <stdexcept>
+ #include <rak/path.h>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
+ #include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
+ #include <torrent/utils/log.h>
+ #include <torrent/utils/resume.h>
+ #include <torrent/object.h>
+@@ -107,8 +115,8 @@ DownloadFactory::DownloadFactory(Manager
+ m_printLog(true),
+ m_isFile(false) {
+
+- m_taskLoad.slot() = std::tr1::bind(&DownloadFactory::receive_load, this);
+- m_taskCommit.slot() = std::tr1::bind(&DownloadFactory::receive_commit, this);
++ m_taskLoad.slot() = bind(&DownloadFactory::receive_load, this);
++ m_taskCommit.slot() = bind(&DownloadFactory::receive_commit, this);
+
+ // m_variables["connection_leech"] = rpc::call_command_void("protocol.connection.leech");
+ // m_variables["connection_seed"] = rpc::call_command_void("protocol.connection.seed");
+@@ -158,8 +166,8 @@ DownloadFactory::receive_load() {
+ m_stream = new std::stringstream;
+ HttpQueue::iterator itr = m_manager->http_queue()->insert(m_uri, m_stream);
+
+- (*itr)->signal_done().push_front(std::tr1::bind(&DownloadFactory::receive_loaded, this));
+- (*itr)->signal_failed().push_front(std::tr1::bind(&DownloadFactory::receive_failed, this, std::tr1::placeholders::_1));
++ (*itr)->signal_done().push_front(bind(&DownloadFactory::receive_loaded, this));
++ (*itr)->signal_failed().push_front(bind(&DownloadFactory::receive_failed, this, STD_PLACEHOLDERS::_1));
+
+ m_variables["tied_to_file"] = (int64_t)false;
+
diff --git a/net/rtorrent/patches/patch-src_core_download__list.cc b/net/rtorrent/patches/patch-src_core_download__list.cc
new file mode 100644
index 00000000000..9a0ab518a00
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_core_download__list.cc
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_core_download__list.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/core/download_list.cc.orig 2013-05-03 22:46:43.000000000 +0000
++++ src/core/download_list.cc
+@@ -181,8 +181,8 @@ DownloadList::insert(Download* download)
+ lt_log_print_info(torrent::LOG_TORRENT_INFO, download->info(), "download_list", "Inserting download.");
+
+ try {
+- (*itr)->data()->slot_initial_hash() = tr1::bind(&DownloadList::hash_done, this, download);
+- (*itr)->data()->slot_download_done() = tr1::bind(&DownloadList::received_finished, this, download);
++ (*itr)->data()->slot_initial_hash() = bind(&DownloadList::hash_done, this, download);
++ (*itr)->data()->slot_download_done() = bind(&DownloadList::received_finished, this, download);
+
+ // This needs to be separated into two different calls to ensure
+ // the download remains in the view.
diff --git a/net/rtorrent/patches/patch-src_core_http__queue.cc b/net/rtorrent/patches/patch-src_core_http__queue.cc
new file mode 100644
index 00000000000..b7f2fe55664
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_core_http__queue.cc
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_core_http__queue.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/core/http_queue.cc.orig 2013-05-03 22:47:12.000000000 +0000
++++ src/core/http_queue.cc
+@@ -58,8 +58,8 @@ HttpQueue::insert(const std::string& url
+
+ iterator itr = Base::insert(end(), h.get());
+
+- h->signal_done().push_back(std::tr1::bind(&HttpQueue::erase, this, itr));
+- h->signal_failed().push_back(std::tr1::bind(&HttpQueue::erase, this, itr));
++ h->signal_done().push_back(bind(&HttpQueue::erase, this, itr));
++ h->signal_failed().push_back(bind(&HttpQueue::erase, this, itr));
+
+ (*itr)->start();
+
diff --git a/net/rtorrent/patches/patch-src_core_manager.cc b/net/rtorrent/patches/patch-src_core_manager.cc
new file mode 100644
index 00000000000..2fcaef7798e
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_core_manager.cc
@@ -0,0 +1,13 @@
+$NetBSD: patch-src_core_manager.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/core/manager.cc.orig 2013-05-03 22:47:33.000000000 +0000
++++ src/core/manager.cc
+@@ -205,7 +205,7 @@ Manager::get_address_throttle(const sock
+ // Most of this should be possible to move out.
+ void
+ Manager::initialize_second() {
+- torrent::Http::slot_factory() = std::tr1::bind(&CurlStack::new_object, m_httpStack);
++ torrent::Http::slot_factory() = bind(&CurlStack::new_object, m_httpStack);
+ m_httpQueue->slot_factory(sigc::mem_fun(m_httpStack, &CurlStack::new_object));
+
+ CurlStack::global_init();
diff --git a/net/rtorrent/patches/patch-src_core_manager.h b/net/rtorrent/patches/patch-src_core_manager.h
new file mode 100644
index 00000000000..d29d333df3c
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_core_manager.h
@@ -0,0 +1,21 @@
+$NetBSD: patch-src_core_manager.h,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/core/manager.h.orig 2013-05-03 23:23:20.000000000 +0000
++++ src/core/manager.h
+@@ -118,10 +118,12 @@ public:
+
+ void handshake_log(const sockaddr* sa, int msg, int err, const torrent::HashString* hash);
+
+- static const int create_start = 0x1;
+- static const int create_tied = 0x2;
+- static const int create_quiet = 0x4;
+- static const int create_raw_data = 0x8;
++ enum {
++ create_start = 0x1,
++ create_tied = 0x2,
++ create_quiet = 0x4,
++ create_raw_data = 0x8
++ };
+
+ typedef std::vector<std::string> command_list_type;
+
diff --git a/net/rtorrent/patches/patch-src_core_view.cc b/net/rtorrent/patches/patch-src_core_view.cc
new file mode 100644
index 00000000000..24995f9f0b9
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_core_view.cc
@@ -0,0 +1,13 @@
+$NetBSD: patch-src_core_view.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/core/view.cc.orig 2013-05-03 22:47:53.000000000 +0000
++++ src/core/view.cc
+@@ -172,7 +172,7 @@ View::initialize(const std::string& name
+ m_focus = 0;
+
+ set_last_changed(rak::timer());
+- m_delayChanged.slot() = std::tr1::bind(&signal_type::operator(), &m_signalChanged);
++ m_delayChanged.slot() = bind(&signal_type::operator(), &m_signalChanged);
+ }
+
+ void
diff --git a/net/rtorrent/patches/patch-src_display_frame.cc b/net/rtorrent/patches/patch-src_display_frame.cc
new file mode 100644
index 00000000000..1625327d2a9
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_display_frame.cc
@@ -0,0 +1,47 @@
+$NetBSD: patch-src_display_frame.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/display/frame.cc.orig 2013-05-03 22:39:08.000000000 +0000
++++ src/display/frame.cc
+@@ -38,7 +38,16 @@
+
+ #include <algorithm>
+ #include <functional>
++#if __cplusplus >= 201103L
++using std::function;
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
+ #include <rak/algorithm.h>
+ #include <torrent/exceptions.h>
+
+@@ -367,9 +376,9 @@ Frame::balance_row(uint32_t x, uint32_t
+ //
+ // Else if we're short, only give each what they require.
+ std::stable_sort(dynamicFrames, dynamicFrames + dynamicSize,
+- std::tr1::bind(std::greater<extent_type>(),
+- std::tr1::bind(&dynamic_min_height, std::tr1::placeholders::_1),
+- std::tr1::bind(&dynamic_min_height, std::tr1::placeholders::_2)));
++ bind(std::greater<extent_type>(),
++ bind(&dynamic_min_height, STD_PLACEHOLDERS::_1),
++ bind(&dynamic_min_height, STD_PLACEHOLDERS::_2)));
+
+ bool retry;
+
+@@ -442,9 +451,9 @@ Frame::balance_column(uint32_t x, uint32
+ //
+ // Else if we're short, only give each what they require.
+ std::stable_sort(dynamicFrames, dynamicFrames + dynamicSize,
+- std::tr1::bind(std::greater<extent_type>(),
+- std::tr1::bind(&dynamic_min_width, std::tr1::placeholders::_1),
+- std::tr1::bind(&dynamic_min_width, std::tr1::placeholders::_2)));
++ bind(std::greater<extent_type>(),
++ bind(&dynamic_min_width, STD_PLACEHOLDERS::_1),
++ bind(&dynamic_min_width, STD_PLACEHOLDERS::_2)));
+
+ bool retry;
+
diff --git a/net/rtorrent/patches/patch-src_display_manager.cc b/net/rtorrent/patches/patch-src_display_manager.cc
new file mode 100644
index 00000000000..cafcbde7946
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_display_manager.cc
@@ -0,0 +1,26 @@
+$NetBSD: patch-src_display_manager.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/display/manager.cc.orig 2013-05-03 22:48:16.000000000 +0000
++++ src/display/manager.cc
+@@ -45,12 +45,20 @@
+ #include "manager.h"
+ #include "window.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#endif
++
+ namespace display {
+
+ Manager::Manager() :
+ m_forceRedraw(false) {
+
+- m_taskUpdate.slot() = std::tr1::bind(&Manager::receive_update, this);
++ m_taskUpdate.slot() = bind(&Manager::receive_update, this);
+ }
+
+ Manager::~Manager() {
diff --git a/net/rtorrent/patches/patch-src_display_window.cc b/net/rtorrent/patches/patch-src_display_window.cc
new file mode 100644
index 00000000000..e67cef29836
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_display_window.cc
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_display_window.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/display/window.cc.orig 2013-05-03 22:49:02.000000000 +0000
++++ src/display/window.cc
+@@ -40,6 +40,14 @@
+
+ #include "window.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#endif
++
+ namespace display {
+
+ Window::SlotTimer Window::m_slotSchedule;
+@@ -59,7 +67,7 @@ Window::Window(Canvas* canvas, int flags
+ m_maxWidth(maxWidth),
+ m_maxHeight(maxHeight) {
+
+- m_taskUpdate.slot() = std::tr1::bind(&Window::redraw, this);
++ m_taskUpdate.slot() = bind(&Window::redraw, this);
+ }
+
+ Window::~Window() {
diff --git a/net/rtorrent/patches/patch-src_display_window__file__list.cc b/net/rtorrent/patches/patch-src_display_window__file__list.cc
new file mode 100644
index 00000000000..1fa54d5f694
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_display_window__file__list.cc
@@ -0,0 +1,12 @@
+$NetBSD: patch-src_display_window__file__list.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/display/window_file_list.cc.orig 2013-05-03 22:49:37.000000000 +0000
++++ src/display/window_file_list.cc
+@@ -36,6 +36,7 @@
+
+ #include "config.h"
+
++#include <locale>
+ #include <stdio.h>
+ #include <torrent/path.h>
+ #include <torrent/data/file.h>
diff --git a/net/rtorrent/patches/patch-src_display_window__log.cc b/net/rtorrent/patches/patch-src_display_window__log.cc
new file mode 100644
index 00000000000..4824b1d1cb5
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_display_window__log.cc
@@ -0,0 +1,33 @@
+$NetBSD: patch-src_display_window__log.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/display/window_log.cc.orig 2013-05-03 22:50:09.000000000 +0000
++++ src/display/window_log.cc
+@@ -44,17 +44,25 @@
+ #include "utils.h"
+ #include "window_log.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#endif
++
+ namespace display {
+
+ WindowLog::WindowLog(torrent::log_buffer* l) :
+ Window(new Canvas, 0, 0, 0, extent_full, extent_static),
+ m_log(l) {
+
+- m_taskUpdate.slot() = std::tr1::bind(&WindowLog::receive_update, this);
++ m_taskUpdate.slot() = bind(&WindowLog::receive_update, this);
+
+- unsigned int signal_index = torrent::main_thread()->signal_bitfield()->add_signal(std::tr1::bind(&WindowLog::receive_update, this));
++ unsigned int signal_index = torrent::main_thread()->signal_bitfield()->add_signal(bind(&WindowLog::receive_update, this));
+
+- m_log->lock_and_set_update_slot(std::tr1::bind(&torrent::thread_base::send_event_signal, torrent::main_thread(), signal_index, false));
++ m_log->lock_and_set_update_slot(bind(&torrent::thread_base::send_event_signal, torrent::main_thread(), signal_index, false));
+ }
+
+ WindowLog::~WindowLog() {
diff --git a/net/rtorrent/patches/patch-src_rpc_command.h b/net/rtorrent/patches/patch-src_rpc_command.h
new file mode 100644
index 00000000000..27f0fe8c77e
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_rpc_command.h
@@ -0,0 +1,42 @@
+$NetBSD: patch-src_rpc_command.h,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/rpc/command.h.orig 2013-05-03 22:40:32.000000000 +0000
++++ src/rpc/command.h
+@@ -41,13 +41,17 @@
+ #include <limits>
+ #include <inttypes.h>
+ #include <torrent/object.h>
+-#include <tr1/functional>
+
+ #include <torrent/object.h>
+ #include <torrent/data/file_list_iterator.h>
+
+ // Move into config.h or something.
+-namespace tr1 { using namespace std::tr1; }
++#if __cplusplus >= 201103L
++using std::function;
++#else
++#include <tr1/functional>
++using std::tr1::function;
++#endif
+
+ namespace core {
+ class Download;
+@@ -111,7 +115,7 @@ typedef rt_triple<int, void*, void*> tar
+ class command_base;
+
+ typedef const torrent::Object (*command_base_call_type)(command_base*, target_type, const torrent::Object&);
+-typedef tr1::function<torrent::Object (target_type, const torrent::Object&)> base_function;
++typedef function<torrent::Object (target_type, const torrent::Object&)> base_function;
+
+ template <typename tmpl> struct command_base_is_valid {};
+ template <command_base_call_type tmpl_func> struct command_base_is_type {};
+@@ -250,7 +254,7 @@ command_base::_call(command_base* cmd, t
+ }
+
+ #define COMMAND_BASE_TEMPLATE_TYPE(func_type, func_parm) \
+- template <typename T, int proper = target_type_id<T>::proper_type> struct func_type { typedef tr1::function<func_parm> type; }; \
++ template <typename T, int proper = target_type_id<T>::proper_type> struct func_type { typedef function<func_parm> type; }; \
+ \
+ template <> struct command_base_is_valid<func_type<target_type>::type> { static const int value = 1; }; \
+ template <> struct command_base_is_valid<func_type<core::Download*>::type> { static const int value = 1; }; \
diff --git a/net/rtorrent/patches/patch-src_rpc_command__scheduler.cc b/net/rtorrent/patches/patch-src_rpc_command__scheduler.cc
new file mode 100644
index 00000000000..59d5dcea886
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_rpc_command__scheduler.cc
@@ -0,0 +1,13 @@
+$NetBSD: patch-src_rpc_command__scheduler.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/rpc/command_scheduler.cc.orig 2013-05-03 22:51:00.000000000 +0000
++++ src/rpc/command_scheduler.cc
+@@ -71,7 +71,7 @@ CommandScheduler::insert(const std::stri
+ delete *itr;
+
+ *itr = new CommandSchedulerItem(key);
+- (*itr)->slot() = std::tr1::bind(&CommandScheduler::call_item, this, *itr);
++ (*itr)->slot() = bind(&CommandScheduler::call_item, this, *itr);
+
+ return itr;
+ }
diff --git a/net/rtorrent/patches/patch-src_rpc_command__scheduler__item.h b/net/rtorrent/patches/patch-src_rpc_command__scheduler__item.h
new file mode 100644
index 00000000000..cf1afaf748c
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_rpc_command__scheduler__item.h
@@ -0,0 +1,26 @@
+$NetBSD: patch-src_rpc_command__scheduler__item.h,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/rpc/command_scheduler_item.h.orig 2013-05-03 22:41:25.000000000 +0000
++++ src/rpc/command_scheduler_item.h
+@@ -39,14 +39,20 @@
+
+ #include "globals.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+ #include <torrent/object.h>
+
+ namespace rpc {
+
+ class CommandSchedulerItem {
+ public:
+- typedef std::tr1::function<void ()> slot_void;
++ typedef function<void ()> slot_void;
+
+ CommandSchedulerItem(const std::string& key) : m_key(key), m_interval(0) {}
+ ~CommandSchedulerItem();
diff --git a/net/rtorrent/patches/patch-src_rpc_exec__file.cc b/net/rtorrent/patches/patch-src_rpc_exec__file.cc
new file mode 100644
index 00000000000..407a1c50dd2
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_rpc_exec__file.cc
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_rpc_exec__file.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/rpc/exec_file.cc.orig 2013-05-03 23:11:48.000000000 +0000
++++ src/rpc/exec_file.cc
+@@ -52,6 +52,14 @@ namespace rpc {
+
+ // Close m_logFd.
+
++const unsigned int ExecFile::max_args = 128;
++const unsigned int ExecFile::buffer_size = 4096;
++
++const int ExecFile::flag_expand_tilde = 0x1;
++const int ExecFile::flag_throw = 0x2;
++const int ExecFile::flag_capture = 0x4;
++const int ExecFile::flag_background = 0x8;
++
+ int
+ ExecFile::execute(const char* file, char* const* argv, int flags) {
+ // Write the execued command and its parameters to the log fd.
diff --git a/net/rtorrent/patches/patch-src_rpc_exec__file.h b/net/rtorrent/patches/patch-src_rpc_exec__file.h
new file mode 100644
index 00000000000..968f101bcbe
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_rpc_exec__file.h
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_rpc_exec__file.h,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/rpc/exec_file.h.orig 2013-05-03 23:11:46.000000000 +0000
++++ src/rpc/exec_file.h
+@@ -43,13 +43,13 @@ namespace rpc {
+
+ class ExecFile {
+ public:
+- static const unsigned int max_args = 128;
+- static const unsigned int buffer_size = 4096;
++ static const unsigned int max_args;
++ static const unsigned int buffer_size;
+
+- static const int flag_expand_tilde = 0x1;
+- static const int flag_throw = 0x2;
+- static const int flag_capture = 0x4;
+- static const int flag_background = 0x8;
++ static const int flag_expand_tilde;
++ static const int flag_throw;
++ static const int flag_capture;
++ static const int flag_background;
+
+ ExecFile() : m_logFd(-1) {}
+
diff --git a/net/rtorrent/patches/patch-src_rpc_object__storage.cc b/net/rtorrent/patches/patch-src_rpc_object__storage.cc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_rpc_object__storage.cc
diff --git a/net/rtorrent/patches/patch-src_rpc_object__storage.h b/net/rtorrent/patches/patch-src_rpc_object__storage.h
new file mode 100644
index 00000000000..f1e40997c58
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_rpc_object__storage.h
@@ -0,0 +1,66 @@
+$NetBSD: patch-src_rpc_object__storage.h,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/rpc/object_storage.h.orig 2013-05-03 22:41:30.000000000 +0000
++++ src/rpc/object_storage.h
+@@ -42,7 +42,13 @@
+ #define RTORRENT_RPC_OBJECT_STORAGE_H
+
+ #include <cstring>
++#if __cplusplus >= 201103L
++#include <unordered_map>
++using std::unordered_map;
++#else
+ #include <tr1/unordered_map>
++using std::tr1::unordered_map;
++#endif
+ #include <torrent/object.h>
+
+ #include "rak/unordered_vector.h"
+@@ -56,7 +62,7 @@ struct object_storage_node {
+ char flags;
+ };
+
+-typedef std::tr1::unordered_map<fixed_key_type<64>, object_storage_node, hash_fixed_key_type> object_storage_base_type;
++typedef unordered_map<fixed_key_type<64>, object_storage_node, hash_fixed_key_type> object_storage_base_type;
+
+ class object_storage : private object_storage_base_type {
+ public:
+@@ -89,21 +95,23 @@ public:
+ using base_type::clear;
+ using base_type::find;
+ using base_type::erase;
+-
+- static const unsigned int flag_generic_type = 0x1;
+- static const unsigned int flag_bool_type = 0x2;
+- static const unsigned int flag_value_type = 0x3;
+- static const unsigned int flag_string_type = 0x4;
+- static const unsigned int flag_list_type = 0x5;
+- static const unsigned int flag_function_type = 0x6;
+- static const unsigned int flag_multi_type = 0x7;
+-
+- static const unsigned int mask_type = 0xf;
+-
+- static const unsigned int flag_constant = 0x10;
+- static const unsigned int flag_static = 0x20;
+- static const unsigned int flag_private = 0x40;
+- static const unsigned int flag_rlookup = 0x80;
++
++ enum {
++ flag_generic_type = 0x1,
++ flag_bool_type = 0x2,
++ flag_value_type = 0x3,
++ flag_string_type = 0x4,
++ flag_list_type = 0x5,
++ flag_function_type = 0x6,
++ flag_multi_type = 0x7,
++
++ mask_type = 0xf,
++
++ flag_constant = 0x10,
++ flag_static = 0x20,
++ flag_private = 0x40,
++ flag_rlookup = 0x80
++ };
+
+ static const size_t key_size = key_type::max_size;
+
diff --git a/net/rtorrent/patches/patch-src_rpc_xmlrpc.h b/net/rtorrent/patches/patch-src_rpc_xmlrpc.h
new file mode 100644
index 00000000000..bc73f86c48d
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_rpc_xmlrpc.h
@@ -0,0 +1,34 @@
+$NetBSD: patch-src_rpc_xmlrpc.h,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/rpc/xmlrpc.h.orig 2013-05-03 22:41:35.000000000 +0000
++++ src/rpc/xmlrpc.h
+@@ -37,7 +37,12 @@
+ #ifndef RTORRENT_RPC_XMLRPC_H
+ #define RTORRENT_RPC_XMLRPC_H
+
++#if __cplusplus >= 201103L
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+ #include <torrent/hash_string.h>
+
+ namespace core {
+@@ -54,11 +59,11 @@ namespace rpc {
+
+ class XmlRpc {
+ public:
+- typedef std::tr1::function<core::Download* (const char*)> slot_download;
+- typedef std::tr1::function<torrent::File* (core::Download*, uint32_t)> slot_file;
+- typedef std::tr1::function<torrent::Tracker* (core::Download*, uint32_t)> slot_tracker;
+- typedef std::tr1::function<torrent::Peer* (core::Download*, const torrent::HashString&)> slot_peer;
+- typedef std::tr1::function<bool (const char*, uint32_t)> slot_write;
++ typedef function<core::Download* (const char*)> slot_download;
++ typedef function<torrent::File* (core::Download*, uint32_t)> slot_file;
++ typedef function<torrent::Tracker* (core::Download*, uint32_t)> slot_tracker;
++ typedef function<torrent::Peer* (core::Download*, const torrent::HashString&)> slot_peer;
++ typedef function<bool (const char*, uint32_t)> slot_write;
+
+ static const int dialect_generic = 0;
+ static const int dialect_i8 = 1;
diff --git a/net/rtorrent/patches/patch-src_signal__handler.cc b/net/rtorrent/patches/patch-src_signal__handler.cc
new file mode 100644
index 00000000000..946e3b75e4c
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_signal__handler.cc
@@ -0,0 +1,12 @@
+$NetBSD: patch-src_signal__handler.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/signal_handler.cc.orig 2013-05-03 23:09:48.000000000 +0000
++++ src/signal_handler.cc
+@@ -38,6 +38,7 @@
+
+ #include <signal.h>
+ #include <stdexcept>
++#include <string>
+ #include "rak/error_number.h"
+ #include "signal_handler.h"
+
diff --git a/net/rtorrent/patches/patch-src_thread__base.cc b/net/rtorrent/patches/patch-src_thread__base.cc
new file mode 100644
index 00000000000..d4918918536
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_thread__base.cc
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_thread__base.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/thread_base.cc.orig 2013-05-03 23:10:27.000000000 +0000
++++ src/thread_base.cc
+@@ -53,6 +53,14 @@
+ #include "control.h"
+ #include "core/manager.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#endif
++
+ // Temporarly injected into config.h.
+ /* temp hack */
+ //#define lt_cacheline_aligned __attribute__((__aligned__(128)))
+@@ -109,7 +117,7 @@ public:
+ void throw_shutdown_exception() { throw torrent::shutdown_exception(); }
+
+ ThreadBase::ThreadBase() {
+- m_taskShutdown.slot() = std::tr1::bind(&throw_shutdown_exception);
++ m_taskShutdown.slot() = std::bind(&throw_shutdown_exception);
+
+ m_threadQueue = new thread_queue_hack;
+ }
diff --git a/net/rtorrent/patches/patch-src_ui_element__log__complete.cc b/net/rtorrent/patches/patch-src_ui_element__log__complete.cc
new file mode 100644
index 00000000000..f35165b8e76
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_ui_element__log__complete.cc
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_ui_element__log__complete.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/ui/element_log_complete.cc.orig 2013-05-03 22:55:48.000000000 +0000
++++ src/ui/element_log_complete.cc
+@@ -48,15 +48,23 @@
+ #include "control.h"
+ #include "element_log_complete.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#endif
++
+ namespace ui {
+
+ ElementLogComplete::ElementLogComplete(torrent::log_buffer* l) :
+ m_window(NULL),
+ m_log(l) {
+
+- unsigned int signal_index = torrent::main_thread()->signal_bitfield()->add_signal(std::tr1::bind(&ElementLogComplete::received_update, this));
++ unsigned int signal_index = torrent::main_thread()->signal_bitfield()->add_signal(bind(&ElementLogComplete::received_update, this));
+
+- m_log->lock_and_set_update_slot(std::tr1::bind(&torrent::thread_base::send_event_signal, torrent::main_thread(), signal_index, false));
++ m_log->lock_and_set_update_slot(bind(&torrent::thread_base::send_event_signal, torrent::main_thread(), signal_index, false));
+ }
+
+ void
diff --git a/net/rtorrent/patches/patch-src_ui_element__peer__list.cc b/net/rtorrent/patches/patch-src_ui_element__peer__list.cc
new file mode 100644
index 00000000000..cc580d8a08a
--- /dev/null
+++ b/net/rtorrent/patches/patch-src_ui_element__peer__list.cc
@@ -0,0 +1,33 @@
+$NetBSD: patch-src_ui_element__peer__list.cc,v 1.1 2013/05/09 14:28:25 joerg Exp $
+
+--- src/ui/element_peer_list.cc.orig 2013-05-03 22:56:26.000000000 +0000
++++ src/ui/element_peer_list.cc
+@@ -54,6 +54,16 @@
+ #include "element_peer_list.h"
+ #include "element_text.h"
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ namespace ui {
+
+ ElementPeerList::ElementPeerList(core::Download* d) :
+@@ -68,9 +78,9 @@ ElementPeerList::ElementPeerList(core::D
+ torrent::ConnectionList* connection_list = m_download->download()->connection_list();
+
+ m_peer_connected = connection_list->signal_connected().insert(connection_list->signal_connected().end(),
+- tr1::bind(&ElementPeerList::receive_peer_connected, this, tr1::placeholders::_1));
++ bind(&ElementPeerList::receive_peer_connected, this, STD_PLACEHOLDERS::_1));
+ m_peer_disconnected = connection_list->signal_disconnected().insert(connection_list->signal_disconnected().end(),
+- tr1::bind(&ElementPeerList::receive_peer_disconnected, this, tr1::placeholders::_1));
++ bind(&ElementPeerList::receive_peer_disconnected, this, STD_PLACEHOLDERS::_1));
+
+ m_windowList = new display::WindowPeerList(m_download, &m_list, &m_listItr);
+ m_elementInfo = create_info();