mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-10 12:12:31 +00:00
* Allow ';' as a separator for multi-command lines. Not recognized by
the string parser, so it must be preceeded by whitespace. * Allow escaping of newlines in the resource file. * Cleanup of the parse_command_* commands. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@936 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+11
-6
@@ -99,22 +99,27 @@ apply_view_sort(const torrent::Object& rawArgs) {
|
||||
|
||||
torrent::Object
|
||||
apply_print(const torrent::Object& rawArgs) {
|
||||
std::string output;
|
||||
char buffer[1024];
|
||||
char* current = buffer;
|
||||
|
||||
for (torrent::Object::list_type::const_iterator itr = rawArgs.as_list().begin(), last = rawArgs.as_list().end(); itr != last; itr++) {
|
||||
switch (itr->type()) {
|
||||
case torrent::Object::TYPE_STRING:
|
||||
output += itr->as_string();
|
||||
break;
|
||||
{
|
||||
int len = std::min<int>(itr->as_string().size(), buffer + 1024 - current);
|
||||
|
||||
std::memcpy(current, itr->as_string().c_str(), len);
|
||||
current += len;
|
||||
break;
|
||||
}
|
||||
case torrent::Object::TYPE_VALUE:
|
||||
default:
|
||||
output += "<unknown>";
|
||||
current += snprintf(buffer, buffer + 1024 - current, "%lli", itr->as_value());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
control->core()->push_log(output);
|
||||
|
||||
control->core()->push_log(buffer);
|
||||
return torrent::Object();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user