Make bitcoind invalid argument error message specific

The current message is not helpful. Hardly anyone even remembers that
bitcoind used to be a cli utility, let alone new users. Print what the
actual problem is.
This commit is contained in:
Wladimir J. van der Laan 2017-05-24 09:28:51 +02:00
parent 7e96ecf075
commit cd5622dcaf

View File

@ -117,17 +117,14 @@ bool AppInit(int argc, char* argv[])
return false; return false;
} }
// Command-line RPC // Error out when loose non-argument tokens are encountered on command line
bool fCommandLine = false; for (int i = 1; i < argc; i++) {
for (int i = 1; i < argc; i++) if (!IsSwitchChar(argv[i][0])) {
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "bitcoin:")) fprintf(stderr, "Error: Command line contains unexpected token '%s', see bitcoind -h for a list of options.\n", argv[i]);
fCommandLine = true; exit(EXIT_FAILURE);
}
if (fCommandLine)
{
fprintf(stderr, "Error: There is no RPC client functionality in bitcoind anymore. Use the bitcoin-cli utility instead.\n");
exit(EXIT_FAILURE);
} }
// -server defaults to true for bitcoind but not for the GUI so do this here // -server defaults to true for bitcoind but not for the GUI so do this here
SoftSetBoolArg("-server", true); SoftSetBoolArg("-server", true);
// Set this early so that parameter interactions go to console // Set this early so that parameter interactions go to console