* src/tgbatest/ltl2tgba.cc: Accept reading LBTT files from stdin.

This commit is contained in:
Alexandre Duret-Lutz 2013-07-27 00:57:45 +02:00
parent 337aeefcc3
commit d2560944b6

View file

@ -1071,18 +1071,24 @@ main(int argc, char** argv)
case ReadLbtt:
{
std::string error;
std::fstream f(input.c_str());
if (!f)
std::istream* in = &std::cin;
std::fstream* f = 0;
if (input != "-")
{
in = f = new std::fstream(input.c_str());
if (!*f)
{
std::cerr << "cannot open " << input << std::endl;
delete dict;
return 2;
}
}
tm.start("parsing lbtt");
to_free = a =
const_cast<spot::tgba*>(spot::lbtt_parse(f, error, dict,
const_cast<spot::tgba*>(spot::lbtt_parse(*in, error, dict,
env, env));
tm.stop("parsing lbtt");
delete f;
if (!to_free)
{
std::cerr << error << std::endl;