Remove GetCharArg(). Organize CLI options file.

GetCharArg() was either a hack to keep from segfaulting when using
this botched option parser or it was old forgotten code - or both.

GetCharArg() was not needed because from_string() has std::string
overloaded and every GetCharArg() made its way to from_string().

Note: when using from_string() with std::string, it must be caught!
This commit is contained in:
anonimal 2015-11-14 16:13:08 +00:00
parent 1eff72d525
commit 5ae7e35e80
9 changed files with 60 additions and 46 deletions

View file

@ -71,7 +71,7 @@ namespace client
ircPort, localDestination
);
ircTunnel->Start ();
// TODO: allow muliple tunnels on the same port (but on a different address)
// TODO: allow multiple tunnels on the same port (but on a different address)
m_ClientTunnels.insert(std::make_pair(
ircPort, std::unique_ptr<I2PClientTunnel>(ircTunnel)
));

View file

@ -76,9 +76,11 @@ namespace i2p
int port = i2p::util::config::GetArg("-port", 0);
if (port)
i2p::context.UpdatePort (port);
const char * host = i2p::util::config::GetCharArg("-host", "");
if (host && host[0])
i2p::context.UpdateAddress (boost::asio::ip::address::from_string (host));
const std::string host = i2p::util::config::GetArg("-host", "");
// The host option is deprecated, so this was always true.
// Because of -Waddress, it's now exposed as the hack it was.
if (&host && host[0])
i2p::context.UpdateAddress (boost::asio::ip::address::from_string (host));
i2p::context.SetSupportsV6 (i2p::util::config::GetArg("-v6", 0));
i2p::context.SetFloodfill (i2p::util::config::GetArg("-floodfill", 0));