From 8027e319831f02538fe431b5870d90c0267b3b78 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 23 Jan 2011 14:39:19 +0200 Subject: Allow the options file search function to ignore the file --- cli/runtime-source.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'cli/runtime-source.cxx') diff --git a/cli/runtime-source.cxx b/cli/runtime-source.cxx index 4c6b2a2..7f87d1f 100644 --- a/cli/runtime-source.cxx +++ b/cli/runtime-source.cxx @@ -264,8 +264,13 @@ generate_runtime_source (context& ctx) << "if (!base::more ())" << endl << "throw missing_value (oi->option);" << endl - << "if (oi->search_func != 0)" << endl - << "load (oi->search_func (base::next (), oi->arg));" + << "if (oi->search_func != 0)" + << "{" + << "std::string f (oi->search_func (base::next (), oi->arg));" + << endl + << "if (!f.empty ())" << endl + << "load (f);" + << "}" << "else" << endl << "load (base::next ());" << endl @@ -420,8 +425,13 @@ generate_runtime_source (context& ctx) << "if (s2.empty ())" << endl << "throw missing_value (oi->option);" << endl - << "if (oi->search_func != 0)" << endl - << "load (oi->search_func (s2.c_str (), oi->arg));" + << "if (oi->search_func != 0)" + << "{" + << "std::string f (oi->search_func (s2.c_str (), oi->arg));" + << endl + << "if (!f.empty ())" << endl + << "load (f);" + << "}" << "else" << endl << "load (s2);" << "}" -- cgit v1.1