aboutsummaryrefslogtreecommitdiff
path: root/init.cpp
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-07-25 16:45:21 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2010-07-25 16:45:21 +0000
commit3b7cd5d89a226426df9c723d1f9ddfe08b7d1def (patch)
treecb956c8dd87690dcd9e5d554286d39edbb199c32 /init.cpp
parente8bff10f07b80d820545661cee9337d8664a64cb (diff)
downloadbitcoin-3b7cd5d89a226426df9c723d1f9ddfe08b7d1def.tar.xz
Gavin Andresen's JSON-RPC HTTP authentication,
faster initial block download -- version 0.3.3 git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@109 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'init.cpp')
-rw-r--r--init.cpp85
1 files changed, 45 insertions, 40 deletions
diff --git a/init.cpp b/init.cpp
index 68e90aab04..d6d4562888 100644
--- a/init.cpp
+++ b/init.cpp
@@ -240,33 +240,34 @@ IMPLEMENT_APP(CMyApp)
bool CMyApp::Initialize(int& argc, wxChar** argv)
{
- if (argc > 1 && argv[1][0] != '-' && (!fWindows || argv[1][0] != '/') &&
- wxString(argv[1]) != "start")
- {
- fCommandLine = true;
- }
- else if (!fGUI)
- {
- fDaemon = true;
- }
- else
+ for (int i = 1; i < argc; i++)
+ if (!IsSwitchChar(argv[i][0]))
+ fCommandLine = true;
+
+ if (!fCommandLine)
{
- // wxApp::Initialize will remove environment-specific parameters,
- // so it's too early to call ParseParameters yet
- for (int i = 1; i < argc; i++)
+ if (!fGUI)
+ {
+ fDaemon = true;
+ }
+ else
{
- wxString str = argv[i];
- #ifdef __WXMSW__
- if (str.size() >= 1 && str[0] == '/')
- str[0] = '-';
- char pszLower[MAX_PATH];
- strlcpy(pszLower, str.c_str(), sizeof(pszLower));
- strlwr(pszLower);
- str = pszLower;
- #endif
- // haven't decided which argument to use for this yet
- if (str == "-daemon" || str == "-d" || str == "start")
- fDaemon = true;
+ // wxApp::Initialize will remove environment-specific parameters,
+ // so it's too early to call ParseParameters yet
+ for (int i = 1; i < argc; i++)
+ {
+ wxString str = argv[i];
+ #ifdef __WXMSW__
+ if (str.size() >= 1 && str[0] == '/')
+ str[0] = '-';
+ char pszLower[MAX_PATH];
+ strlcpy(pszLower, str.c_str(), sizeof(pszLower));
+ strlwr(pszLower);
+ str = pszLower;
+ #endif
+ if (str == "-daemon")
+ fDaemon = true;
+ }
}
}
@@ -375,22 +376,23 @@ bool CMyApp::OnInit2()
//
// Parameters
//
- if (fCommandLine)
- {
- int ret = CommandLineRPC(argc, argv);
- exit(ret);
- }
-
ParseParameters(argc, argv);
+
+ if (mapArgs.count("-datadir"))
+ strlcpy(pszSetDataDir, mapArgs["-datadir"].c_str(), sizeof(pszSetDataDir));
+
+ ReadConfigFile(mapArgs, mapMultiArgs); // Must be done after processing datadir
+
if (mapArgs.count("-?") || mapArgs.count("--help"))
{
wxString strUsage = string() +
_("Usage:") + "\t\t\t\t\t\t\t\t\t\t\n" +
- " bitcoin [options] \t" + "\n" +
- " bitcoin [command] \t" + _("Send command to bitcoin running with -server or -daemon\n") +
- " bitcoin [command] -? \t" + _("Get help for a command\n") +
- " bitcoin help <pw> \t" + _("List commands\n") +
+ " bitcoin [options] \t " + "\n" +
+ " bitcoin [options] <command> [params]\t " + _("Send command to -server or bitcoind\n") +
+ " bitcoin [options] <command> -? \t\t " + _("Get help for a command\n") +
+ " bitcoin help \t\t\t " + _("List commands\n") +
_("Options:\n") +
+ " -conf=<file> \t " + _("Specify configuration file (default: bitcoin.conf)\n") +
" -gen \t " + _("Generate coins\n") +
" -gen=0 \t " + _("Don't generate coins\n") +
" -min \t " + _("Start minimized\n") +
@@ -398,7 +400,7 @@ bool CMyApp::OnInit2()
" -proxy=<ip:port>\t " + _("Connect through socks4 proxy\n") +
" -addnode=<ip> \t " + _("Add a node to connect to\n") +
" -connect=<ip> \t " + _("Connect only to the specified node\n") +
- " -rpcpw=<pw> \t " + _("Accept command line and JSON-RPC commands with the given password\n") +
+ " -server \t " + _("Accept command line and JSON-RPC commands\n") +
" -daemon \t " + _("Run in the background as a daemon and accept commands\n") +
" -? \t " + _("This help message\n");
@@ -413,15 +415,18 @@ bool CMyApp::OnInit2()
return false;
}
- if (mapArgs.count("-datadir"))
- strlcpy(pszSetDataDir, mapArgs["-datadir"].c_str(), sizeof(pszSetDataDir));
-
if (mapArgs.count("-debug"))
fDebug = true;
if (mapArgs.count("-printtodebugger"))
fPrintToDebugger = true;
+ if (fCommandLine)
+ {
+ int ret = CommandLineRPC(argc, argv);
+ exit(ret);
+ }
+
if (!fDebug && !pszSetDataDir[0])
ShrinkDebugFile();
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
@@ -611,7 +616,7 @@ bool CMyApp::OnInit2()
if (!CreateThread(StartNode, NULL))
wxMessageBox("Error: CreateThread(StartNode) failed", "Bitcoin");
- if (mapArgs.count("-server") || mapArgs.count("-rpcpw") || fDaemon)
+ if (mapArgs.count("-server") || fDaemon)
CreateThread(ThreadRPCServer, NULL);
if (fFirstRun)