diff options
| author | Wladimir J. van der Laan <[email protected]> | 2014-11-25 12:21:40 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2014-11-25 14:44:30 +0100 |
| commit | ac0b2393a447bb20f8b0489a67237c98a1cfff4a (patch) | |
| tree | 79f8da4115889e1bead6912f96f6063b3ef4d534 /src/bitcoind.cpp | |
| parent | Merge pull request #5241 (diff) | |
| parent | Process help and version arguments before datadir. (diff) | |
| download | discoin-ac0b2393a447bb20f8b0489a67237c98a1cfff4a.tar.xz discoin-ac0b2393a447bb20f8b0489a67237c98a1cfff4a.zip | |
Merge pull request #5351
3d0a1ce Process help and version arguments before datadir. (Pavel JanÃk)
Diffstat (limited to 'src/bitcoind.cpp')
| -rw-r--r-- | src/bitcoind.cpp | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index a79e581a8..be7757b0b 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -59,13 +59,36 @@ bool AppInit(int argc, char* argv[]) boost::thread* detectShutdownThread = NULL; bool fRet = false; + + // + // Parameters + // + // If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main() + ParseParameters(argc, argv); + + // Process help and version before taking care about datadir + if (mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version")) + { + std::string strUsage = _("Bitcoin Core Daemon") + " " + _("version") + " " + FormatFullVersion() + "\n"; + + if (mapArgs.count("-version")) + { + strUsage += LicenseInfo(); + } + else + { + strUsage += "\n" + _("Usage:") + "\n" + + " bitcoind [options] " + _("Start Bitcoin Core Daemon") + "\n"; + + strUsage += "\n" + HelpMessage(HMM_BITCOIND); + } + + fprintf(stdout, "%s", strUsage.c_str()); + return false; + } + try { - // - // Parameters - // - // If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main() - ParseParameters(argc, argv); if (!boost::filesystem::is_directory(GetDataDir(false))) { fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str()); @@ -84,26 +107,6 @@ bool AppInit(int argc, char* argv[]) return false; } - if (mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version")) - { - std::string strUsage = _("Bitcoin Core Daemon") + " " + _("version") + " " + FormatFullVersion() + "\n"; - - if (mapArgs.count("-version")) - { - strUsage += LicenseInfo(); - } - else - { - strUsage += "\n" + _("Usage:") + "\n" + - " bitcoind [options] " + _("Start Bitcoin Core Daemon") + "\n"; - - strUsage += "\n" + HelpMessage(HMM_BITCOIND); - } - - fprintf(stdout, "%s", strUsage.c_str()); - return false; - } - // Command-line RPC bool fCommandLine = false; for (int i = 1; i < argc; i++) |