3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2024-12-09 16:57:17 -08:00
parent 8f5658b77d
commit e8c2360043
3 changed files with 34 additions and 23 deletions

View file

@ -123,6 +123,13 @@ void display_usage() {
std::cout << " module_name.param_name=value for setting module parameters.\n";
std::cout << "Use 'z3 -p' for the complete list of global and module parameters.\n";
}
static bool validate_is_ulong(char const* s) {
for (; *s; ++s)
if (*s < '0' || *s > '9')
return false;
return true;
}
static void parse_cmd_line_args(std::string& input_file, int argc, char ** argv) {
long timeout = 0;
@ -220,6 +227,8 @@ static void parse_cmd_line_args(std::string& input_file, int argc, char ** argv)
else if (strcmp(opt_name, "v") == 0) {
if (!opt_arg)
error("option argument (-v:level) is missing.");
if (!validate_is_ulong(opt_arg))
error("invalid argument for -v option, it must be a non-negative integer.");
long lvl = strtol(opt_arg, nullptr, 10);
set_verbosity_level(lvl);
}
@ -229,6 +238,8 @@ static void parse_cmd_line_args(std::string& input_file, int argc, char ** argv)
else if (strcmp(opt_name, "T") == 0) {
if (!opt_arg)
error("option argument (-T:timeout) is missing.");
if (!validate_is_ulong(opt_arg))
error("invalid argument for -T option, it must be a non-negative integer.");
timeout = strtol(opt_arg, nullptr, 10);
}
else if (strcmp(opt_name, "t") == 0) {