MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ParseArgs

Function ParseArgs

src/bitcoind.cpp:114–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112#endif
113
114static 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
137static bool ProcessInitCommands(interfaces::Init& init, ArgsManager& args)
138{

Callers 1

bitcoind.cppFile · 0.85

Calls 7

SetupServerArgsFunction · 0.85
InitErrorFunction · 0.85
UntranslatedFunction · 0.85
InitConfigFunction · 0.85
IsSwitchCharFunction · 0.85
ParseParametersMethod · 0.80
canListenIpcMethod · 0.45

Tested by

no test coverage detected