aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoind.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bitcoind.cpp')
-rw-r--r--src/bitcoind.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
index 0dc2dfbf7d..5c711c0773 100644
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -1,5 +1,5 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2017 The Bitcoin Core developers
+// Copyright (c) 2009-2018 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -14,14 +14,13 @@
#include <rpc/server.h>
#include <init.h>
#include <noui.h>
+#include <shutdown.h>
#include <util.h>
#include <httpserver.h>
#include <httprpc.h>
#include <utilstrencodings.h>
#include <walletinitinterface.h>
-#include <boost/thread.hpp>
-
#include <stdio.h>
/* Introduction text for doxygen: */
@@ -30,17 +29,19 @@
*
* \section intro_sec Introduction
*
- * This is the developer documentation of the reference client for an experimental new digital currency called Bitcoin (https://www.bitcoin.org/),
+ * This is the developer documentation of the reference client for an experimental new digital currency called Bitcoin,
* which enables instant payments to anyone, anywhere in the world. Bitcoin uses peer-to-peer technology to operate
* with no central authority: managing transactions and issuing money are carried out collectively by the network.
*
* The software is a community-driven open source project, released under the MIT license.
*
+ * See https://github.com/bitcoin/bitcoin and https://bitcoincore.org/ for further information about the project.
+ *
* \section Navigation
* Use the buttons <code>Namespaces</code>, <code>Classes</code> or <code>Files</code> at the top of the page to start navigating the code.
*/
-void WaitForShutdown()
+static void WaitForShutdown()
{
while (!ShutdownRequested())
{
@@ -53,7 +54,7 @@ void WaitForShutdown()
//
// Start
//
-bool AppInit(int argc, char* argv[])
+static bool AppInit(int argc, char* argv[])
{
bool fRet = false;
@@ -61,11 +62,16 @@ bool AppInit(int argc, char* argv[])
// Parameters
//
// If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
- gArgs.ParseParameters(argc, argv);
+ SetupServerArgs();
+ std::string error;
+ if (!gArgs.ParseParameters(argc, argv, error)) {
+ fprintf(stderr, "Error parsing command line arguments: %s\n", error.c_str());
+ return false;
+ }
// Process help and version before taking care about datadir
if (HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
- std::string strUsage = strprintf(_("%s Daemon"), _(PACKAGE_NAME)) + " " + _("version") + " " + FormatFullVersion() + "\n";
+ std::string strUsage = strprintf("%s Daemon", PACKAGE_NAME) + " version " + FormatFullVersion() + "\n";
if (gArgs.IsArgSet("-version"))
{
@@ -73,10 +79,10 @@ bool AppInit(int argc, char* argv[])
}
else
{
- strUsage += "\n" + _("Usage:") + "\n" +
- " bitcoind [options] " + strprintf(_("Start %s Daemon"), _(PACKAGE_NAME)) + "\n";
+ strUsage += "\nUsage:\n"
+ " bitcoind [options] " + strprintf("Start %s Daemon", PACKAGE_NAME) + "\n";
- strUsage += "\n" + HelpMessage(HelpMessageMode::BITCOIND);
+ strUsage += "\n" + gArgs.GetHelpMessage();
}
fprintf(stdout, "%s", strUsage.c_str());
@@ -90,11 +96,8 @@ bool AppInit(int argc, char* argv[])
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "").c_str());
return false;
}
- try
- {
- gArgs.ReadConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME));
- } catch (const std::exception& e) {
- fprintf(stderr,"Error reading configuration file: %s\n", e.what());
+ if (!gArgs.ReadConfigFiles(error)) {
+ fprintf(stderr, "Error reading configuration file: %s\n", error.c_str());
return false;
}
// Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)