summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-03-08 11:26:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-03-08 11:26:47 +0200
commit83c0210d84179f3fd00774a757bd9e7dc8a42d32 (patch)
tree782a7dbd60dd024018d2e8e7408d3f2529d548ed
parent490cd02a71802c699fc339ec279ee7e6010be0d9 (diff)
Print usage/version information to STDOUT instead of STDERR
-rw-r--r--cli/cli.cxx12
-rw-r--r--doc/guide/index.xhtml14
-rw-r--r--examples/hello/driver.cxx14
3 files changed, 22 insertions, 18 deletions
diff --git a/cli/cli.cxx b/cli/cli.cxx
index df7fd97..b8314e6 100644
--- a/cli/cli.cxx
+++ b/cli/cli.cxx
@@ -31,10 +31,12 @@ main (int argc, char* argv[])
//
if (ops.version ())
{
- e << "CodeSynthesis CLI command line interface compiler 1.1.0" << endl
+ ostream& o (cout);
+
+ o << "CodeSynthesis CLI command line interface compiler 1.1.0" << endl
<< "Copyright (c) 2009-2011 Code Synthesis Tools CC" << endl;
- e << "This is free software; see the source for copying conditions. "
+ o << "This is free software; see the source for copying conditions. "
<< "There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS "
<< "FOR A PARTICULAR PURPOSE." << endl;
@@ -45,10 +47,12 @@ main (int argc, char* argv[])
//
if (ops.help ())
{
- e << "Usage: " << argv[0] << " [options] file" << endl
+ ostream& o (cout);
+
+ o << "Usage: " << argv[0] << " [options] file" << endl
<< "Options:" << endl;
- options::print_usage (e);
+ options::print_usage (o);
return 0;
}
diff --git a/doc/guide/index.xhtml b/doc/guide/index.xhtml
index 638b65b..1e85997 100644
--- a/doc/guide/index.xhtml
+++ b/doc/guide/index.xhtml
@@ -343,11 +343,11 @@ private:
using namespace std;
void
-usage ()
+usage (ostream&amp; os)
{
- cerr &lt;&lt; "usage: driver [options] &lt;names>" &lt;&lt; endl
- &lt;&lt; "options:" &lt;&lt; endl;
- options::print_usage (cerr);
+ os &lt;&lt; "usage: driver [options] &lt;names>" &lt;&lt; endl
+ &lt;&lt; "options:" &lt;&lt; endl;
+ options::print_usage (os);
}
int
@@ -360,14 +360,14 @@ main (int argc, char* argv[])
if (o.help ())
{
- usage ();
+ usage (cout);
return 0;
}
if (end == argc)
{
cerr &lt;&lt; "no names provided" &lt;&lt; endl;
- usage ();
+ usage (cerr);
return 1;
}
@@ -386,7 +386,7 @@ main (int argc, char* argv[])
catch (const cli::exception&amp; e)
{
cerr &lt;&lt; e &lt;&lt; endl;
- usage ();
+ usage (cerr);
return 1;
}
}
diff --git a/examples/hello/driver.cxx b/examples/hello/driver.cxx
index c9d87a3..2c84505 100644
--- a/examples/hello/driver.cxx
+++ b/examples/hello/driver.cxx
@@ -10,11 +10,11 @@
using namespace std;
void
-usage ()
+usage (ostream& os)
{
- cerr << "usage: driver [options] <names>" << endl
- << "options:" << endl;
- options::print_usage (cerr);
+ os << "usage: driver [options] <names>" << endl
+ << "options:" << endl;
+ options::print_usage (os);
}
int
@@ -27,14 +27,14 @@ main (int argc, char* argv[])
if (o.help ())
{
- usage ();
+ usage (cout);
return 0;
}
if (end == argc)
{
cerr << "no names provided" << endl;
- usage ();
+ usage (cerr);
return 1;
}
@@ -53,7 +53,7 @@ main (int argc, char* argv[])
catch (const cli::exception& e)
{
cerr << e << endl;
- usage ();
+ usage (cerr);
return 1;
}
}