ltlgrind: improve error message when formulas are missing

The error message, inherited from ltl2tgba, used to say "No formula to
translate", but "translate" isn't appropriate here.

* bin/common_finput.cc, bin/common_finput.hh (check_no_formula): Allow
"translate" to be changed.
* bin/ltlgrind.cc: Change it.
* tests/core/ltlgrind.test: Test it.
This commit is contained in:
Alexandre Duret-Lutz 2024-08-21 11:18:14 +02:00
parent 3693bbab08
commit 436e5a2d7f
4 changed files with 13 additions and 5 deletions

View file

@ -388,14 +388,14 @@ job_processor::run()
return error;
}
void check_no_formula()
void check_no_formula(const char* action)
{
if (!jobs.empty())
return;
if (isatty(STDIN_FILENO))
error(2, 0, "No formula to translate? Run '%s --help' for help.\n"
error(2, 0, "No formula to %s? Run '%s --help' for help.\n"
"Use '%s -' to force reading formulas from the standard "
"input.", program_name, program_name);
"input.", action, program_name, program_name);
jobs.emplace_back("-", job_type::LTL_FILENAME);
}