aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Stephen P. Bennett <spb@exherbo.org> 2006-02-02 19:17:28 +0000
committerAvatar Stephen P. Bennett <spb@exherbo.org> 2006-02-02 19:17:28 +0000
commit51cc12beb07be2e7c0bd2c3eed01497525089d48 (patch)
tree5afce42d55a79a6ca68af7749e5572a97e13c1e0
parent881cc0e7de49ea94e9bdd53876f02e9e3c1e7fd7 (diff)
downloadpaludis-51cc12beb07be2e7c0bd2c3eed01497525089d48.tar.gz
paludis-51cc12beb07be2e7c0bd2c3eed01497525089d48.tar.xz
Added handling for PALUDIS_OPTIONS. Fairly crude, but should work.
-rw-r--r--paludis/args/Makefile.am2
-rw-r--r--paludis/args/args_handler.cc23
2 files changed, 17 insertions, 8 deletions
diff --git a/paludis/args/Makefile.am b/paludis/args/Makefile.am
index e6ebf37..1c3ca64 100644
--- a/paludis/args/Makefile.am
+++ b/paludis/args/Makefile.am
@@ -16,7 +16,7 @@ libpaludisargs_a_SOURCES = \
bad_value.hh bad_value.cc \
args_dumper.hh args_dumper.cc
-TESTS_ENVIRONMENT = env TEST_SCRIPT_DIR="$(srcdir)/" $(SHELL) $(top_srcdir)/test/run_test.sh
+TESTS_ENVIRONMENT = env -u PALUDIS_OPTIONS TEST_SCRIPT_DIR="$(srcdir)/" $(SHELL) $(top_srcdir)/test/run_test.sh
noinst_LIBRARIES = libpaludisargs.a
check_PROGRAMS = $(TESTS)
diff --git a/paludis/args/args_handler.cc b/paludis/args/args_handler.cc
index 18b1f47..37a8887 100644
--- a/paludis/args/args_handler.cc
+++ b/paludis/args/args_handler.cc
@@ -19,6 +19,7 @@
#include "args.hh"
#include "args_dumper.hh"
+#include <paludis/getenv.hh>
#include <algorithm>
/** \file
@@ -40,16 +41,24 @@ ArgsHandler::add(ArgsGroup * const g)
_groups.push_back(g);
}
-#ifndef DOXYGEN
-struct Found
-{
-};
-#endif
-
void
ArgsHandler::run(const int argc, const char * const * const argv)
{
- std::list<std::string> args(argv + 1, &argv[argc]);
+ std::list<std::string> args;
+
+ std::string env_options = paludis::getenv_with_default("PALUDIS_OPTIONS", "");
+
+ std::istringstream iss(env_options);
+ std::string option;
+ while(iss.good())
+ {
+ iss >> option;
+ if(!option.empty())
+ args.push_back(option);
+ }
+
+ args.insert(args.end(), &argv[1], &argv[argc]);
+
std::list<std::string>::iterator argit = args.begin(), arge = args.end();
ArgsVisitor visitor(&argit);