diff --git a/doc/rtorrent.1.xml b/doc/rtorrent.1.xml index a84201e1..51a4388c 100644 --- a/doc/rtorrent.1.xml +++ b/doc/rtorrent.1.xml @@ -23,6 +23,7 @@ rtorrent -h -o key1=opt1,... + -O key=opt URL | FILE @@ -283,10 +284,13 @@ -o key1=opt1,... + -O key=opt - Set any number of options, see the - SETTINGS section. The options given here - override the resource files. + +Set any number of options, see the SETTINGS section. The options given +here override the resource files. Use capital -O +to allow comma in the option. + diff --git a/scripts/common.m4 b/scripts/common.m4 index e5f80106..428802d0 100644 --- a/scripts/common.m4 +++ b/scripts/common.m4 @@ -78,6 +78,7 @@ AC_DEFUN([TORRENT_MINCORE_SIGNEDNESS], [ void f() { mincore((void*)0, 0, (unsigned char*)0); } ]], [ + AC_DEFINE(USE_MINCORE, 1, Use mincore) AC_DEFINE(USE_MINCORE_UNSIGNED, 1, use unsigned char* in mincore) AC_MSG_RESULT(unsigned) ], @@ -88,17 +89,34 @@ AC_DEFUN([TORRENT_MINCORE_SIGNEDNESS], [ void f() { mincore((void*)0, 0, (char*)0); } ]], [ + AC_DEFINE(USE_MINCORE, 1, Use mincore) AC_DEFINE(USE_MINCORE_UNSIGNED, 0, use char* in mincore) AC_MSG_RESULT(signed) ], [ - AC_MSG_ERROR([mincore signedness test failed]) + AC_MSG_RESULT(none) ]) ]) AC_LANG_POP(C++) ]) +AC_DEFUN([TORRENT_CHECK_MADVISE], [ + AC_MSG_CHECKING(for madvise) + + AC_COMPILE_IFELSE( + [[#include + #include + void f() { static char test[1024]; madvise((void *)test, sizeof(test), MADV_NORMAL); } + ]], + [ + AC_MSG_RESULT(yes) + AC_DEFINE(USE_MADVISE, 1, Use madvise) + ], [ + AC_MSG_RESULT(no) + ]) +]) + AC_DEFUN([TORRENT_CHECK_EXECINFO], [ AC_MSG_CHECKING(for execinfo.h) diff --git a/src/display/canvas.cc b/src/display/canvas.cc index e0498b83..e26f9cc7 100644 --- a/src/display/canvas.cc +++ b/src/display/canvas.cc @@ -38,6 +38,7 @@ #include #include +#include #include "canvas.h" diff --git a/src/display/manager.h b/src/display/manager.h index 21b003c7..69837e7b 100644 --- a/src/display/manager.h +++ b/src/display/manager.h @@ -76,10 +76,9 @@ public: void unschedule(Window* w); void adjust_layout(); - -private: void receive_update(); +private: void schedule_update(); bool m_forceRedraw; diff --git a/src/display/utils.cc b/src/display/utils.cc index d9b64372..2233a6da 100644 --- a/src/display/utils.cc +++ b/src/display/utils.cc @@ -147,7 +147,7 @@ print_ddmmyyyy(char* first, char* last, time_t t) { char* print_download_title(char* first, char* last, core::Download* d) { - return print_buffer(first, last, "%s", d->get_download().name().c_str()); + return print_buffer(first, last, " %s", d->get_download().name().c_str()); } char* diff --git a/src/display/window_file_list.cc b/src/display/window_file_list.cc index 509d2c78..c68008a0 100644 --- a/src/display/window_file_list.cc +++ b/src/display/window_file_list.cc @@ -52,6 +52,7 @@ WindowFileList::WindowFileList(core::Download* d, unsigned int* focus) : m_focus(focus) { } +/* std::wstring hack_wstring(const std::string& src) { size_t length = ::mbstowcs(NULL, src.c_str(), src.size()); @@ -66,6 +67,7 @@ hack_wstring(const std::string& src) { return dest; } +*/ void WindowFileList::redraw() { diff --git a/src/main.cc b/src/main.cc index 70e86d4a..1b863c01 100644 --- a/src/main.cc +++ b/src/main.cc @@ -36,15 +36,9 @@ #include "config.h" -#include #include -#include -#include #include -#include -#include #include -#include #include #include #include @@ -77,25 +71,26 @@ void do_panic(int signum); void print_help(); int -parse_options(__UNUSED Control* c, utils::VariableMap* optionHandler, int argc, char** argv) { +parse_options(Control* c, int argc, char** argv) { try { OptionParser optionParser; // Converted. optionParser.insert_flag('h', sigc::ptr_fun(&print_help)); - optionParser.insert_option('b', sigc::bind<0>(sigc::mem_fun(*optionHandler, &utils::VariableMap::set_string), "bind")); - optionParser.insert_option('d', sigc::bind<0>(sigc::mem_fun(*optionHandler, &utils::VariableMap::set_string), "directory")); - optionParser.insert_option('i', sigc::bind<0>(sigc::mem_fun(*optionHandler, &utils::VariableMap::set_string), "ip")); - optionParser.insert_option('p', sigc::bind<0>(sigc::mem_fun(*optionHandler, &utils::VariableMap::set_string), "port_range")); - optionParser.insert_option('s', sigc::bind<0>(sigc::mem_fun(*optionHandler, &utils::VariableMap::set_string), "session")); + optionParser.insert_option('b', sigc::bind<0>(sigc::mem_fun(c->variables(), &utils::VariableMap::set_string), "bind")); + optionParser.insert_option('d', sigc::bind<0>(sigc::mem_fun(c->variables(), &utils::VariableMap::set_string), "directory")); + optionParser.insert_option('i', sigc::bind<0>(sigc::mem_fun(c->variables(), &utils::VariableMap::set_string), "ip")); + optionParser.insert_option('p', sigc::bind<0>(sigc::mem_fun(c->variables(), &utils::VariableMap::set_string), "port_range")); + optionParser.insert_option('s', sigc::bind<0>(sigc::mem_fun(c->variables(), &utils::VariableMap::set_string), "session")); - optionParser.insert_option_list('o', sigc::mem_fun(*optionHandler, &utils::VariableMap::set_string)); + optionParser.insert_option('O', sigc::mem_fun(c->variables(), &utils::VariableMap::process_command)); + optionParser.insert_option_list('o', sigc::mem_fun(c->variables(), &utils::VariableMap::set_string)); return optionParser.process(argc, argv); } catch (torrent::input_error& e) { - throw std::runtime_error("Failed to parse command line option: " + std::string(e.what())); + throw torrent::input_error("Failed to parse command line option: " + std::string(e.what())); } } @@ -169,7 +164,7 @@ main(int argc, char** argv) { if (!control->variables()->process_file("~/.rtorrent.rc")) control->core()->get_log_important().push_front("Could not load \"~/.rtorrent.rc\"."); - int firstArg = parse_options(control, control->variables(), argc, argv); + int firstArg = parse_options(control, argc, argv); control->initialize(); @@ -180,7 +175,11 @@ main(int argc, char** argv) { load_arg_torrents(control, argv + firstArg, argv + argc); + // Make sure we update the display before any scheduled tasks can + // run, so that loading of torrents doesn't look like it hangs on + // startup. control->display()->adjust_layout(); + control->display()->receive_update(); while (!control->is_shutdown_completed()) { if (control->is_shutdown_received())