summaryrefslogtreecommitdiff
path: root/xsd/xsd/xsd.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/xsd/xsd.cxx')
-rw-r--r--xsd/xsd/xsd.cxx25
1 files changed, 15 insertions, 10 deletions
diff --git a/xsd/xsd/xsd.cxx b/xsd/xsd/xsd.cxx
index 0df4ea0..5a239d5 100644
--- a/xsd/xsd/xsd.cxx
+++ b/xsd/xsd/xsd.cxx
@@ -770,38 +770,43 @@ main (int argc, char* argv[])
try
{
OutputFileStream ofs;
- SemanticGraph::Path path (fl);
+ if (fl != "-")
+ {
+ SemanticGraph::Path path (fl);
- ofs.open (path.string ().c_str (), ios_base::out);
+ ofs.open (path.string ().c_str (), ios_base::out);
- if (!ofs.is_open ())
- {
- wcerr << path << ": error: unable to open in write mode" << endl;
- return 1;
+ if (!ofs.is_open ())
+ {
+ wcerr << path << ": error: unable to open in write mode" << endl;
+ return 1;
+ }
}
+ std::ostream& os (ofs.is_open () ? ofs : cout);
+
NarrowString d (common_ops.file_list_delim ());
expand_nl (d);
if (NarrowString p = common_ops.file_list_prologue ())
{
expand_nl (p);
- ofs << p;
+ os << p;
}
for (FileList::iterator i (file_list.begin ()), e (file_list.end ());
i != e;)
{
- ofs << *i;
+ os << *i;
if (++i != e)
- ofs << d;
+ os << d;
}
if (NarrowString e = common_ops.file_list_epilogue ())
{
expand_nl (e);
- ofs << e;
+ os << e;
}
}
catch (SemanticGraph::InvalidPath const&)