* Added "-O" flag that takes a single option, allowing ','.

* Added the errno message when a file in a torrent could not be opened.

* Added torrent::Object class which will be replacing torrent::Bencode.

* Ported to Cygwin, patch supplied by Jussi Kivilinna
<jussi.kivilinna@mbnet.fi>.

* Update display before entering the main loop, so it won't seem to be
blocking when loading torrents.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@637 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-02-16 14:57:41 +00:00
parent 4dea195340
commit 1e5146121e
7 changed files with 45 additions and 22 deletions
+7 -3
View File
@@ -23,6 +23,7 @@
<command>rtorrent</command>
<arg choice="opt">-h</arg>
<arg choice="opt">-o key1=opt1,...</arg>
<arg choice="opt">-O key=opt</arg>
<arg choice="opt" rep="repeat">URL | FILE</arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -283,10 +284,13 @@
<varlistentry>
<term>-o key1=opt1,...</term>
<term>-O key=opt</term>
<listitem><para>
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 <emphasis>-O</emphasis>
to allow comma in the option.
</para></listitem>
</varlistentry>
+19 -1
View File
@@ -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 <sys/types.h>
#include <sys/mman.h>
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)
+1
View File
@@ -38,6 +38,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/termios.h>
#include "canvas.h"
+1 -2
View File
@@ -76,10 +76,9 @@ public:
void unschedule(Window* w);
void adjust_layout();
private:
void receive_update();
private:
void schedule_update();
bool m_forceRedraw;
+1 -1
View File
@@ -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*
+2
View File
@@ -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() {
+14 -15
View File
@@ -36,15 +36,9 @@
#include "config.h"
#include <fstream>
#include <iostream>
#include <iterator>
#include <stdexcept>
#include <string>
#include <stdlib.h>
#include <sstream>
#include <sigc++/bind.h>
#include <sigc++/retype_return.h>
#include <torrent/http.h>
#include <torrent/torrent.h>
#include <torrent/exceptions.h>
@@ -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())