* 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: case ReadLbtt:
{ {
std::string error; std::string error;
std::fstream f(input.c_str()); std::istream* in = &std::cin;
if (!f) std::fstream* f = 0;
if (input != "-")
{ {
std::cerr << "cannot open " << input << std::endl; in = f = new std::fstream(input.c_str());
delete dict; if (!*f)
return 2; {
std::cerr << "cannot open " << input << std::endl;
delete dict;
return 2;
}
} }
tm.start("parsing lbtt"); tm.start("parsing lbtt");
to_free = a = 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)); env, env));
tm.stop("parsing lbtt"); tm.stop("parsing lbtt");
delete f;
if (!to_free) if (!to_free)
{ {
std::cerr << error << std::endl; std::cerr << error << std::endl;