From 105425b7f69ae115ec287242fdf12d6a8458a10f Mon Sep 17 00:00:00 2001 From: stoffu Date: Thu, 19 Oct 2017 21:57:49 +0900 Subject: simplewallet: reject invalid argument for boolean parameter --- src/common/command_line.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/common/command_line.cpp') diff --git a/src/common/command_line.cpp b/src/common/command_line.cpp index 666b3267f..d4a28fc85 100644 --- a/src/common/command_line.cpp +++ b/src/common/command_line.cpp @@ -78,6 +78,20 @@ namespace command_line return false; } + bool is_no(const std::string& str) + { + if (str == "n" || str == "N") + return true; + + boost::algorithm::is_iequal ignore_case{}; + if (boost::algorithm::equals("no", str, ignore_case)) + return true; + if (boost::algorithm::equals(command_line::tr("no"), str, ignore_case)) + return true; + + return false; + } + const arg_descriptor arg_help = {"help", "Produce help message"}; const arg_descriptor arg_version = {"version", "Output version information"}; const arg_descriptor arg_data_dir = {"data-dir", "Specify data directory"}; -- cgit v1.2.3