return false;
}
- if (mapArgs.count("-debug"))
- fDebug = true;
+ fDebug = GetBoolArg("-debug");
- if (mapArgs.count("-printtodebugger"))
- fPrintToDebugger = true;
+ fPrintToDebugger = GetBoolArg("-printtodebugger");
- if (mapArgs.count("-testnet"))
- fTestNet = true;
+ fTestNet = GetBoolArg("-testnet");
if (fCommandLine)
{
#endif
printf("Default data directory %s\n", GetDefaultDataDir().c_str());
- if (mapArgs.count("-loadblockindextest"))
+ if (GetBoolArg("-loadblockindextest"))
{
CTxDB txdb("r");
txdb.LoadBlockIndex();
//
// Parameters
//
- if (mapArgs.count("-printblockindex") || mapArgs.count("-printblocktree"))
+ if (GetBoolArg("-printblockindex") || GetBoolArg("-printblocktree"))
{
PrintBlockTree();
return false;
return false;
}
- if (mapArgs.count("-gen"))
- {
- if (mapArgs["-gen"].empty())
- fGenerateBitcoins = true;
- else
- fGenerateBitcoins = (atoi(mapArgs["-gen"].c_str()) != 0);
- }
+ fGenerateBitcoins = GetBoolArg("-gen");
if (mapArgs.count("-proxy"))
{
if (!CreateThread(StartNode, NULL))
wxMessageBox("Error: CreateThread(StartNode) failed", "Bitcoin");
- if (mapArgs.count("-server") || fDaemon)
+ if (GetBoolArg("-server") || fDaemon)
CreateThread(ThreadRPCServer, NULL);
#if defined(__WXMSW__) && defined(GUI)
{
if (mapArgs.count("-connect"))
return;
- if (mapArgs.count("-noirc"))
+ if (GetBoolArg("-noirc"))
return;
printf("ThreadIRCSeed started\n");
int nErrorWait = 10;
int nPriority = 0;
string strStatusBar;
string strRPC;
- if (mapArgs.count("-testsafemode"))
+ if (GetBoolArg("-testsafemode"))
strRPC = "test";
// Misc warnings like out of disk space and clock is wrong
dPriority += (double)nValueIn * nConf;
- if (fDebug && mapArgs.count("-printpriority"))
+ if (fDebug && GetBoolArg("-printpriority"))
printf("priority nValueIn=%-12I64d nConf=%-5d dPriority=%-20.1f\n", nValueIn, nConf, dPriority);
}
else
mapPriority.insert(make_pair(-dPriority, &(*mi).second));
- if (fDebug && mapArgs.count("-printpriority"))
+ if (fDebug && GetBoolArg("-printpriority"))
{
printf("priority %-20.1f %s\n%s", dPriority, tx.GetHash().ToString().substr(0,10).c_str(), tx.ToString().c_str());
if (porphan)
SetThreadPriority(THREAD_PRIORITY_LOWEST);
bool f4WaySSE2 = Detect128BitSSE2();
if (mapArgs.count("-4way"))
- f4WaySSE2 = (mapArgs["-4way"] != "0");
+ f4WaySSE2 = GetBoolArg(mapArgs["-4way"]);
// Each thread has its own key and counter
CReserveKey reservekey;
return;
}
- bool fUseSSL = (mapArgs.count("-rpcssl") > 0);
+ bool fUseSSL = GetBoolArg("-rpcssl");
asio::ip::address bindAddress = mapArgs.count("-rpcallowip") ? asio::ip::address_v4::any() : asio::ip::address_v4::loopback();
asio::io_service io_service;
}
#else
if (fUseSSL)
- throw runtime_error("-rpcssl=true, but bitcoin compiled without full openssl libraries.");
+ throw runtime_error("-rpcssl=1, but bitcoin compiled without full openssl libraries.");
#endif
loop
// Observe safe mode
string strWarning = GetWarnings("rpc");
- if (strWarning != "" && !mapArgs.count("-disablesafemode") && !setAllowInSafeMode.count(strMethod))
+ if (strWarning != "" && !GetBoolArg("-disablesafemode") && !setAllowInSafeMode.count(strMethod))
throw JSONRPCError(-2, string("Safe mode: ") + strWarning);
try
GetConfigFile().c_str()));
// Connect to localhost
- bool fUseSSL = (mapArgs.count("-rpcssl") > 0);
+ bool fUseSSL = GetBoolArg("-rpcssl");
#ifdef USE_SSL
asio::io_service io_service;
ssl::context context(io_service, ssl::context::sslv23);
throw runtime_error("couldn't connect to server");
#else
if (fUseSSL)
- throw runtime_error("-rpcssl=true, but bitcoin compiled without full openssl libraries.");
+ throw runtime_error("-rpcssl=1, but bitcoin compiled without full openssl libraries.");
ip::tcp::iostream stream(GetArg("-rpcconnect", "127.0.0.1"), GetArg("-rpcport", "8332"));
if (stream.fail())
class CAutoFile;
static const unsigned int MAX_SIZE = 0x02000000;
-static const int VERSION = 31701;
+static const int VERSION = 31702;
static const char* pszSubVer = "";
if (!event.Iconized())
fClosedToTray = false;
#if defined(__WXGTK__) || defined(__WXMAC_OSX__)
- if (mapArgs.count("-minimizetotray")) {
+ if (GetBoolArg("-minimizetotray")) {
#endif
// The tray icon sometimes disappears on ubuntu karmic
// Hiding the taskbar button doesn't work cleanly on ubuntu lucid
#endif
#if defined(__WXGTK__) || defined(__WXMAC_OSX__)
m_checkBoxStartOnSystemStartup->SetLabel(_("&Start Bitcoin on window system startup"));
- if (!mapArgs.count("-minimizetotray"))
+ if (!GetBoolArg("-minimizetotray"))
{
// Minimize to tray is just too buggy on Linux
fMinimizeToTray = false;
void CreateMainWindow()
{
pframeMain = new CMainFrame(NULL);
- if (mapArgs.count("-min"))
+ if (GetBoolArg("-min"))
pframeMain->Iconize(true);
#if defined(__WXGTK__) || defined(__WXMAC_OSX__)
- if (!mapArgs.count("-minimizetotray"))
+ if (!GetBoolArg("-minimizetotray"))
fMinimizeToTray = false;
#endif
pframeMain->Show(true); // have to show first to get taskbar button to hide
return nDefault;
}
+inline bool GetBoolArg(const string& strArg)
+{
+ if (mapArgs.count(strArg))
+ {
+ if (mapArgs[strArg].empty())
+ return true;
+ return (atoi(mapArgs[strArg]) != 0);
+ }
+ return false;
+}
+
inline string FormatVersion(int nVersion)
{
if (nVersion%100 == 0)