* Added 'get_pid', 'get/set_name' and 'cat' command.

* SocketFd::open_local() should use SOCK_STREAM, not SOCK_DGRAM.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@959 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-08-20 01:38:38 +00:00
parent 5ec7790aa9
commit ded9e12ff1
7 changed files with 56 additions and 2 deletions
+37
View File
@@ -389,4 +389,41 @@ print_object(char* first, char* last, const torrent::Object* src, int flags) {
}
}
void
print_object_std(std::string* dest, const torrent::Object* src, int flags) {
switch (src->type()) {
case torrent::Object::TYPE_STRING:
{
const std::string& str = src->as_string();
if ((flags & print_expand_tilde) && *str.c_str() == '~')
*dest += rak::path_expand(str);
else
*dest += str;
return;
}
case torrent::Object::TYPE_VALUE:
{
char buffer[64];
snprintf(buffer, 64, "%lli", src->as_value());
*dest += buffer;
return;
}
case torrent::Object::TYPE_LIST:
for (torrent::Object::list_type::const_iterator itr = src->as_list().begin(), itrEnd = src->as_list().end(); itr != itrEnd; itr++) {
print_object_std(dest, &*itr, flags);
// Don't expand tilde after the first element in the list.
flags &= ~print_expand_tilde;
}
return;
default:
throw torrent::input_error("Invalid type.");
}
}
}