| 112 | #endif |
| 113 | |
| 114 | static bool ParseArgs(NodeContext& node, int argc, char* argv[]) |
| 115 | { |
| 116 | ArgsManager& args{*Assert(node.args)}; |
| 117 | // If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main() |
| 118 | SetupServerArgs(args, node.init->canListenIpc()); |
| 119 | std::string error; |
| 120 | if (!args.ParseParameters(argc, argv, error)) { |
| 121 | return InitError(Untranslated(strprintf("Error parsing command line arguments: %s", error))); |
| 122 | } |
| 123 | |
| 124 | if (auto error = common::InitConfig(args)) { |
| 125 | return InitError(error->message, error->details); |
| 126 | } |
| 127 | |
| 128 | // Error out when loose non-argument tokens are encountered on command line |
| 129 | for (int i = 1; i < argc; i++) { |
| 130 | if (!IsSwitchChar(argv[i][0])) { |
| 131 | return InitError(Untranslated(strprintf("Command line contains unexpected token '%s', see bitcoind -h for a list of options.", argv[i]))); |
| 132 | } |
| 133 | } |
| 134 | return true; |
| 135 | } |
| 136 | |
| 137 | static bool ProcessInitCommands(interfaces::Init& init, ArgsManager& args) |
| 138 | { |
no test coverage detected