diff --git a/bin/common_file.cc b/bin/common_file.cc index ebad8b878..68a69a2af 100644 --- a/bin/common_file.cc +++ b/bin/common_file.cc @@ -47,16 +47,13 @@ output_file::output_file(const char* name, bool force_append) void output_file::reopen_for_append(const std::string& name) { - if (of_ && of_->is_open()) // nothing to do + if (os_ == &std::cout || of_->is_open()) // nothing to do return; const char* cname = name.c_str(); if (cname[0] == '>' && cname[1] == '>') cname += 2; - if (name[0] == '-' && name[1] == 0) - { - os_ = &std::cout; - return; - } + // the name cannot be "-" at this point, otherwise os_ would be + // equal to std::cout. of_->open(cname, std::ios_base::app); if (!*of_) error(2, errno, "cannot reopen '%s'", cname); diff --git a/tests/core/serial.test b/tests/core/serial.test index 7914316c8..389335eff 100755 --- a/tests/core/serial.test +++ b/tests/core/serial.test @@ -91,3 +91,25 @@ cat >expected < naut-.hoa +for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do + ltl2tgba 1 --name "file$i" > naut$i.hoa +done +autfilt naut*.hoa naut*.hoa --output='>>%M' --format=%M > stdout +cat >expected <expected7 <expected15 <