|
lftp
4.4.6
About: lftp is a command line ftp client (FTP, HTTP, ssl support, background transfer, reget, reput, ...)
Fossies Dox: lftp-4.4.6.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) ![]() |
#include <xstring.h>


Public Member Functions | |
| xstring () | |
| xstring (const char *s) | |
| xstring (const char *s, int l) | |
| xstring (const xstring_clonable &c) | |
| const xstring_clonable & | copy () const |
| void | get_space (size_t s) |
| void | get_space2 (size_t s, size_t g) |
| char * | add_space (size_t s) |
| void | add_commit (int new_len) |
| size_t | length () const |
| xstring & | set (const xstring &s) |
| xstring & | set (const char *s) |
| xstring & | nset (const char *s, int len) |
| xstring & | set_allocated (char *s) |
| xstring & | move_here (xstring &) |
| xstring & | set_substr (int start, size_t sublen, const char *, size_t) |
| xstring & | set_substr (int start, size_t sublen, const char *) |
| xstring & | set_substr (int start, size_t sublen, const xstring &s) |
| xstring & | append (const char *s) |
| xstring & | append (char c) |
| xstring & | append (const char *s, size_t len) |
| xstring & | append (const xstring &s) |
| xstring & | append_padding (int len, char ch) |
| xstring & | vappend (va_list) |
| xstring & | vappend (...) ATTRIBUTE_SENTINEL |
| xstring & | vset (...) ATTRIBUTE_SENTINEL |
| xstring & | vsetf (const char *fmt, va_list ap) |
| xstring & | setf (const char *fmt,...) PRINTF_LIKE(2 |
| xstring xstring & | vappendf (const char *fmt, va_list ap) |
| xstring & | appendf (const char *fmt,...) PRINTF_LIKE(2 |
| void | truncate (size_t n=0) |
| void | truncate_at (char c) |
| void | set_length (size_t n) |
| char * | borrow () |
| bool | begins_with (const char *o_buf, size_t o_len) const |
| bool | begins_with (const char *s) const |
| bool | ends_with (const char *o_buf, size_t o_len) const |
| bool | ends_with (const char *s) const |
| bool | eq (const char *o_buf, size_t o_len) const |
| bool | eq (const char *s) const |
| bool | eq (const xstring &o) const |
| bool | ne (const xstring &o) const |
| bool | chomp (char c='\n') |
| void | rtrim (char c=' ') |
| char | last_char () const |
| unsigned | skip_all (unsigned i, char c) const |
| int | instr (char c) const |
| void | _clear () |
| void | _set (const char *s) |
| void | unset () |
| bool | is_binary () const |
| const char * | dump_to (xstring &out) const |
| const char * | dump () const |
| const char * | hexdump_to (xstring &out) const |
| const char * | hexdump () const |
| xstring & | url_decode (int flags=0) |
| xstring & | append_url_encoded (const char *s, int len, const char *unsafe) |
| xstring & | append_url_encoded (const char *s, const char *unsafe) |
| xstring & | append_url_encoded (const xstring &s, const char *unsafe) |
| xstring & | append_quoted (const char *s, int len) |
| xstring & | append_quoted (const char *s) |
| xstring & | hex_decode () |
Public Member Functions inherited from xstring0 | |
| ~xstring0 () | |
| operator const char * () const | |
| const char * | get () const |
| char * | get_non_const () |
| void | _clear () |
Static Public Member Functions | |
| xstring static xstring & | get_tmp () |
| static xstring & | get_tmp (const char *s) |
| static xstring & | get_tmp (const char *s, int n) |
| static char * | tmp_buf (int n) |
| static xstring & | vformat (const char *fmt, va_list ap) |
| static xstring & | format (const char *fmt,...) PRINTF_LIKE(1 |
| static xstring static xstring & | cat (const char *first,...) ATTRIBUTE_SENTINEL |
| static xstring & | join (const char *sep, int n,...) |
Static Public Attributes | |
| static xstring | null |
Additional Inherited Members | |
Protected Member Functions inherited from xstring0 | |
| xstring0 () | |
| xstring0 (const xstring0 &) | |
| int | _url_decode (size_t len, int flags) |
| int | _hex_decode (size_t len) |
Protected Attributes inherited from xstring0 | |
| char * | buf |
| xstring::xstring | ( | const xstring_clonable & | c) |
Definition at line 116 of file xstring.cc.
References xstring0::buf, get_space(), and memcpy.
|
inline |
Definition at line 162 of file xstring.h.
Referenced by append_padding().
| char * xstring::add_space | ( | size_t | s) |
Definition at line 72 of file xstring.cc.
References xstring0::get_non_const(), and get_space().
Referenced by append_padding(), and append_url_encoded().
| xstring & xstring::append | ( | const char * | s) |
Definition at line 160 of file xstring.cc.
Referenced by append_quoted(), append_url_encoded(), base32_decode(), CmdExec::builtin_lftp(), CmdExec::builtin_open(), FileAccess::Path::Change(), CMD(), cmd_at(), ParsedURL::Combine(), ArgV::Combine(), ArgV::CombineQuoted(), sockaddr_u::compact(), sockaddr_u::compact_addr(), Resolver::Do(), Http::Do(), DHT::Do(), dump_to(), Alias::Format(), BeNode::Format(), ResMgr::Format(), BeNode::Format1(), CopyJobEnv::FormatFinalWithPrefix(), Job::FormatJobTitle(), mgetJob::FormatStatus(), pgetJob::FormatStatus(), QueueFeeder::FormatStatus(), CopyJob::FormatStatus(), SessionJob::FormatStatus(), CmdExec::FormatStatus(), get_lftp_dir(), Speedometer::GetETAStrSFromSize(), Speedometer::GetETAStrSFromTime(), FileAccess::GetFileURL(), TorrentPeer::GetName(), Speedometer::GetStrS(), join(), ProtoLog::Log2(), ProtoLog::Log3(), DHT::MakeNodeId(), mvJob::mvJob(), QueueFeeder::NextCmd(), BeNode::Pack(), ParsedURL::parse(), KeyValueDB::Read(), readline_from_file(), DHT::Save(), HttpTracker::SendTrackerRequest(), History::Set(), Buffer::SetErrorCached(), squeeze_file_name(), Torrent::Status(), TorrentPeer::Status(), Subst(), and StatusLine::WriteLine().
| xstring & xstring::append | ( | char | c) |
Definition at line 164 of file xstring.cc.
References xstring0::buf, c, and get_space().
| xstring & xstring::append | ( | const char * | s, |
| size_t | len | ||
| ) |
Definition at line 151 of file xstring.cc.
References xstring0::buf, get_space(), and memcpy.
| xstring & xstring::append_padding | ( | int | len, |
| char | ch | ||
| ) |
Definition at line 170 of file xstring.cc.
References add_commit(), and add_space().
Referenced by Job::FormatJobTitle().
| xstring & xstring::append_quoted | ( | const char * | s, |
| int | len | ||
| ) |
Definition at line 1046 of file CmdExec.cc.
References append(), and CmdExec::needs_quotation().
Referenced by CmdExec::builtin_lftp(), CmdExec::builtin_open(), ArgV::CombineQuoted(), and QueueFeeder::NextCmd().
|
inline |
Definition at line 232 of file xstring.h.
References append_quoted().
Referenced by append_quoted().
| xstring & xstring::append_url_encoded | ( | const char * | s, |
| int | len, | ||
| const char * | unsafe | ||
| ) |
Definition at line 564 of file xstring.cc.
References add_space(), append(), appendf(), c, and need_quote.
Referenced by Http::Do(), url::encode(), and History::Set().
|
inline |
Definition at line 228 of file xstring.h.
References append_url_encoded().
Referenced by append_url_encoded().
Definition at line 229 of file xstring.h.
References append_url_encoded(), and length().
Referenced by append_url_encoded().
| xstring & xstring::appendf | ( | const char * | fmt, |
| ... | |||
| ) |
Definition at line 351 of file xstring.cc.
References vappendf().
Referenced by append_url_encoded(), CMD(), UdpTracker::Do(), dump_to(), BeNode::Format(), KeyValueDB::Format(), ResMgr::Format(), BeNode::Format1(), CopyJob::FormatBytesTimeRate(), CopyJobEnv::FormatFinalWithPrefix(), pgetJob::FormatJobs(), Job::FormatJobTitle(), mvJob::FormatStatus(), mgetJob::FormatStatus(), mkdirJob::FormatStatus(), TreatFileJob::FormatStatus(), SleepJob::FormatStatus(), pgetJob::FormatStatus(), QueueFeeder::FormatStatus(), CopyJob::FormatStatus(), FinderJob::FormatStatus(), clsJob::FormatStatus(), MirrorJob::FormatStatus(), CmdExec::FormatStatus(), TorrentJob::FormatStatus(), TorrentPeer::GetName(), hexdump_to(), BeNode::Pack(), HttpTracker::SendTrackerRequest(), Torrent::Status(), TorrentPeer::Status(), and Torrent::Torrent().
| bool xstring::begins_with | ( | const char * | o_buf, |
| size_t | o_len | ||
| ) | const |
Definition at line 177 of file xstring.cc.
References xstring0::buf, and memcmp.
Referenced by eq().
|
inline |
|
inline |
Definition at line 201 of file xstring.h.
References xstring0::buf.
Referenced by ParsedURL::Combine(), ArgV::Combine(), ArgV::CombineQuoted(), mgetJob::Do(), Alias::Format(), KeyValueDB::Format(), ResMgr::Format(), get_lftp_home_nocreate(), readline_from_file(), and Subst().
|
static |
Definition at line 385 of file xstring.cc.
References get_tmp(), and vappend().
Referenced by CMD(), CmdExec::default_cmd(), LocalAccess::Do(), Fish::Do(), Ftp::Do(), SFtp::Do(), get_lftp_dir(), get_lftp_home_nocreate(), Speedometer::GetETAStrFromTime(), NetRC::LookupHost(), FileAccess::Protocol::NewSession(), and SleepJob::Status().
Definition at line 300 of file xstring.cc.
Referenced by FileAccess::Path::Change(), ProtoLog::Log2(), Ftp::ParseLongList(), and rtrim().
|
inline |
| const char * xstring::dump | ( | ) | const |
Definition at line 444 of file xstring.cc.
References dump_to(), and get_tmp().
Referenced by Buffer::Dump().
| const char * xstring::dump_to | ( | xstring & | out) | const |
Definition at line 448 of file xstring.cc.
References append(), appendf(), xstring0::buf, hexdump_to(), is_binary(), length(), mbsnwidth(), s, and truncate().
Referenced by dump().
| bool xstring::ends_with | ( | const char * | o_buf, |
| size_t | o_len | ||
| ) | const |
Definition at line 189 of file xstring.cc.
References xstring0::buf, and memcmp.
|
inline |
| bool xstring::eq | ( | const char * | o_buf, |
| size_t | o_len | ||
| ) | const |
Definition at line 201 of file xstring.cc.
References begins_with().
Referenced by _xmap::_lookup(), FileAccess::Path::Change(), TorrentPeer::Do(), BeNode::Format1(), DHT::HandlePacket(), SSH_Access::HandleSSHMessage(), SSH_Access::LogSSHMessage(), and ne().
|
inline |
|
static |
Definition at line 377 of file xstring.cc.
References vformat().
Referenced by CmdExec::builtin_open(), FileAccess::Path::Change(), CMD(), BeNode::ComputeLength(), NetAccess::DelayingMessage(), Resolver::Do(), Http::Do(), MirrorJob::Do(), UdpTracker::Do(), SendTermFD::Do(), Ftp::Do(), LocalListInfo::Do(), LocalGlob::Do(), TorrentPeer::Do(), CopyJob::FormatBytesTimeRate(), CmdExec::FormatPrompt(), AcceptTermFD::get_sock_path(), TorrentPeer::GetName(), ArgV::getopt_error_message(), Speedometer::GetStr(), DHT::HandlePacket(), url::hide_password(), FileInfo::MakeLongName(), ResClient::Query(), url::remove_password(), MirrorJob::SetScriptFile(), FtpDirList::Status(), HttpDirList::Status(), TorrentTracker::Status(), CopyJob::Status(), GenericParseListInfo::Status(), FishDirList::Status(), Torrent::Status(), LocalListInfo::Status(), TorrentPeer::Status(), SFtpDirList::Status(), SFtpListInfo::Status(), and sockaddr_u::to_xstring().
| void xstring::get_space | ( | size_t | s) |
Definition at line 58 of file xstring.cc.
References get_space2().
Referenced by add_space(), append(), nset(), PatternSet::Regex::Regex(), set_substr(), Torrent::SHA1(), shell_encode(), tmp_buf(), vappend(), vappendf(), and xstring().
| void xstring::get_space2 | ( | size_t | s, |
| size_t | g | ||
| ) |
Definition at line 62 of file xstring.cc.
References xstring0::buf, s, xmalloc(), and xrealloc().
Referenced by Buffer::Allocate(), and get_space().
|
static |
Definition at line 360 of file xstring.cc.
References move_here().
Referenced by xmap_p< BeNode >::add(), CmdExec::builtin_open(), CmdExec::builtin_queue(), cat(), FDCache::Close(), CMD(), url::decode(), dir_file(), dirname(), LocalAccess::Do(), CmdExec::Do(), Torrent::Do(), Buffer::Dump(), dump(), url::encode(), expand_home_relative(), CmdExec::FeedQuoted(), get_lftp_dir(), sockaddr_compact::get_tmp(), Speedometer::GetETAStrFromSize(), Speedometer::GetETAStrFromTime(), Speedometer::GetStr(), Glob::Glob(), SSH_Access::HandleSSHMessage(), hexdump(), join(), ProtoLog::Log3(), ProtoLog::LogError(), ProtoLog::LogNote(), SSH_Access::LogSSHMessage(), xmap< bool >::lookup(), xmap_p< BeNode >::lookup(), FileAccess::MkdirMakeSet(), BeNode::Pack(), ParseFtpLongList_EPLF(), CopyJobEnv::SayFinal(), Torrent::Status(), tmp_buf(), TimeInterval::toString(), Torrent::ValidatePiece(), vformat(), and StatusLine::WriteTitle().
|
inlinestatic |
|
inlinestatic |
| xstring & xstring::hex_decode | ( | ) |
Definition at line 556 of file xstring.cc.
References xstring0::_hex_decode(), length(), and set_length().
Referenced by Torrent::Do().
| const char * xstring::hexdump | ( | ) | const |
Definition at line 440 of file xstring.cc.
References get_tmp(), and hexdump_to().
Referenced by DHT::DHT(), DHT::Do(), and DHT::HandlePacket().
| const char * xstring::hexdump_to | ( | xstring & | out) | const |
Definition at line 432 of file xstring.cc.
References appendf(), xstring0::buf, length(), and s.
| int xstring::instr | ( | char | c) | const |
Definition at line 317 of file xstring.cc.
References xstring0::buf.
Referenced by TorrentTracker::AddPeer(), and Torrent::Do().
| bool xstring::is_binary | ( | ) | const |
Definition at line 425 of file xstring.cc.
Referenced by dump_to().
|
static |
Definition at line 394 of file xstring.cc.
References a, append(), get_tmp(), length(), and truncate().
|
inline |
Definition at line 212 of file xstring.h.
References xstring0::buf.
Referenced by FileAccess::Path::Change(), mvJob::mvJob(), and ParsedURL::parse().
|
inline |
Definition at line 164 of file xstring.h.
Referenced by Buffer::Allocate(), Buffer::Append(), append(), append_url_encoded(), FileAccess::Path::Change(), LsCache::Changed(), CMD(), sockaddr_u::compact(), BeNode::ComputeLength(), TorrentPeer::PacketPiece::ComputeLength(), TorrentPeer::PacketExtended::ComputeLength(), DHT::Do(), FileVerificator::Do(), Torrent::Do(), dump_to(), DirectedBuffer::EmbraceNewData(), url::encode(), eq(), LsCacheEntryData::EstimateSize(), sockaddr_compact::family(), LsCacheEntryData::GetData(), Speedometer::GetETAStrSFromSize(), Speedometer::GetETAStrSFromTime(), LsCacheEntryData::GetFileSet(), Buffer::GetSaved(), Buffer::GetSpace(), Speedometer::GetStrS(), DHT::HandlePacket(), hex_decode(), hexdump_to(), join(), DHT::Load(), _xmap::make_hash(), DHT::MakeNodeId(), FileAccess::Path::Optimize(), BeNode::Pack(), TorrentPeer::PacketPiece::PacketPiece(), Ftp::ParseLongList(), sockaddr_compact::port(), Buffer::Put(), OutputJob::Put(), IOBuffer::Put(), DirectedBuffer::PutTranslated(), KeyValueDB::Read(), readline_from_file(), TorrentListener::SendUDP(), set(), sockaddr_u::set_compact(), set_substr(), Torrent::SHA1(), TorrentJob::ShowRunStatus(), Buffer::Size(), Buffer::SpaceAdd(), Torrent::Status(), strip_trailing_slashes(), Torrent::Torrent(), url_decode(), Torrent::ValidatePiece(), and StatusLine::WriteLine().
Definition at line 138 of file xstring.cc.
References xstring0::buf, unset(), and xfree().
Referenced by Torrent::Do(), and get_tmp().
Definition at line 209 of file xstring.h.
References eq().
Referenced by FileAccess::MkdirMakeSet().
| xstring & xstring::nset | ( | const char * | s, |
| int | len | ||
| ) |
Definition at line 90 of file xstring.cc.
References xstring0::buf, get_space(), memcpy, and xfree().
Referenced by Buffer::Allocate(), Http::Do(), get_tmp(), BeNode::Parse(), Ftp::ParseLongList(), set(), TorrentPeer::PacketExtended::SetAppendix(), FileInfo::SetAssociatedData(), LsCacheEntryData::SetData(), TorrentPeer::PacketPiece::Unpack(), TorrentPeer::PacketExtended::Unpack(), and SFtp::Packet::UnpackString().
| void xstring::rtrim | ( | char | c = ' ') |
Definition at line 307 of file xstring.cc.
References chomp().
Referenced by CMD(), GetFileInfo::Do(), and FileVerificator::Do().
Definition at line 166 of file xstring.h.
References length(), and nset().
Referenced by _xmap::_add(), CmdExec::builtin_lftp(), FileAccess::Path::Change(), FileAccess::ClearError(), FileCopyPeerFA::Clone(), Http::Close(), FileAccess::Close(), CMD(), dir_file(), pgetJob::Do(), Resolver::Do(), GetFileInfo::Do(), Http::Do(), FileVerificator::Do(), Ftp::Do(), FileAccess::ExpandTildeStatic(), FileInfo::FileInfo(), BeNode::Format(), BeNode::Format1(), get_tmp(), OutputFilter::getfd(), FileAccess::GetFileURL(), Job::Kill(), DHT::Load(), LocalAccess::MakeGlob(), module_load(), GetJob::NextFile(), FileAccess::Open(), FileAccess::Open2(), TorrentPeer::PacketPiece::PacketPiece(), ParsedURL::parse(), Ftp::ParseLongList(), GetJob::RemoveBackupFile(), Error::Set(), FileAccess::set_real_cwd(), Buffer::SetError(), FileAccess::SetError(), FileAccess::SetFileURL(), FileInfo::SetLongName(), FileInfo::SetName(), FileAccess::SetPasswordGlobal(), TorrentTracker::SetTrackerID(), squeeze_file_name(), Torrent::Torrent(), and url_file().
| xstring & xstring::set | ( | const char * | s) |
Definition at line 111 of file xstring.cc.
| xstring & xstring::set_allocated | ( | char * | s) |
Definition at line 126 of file xstring.cc.
References xstring0::buf, s, unset(), and xfree().
Referenced by CmdExec::builtin_lftp(), CMD(), mgetJob::Do(), MirrorJob::Do(), FileAccess::GetFileURL(), SleepJob::SleepJob(), url_file(), and StatusLine::WriteTitle().
|
inline |
Definition at line 200 of file xstring.h.
References xstring0::buf, and n.
Referenced by hex_decode(), PatternSet::Regex::Regex(), Torrent::SHA1(), shell_encode(), Buffer::SpaceAdd(), truncate(), url_decode(), and vappendf().
| xstring & xstring::set_substr | ( | int | start, |
| size_t | sublen, | ||
| const char * | s, | ||
| size_t | s_len | ||
| ) |
Definition at line 283 of file xstring.cc.
References get_space(), and memcpy.
Referenced by CMD(), GenericParseListInfo::Do(), and set_substr().
| xstring & xstring::set_substr | ( | int | start, |
| size_t | sublen, | ||
| const char * | s | ||
| ) |
Definition at line 295 of file xstring.cc.
References set_substr(), and xstrlen().
Definition at line 173 of file xstring.h.
References xstring0::get(), length(), and set_substr().
Referenced by set_substr().
| xstring & xstring::setf | ( | const char * | fmt, |
| ... | |||
| ) |
Definition at line 343 of file xstring.cc.
References vsetf().
Referenced by Http::Do(), and History::Set().
| unsigned xstring::skip_all | ( | unsigned | i, |
| char | c | ||
| ) | const |
Definition at line 311 of file xstring.cc.
|
static |
Definition at line 371 of file xstring.cc.
References xstring0::get_non_const(), get_space(), and get_tmp().
Referenced by sockaddr_u::address(), and ResMgr::ERegExpValidate().
| void xstring::truncate | ( | size_t | n = 0) |
Definition at line 266 of file xstring.cc.
References set_length().
Referenced by Buffer::Allocate(), Buffer::Append(), dirname_modify(), HttpDirList::Do(), dump_to(), Buffer::Empty(), join(), Job::ListOneJob(), Job::ListOneJobRecursively(), QueueFeeder::NextCmd(), FileAccess::Path::Optimize(), ParsedURL::parse(), Job::PrintStatus(), KeyValueDB::Read(), Buffer::SaveRollback(), strip_trailing_slashes(), vset(), and vsetf().
| void xstring::truncate_at | ( | char | c) |
Definition at line 271 of file xstring.cc.
References xstring0::buf, and p.
Referenced by Http::Do().
|
inline |
Definition at line 218 of file xstring.h.
References _clear(), xstring0::buf, and xfree().
Referenced by move_here(), and set_allocated().
| xstring & xstring::url_decode | ( | int | flags = 0) |
Definition at line 545 of file xstring.cc.
References xstring0::_url_decode(), length(), and set_length().
Referenced by url::decode(), and ParsedURL::parse().
| xstring & xstring::vappend | ( | va_list | va) |
Definition at line 238 of file xstring.cc.
References get_space().
Referenced by cat(), FileInfo::MakeLongName(), vappend(), and vset().
| xstring & xstring::vappend | ( | ...) |
Definition at line 247 of file xstring.cc.
References vappend().
| xstring & xstring::vappendf | ( | const char * | fmt, |
| va_list | ap | ||
| ) |
Definition at line 325 of file xstring.cc.
References get_space(), set_length(), and vsnprintf().
Referenced by appendf(), ProtoLog::LogError(), ProtoLog::LogNote(), and vsetf().
|
inlinestatic |
Definition at line 191 of file xstring.h.
References get_tmp(), and vsetf().
Referenced by ColumnOutput::addf(), StringSet::AppendFormat(), Log::Format(), OutputJob::Format(), format(), Log::vFormat(), and StatusLine::WriteLine().
| xstring & xstring::vset | ( | ...) |
Definition at line 256 of file xstring.cc.
References truncate(), and vappend().
Referenced by Bookmark::Bookmark(), CMD(), dir_file(), Resolver::Do(), expand_home_relative(), PtyShell::getfd(), OutputFilter::getfd(), FileCopy::GetStatus(), History::History(), FDStream::MakeErrorText(), FileInfo::MakeLongName(), module_load(), ParsedURL::parse(), pgetJob::pgetJob(), FileAccess::SetError(), squeeze_file_name(), GenericGlob::Status(), DummyNoProto::StrError(), FileAccess::StrError(), and StatusLine::WriteTitle().
|
inline |
Definition at line 183 of file xstring.h.
References truncate(), and vappendf().
|
static |
Definition at line 236 of file xstring.h.
Referenced by url::decode(), url::encode(), BeNode::lookup_str(), and shell_encode().