Skip to content

Commit

Permalink
scripted-diff: gArgs -> args
Browse files Browse the repository at this point in the history
-BEGIN VERIFY SCRIPT-
 # Replace gArgs with args
 sed -i 's/\<gArgs\>/args/g' src/init.cpp src/bitcoind.cpp
 sed -i 's/&args;/\&gArgs;/g' src/init.cpp

 # Format changed lines
 git diff -U0 | clang-format-diff -p1 -i -v
-END VERIFY SCRIPT-
  • Loading branch information
MarcoFalke committed Aug 22, 2020
1 parent 03c2eb4 commit c1325f8
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 146 deletions.
26 changes: 11 additions & 15 deletions src/bitcoind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,19 @@ static bool AppInit(int argc, char* argv[])
SetupServerArgs(node);
ArgsManager& args = *Assert(node.args);
std::string error;
if (!gArgs.ParseParameters(argc, argv, error)) {
if (!args.ParseParameters(argc, argv, error)) {
return InitError(Untranslated(strprintf("Error parsing command line arguments: %s\n", error)));
}

// Process help and version before taking care about datadir
if (HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
if (HelpRequested(args) || args.IsArgSet("-version")) {
std::string strUsage = PACKAGE_NAME " version " + FormatFullVersion() + "\n";

if (gArgs.IsArgSet("-version"))
{
if (args.IsArgSet("-version")) {
strUsage += FormatParagraph(LicenseInfo()) + "\n";
}
else
{
} else {
strUsage += "\nUsage: bitcoind [options] Start " PACKAGE_NAME "\n";
strUsage += "\n" + gArgs.GetHelpMessage();
strUsage += "\n" + args.GetHelpMessage();
}

tfm::format(std::cout, "%s", strUsage);
Expand All @@ -80,14 +77,14 @@ static bool AppInit(int argc, char* argv[])
try
{
if (!CheckDataDirOption()) {
return InitError(Untranslated(strprintf("Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", ""))));
return InitError(Untranslated(strprintf("Specified data directory \"%s\" does not exist.\n", args.GetArg("-datadir", ""))));
}
if (!gArgs.ReadConfigFiles(error, true)) {
if (!args.ReadConfigFiles(error, true)) {
return InitError(Untranslated(strprintf("Error reading configuration file: %s\n", error)));
}
// Check for -chain, -testnet or -regtest parameter (Params() calls are only valid after this clause)
try {
SelectParams(gArgs.GetChainName());
SelectParams(args.GetChainName());
} catch (const std::exception& e) {
return InitError(Untranslated(strprintf("%s\n", e.what())));
}
Expand All @@ -99,13 +96,13 @@ static bool AppInit(int argc, char* argv[])
}
}

if (!gArgs.InitSettings(error)) {
if (!args.InitSettings(error)) {
InitError(Untranslated(error));
return false;
}

// -server defaults to true for bitcoind but not for the GUI so do this here
gArgs.SoftSetBoolArg("-server", true);
args.SoftSetBoolArg("-server", true);
// Set this early so that parameter interactions go to console
InitLogging(args);
InitParameterInteraction(args);
Expand All @@ -122,8 +119,7 @@ static bool AppInit(int argc, char* argv[])
// InitError will have been called with detailed error, which ends up on console
return false;
}
if (gArgs.GetBoolArg("-daemon", false))
{
if (args.GetBoolArg("-daemon", false)) {
#if HAVE_DECL_DAEMON
#if defined(MAC_OSX)
#pragma GCC diagnostic push
Expand Down

0 comments on commit c1325f8

Please sign in to comment.