summaryrefslogtreecommitdiff
path: root/cli/cli.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-12-10 10:50:23 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-12-10 10:50:23 +0200
commit74dfffa9df361e35a5910f1cf5b1734571bbef91 (patch)
tree72c4751da28efd20e2ddcf374842f359fad67faf /cli/cli.cxx
parent2dc2da5488ac32da8c6ff7cd0eeb5e1beb38c92f (diff)
Allows additional options to be provided in files (--options-file)
Implemented using the new argv_file_scanner scanner implementation.
Diffstat (limited to 'cli/cli.cxx')
-rw-r--r--cli/cli.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/cli/cli.cxx b/cli/cli.cxx
index 2b909cd..64a79f1 100644
--- a/cli/cli.cxx
+++ b/cli/cli.cxx
@@ -20,11 +20,12 @@ int
main (int argc, char* argv[])
{
ostream& e (cerr);
+ const char* file (0);
try
{
- int end;
- options ops (argc, argv, end);
+ cli::argv_file_scanner scan (argc, argv, "--options-file");
+ options ops (scan);
// Handle --version
//
@@ -53,7 +54,7 @@ main (int argc, char* argv[])
return 0;
}
- if (end == argc)
+ if (!scan.more ())
{
e << "error: no input file specified" << endl
<< "info: try '" << argv[0] << " --help' for more information" << endl;
@@ -61,7 +62,8 @@ main (int argc, char* argv[])
return 1;
}
- semantics::path path (argv[end]);
+ file = scan.next ();
+ semantics::path path (file);
ifstream ifs (path.string ().c_str ());
if (!ifs.is_open ())
@@ -91,7 +93,7 @@ main (int argc, char* argv[])
}
catch (std::ios_base::failure const&)
{
- e << argv[1] << ": error: read failure" << endl;
+ e << file << ": error: read failure" << endl;
return 1;
}
catch (parser::invalid_input const&)