Bug 18580 - abidw ignores --out-file

So I forgot to finish the implementation of the --out-file option.
This patchlet addresses that.

	* tools/abidw.cc (main): Take the argument of --out-file into
	account when emitting the serialized form of the ABI.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2015-06-23 01:15:01 +02:00
parent 0425b0f566
commit 6c1e7da30d

View File

@ -247,7 +247,22 @@ main(int argc, char* argv[])
{
if (!opts.write_architecture)
corp->set_architecture_name("");
abigail::xml_writer::write_corpus_to_native_xml(corp, 0, cout);
if (!opts.out_file_path.empty())
{
ofstream of(opts.out_file_path.c_str(), std::ios_base::trunc);
if (!of.is_open())
{
cerr << "could not open output file '"
<< opts.out_file_path << "'\n";
return 1;
}
abigail::xml_writer::write_corpus_to_native_xml(corp, 0, of);
of.close();
return 0;
}
else
abigail::xml_writer::write_corpus_to_native_xml(corp, 0, cout);
}
return 0;