diff options
Diffstat (limited to 'project2/cgi/p2webCgi.cpp')
-rw-r--r-- | project2/cgi/p2webCgi.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/project2/cgi/p2webCgi.cpp b/project2/cgi/p2webCgi.cpp index 646d08b..80b5a98 100644 --- a/project2/cgi/p2webCgi.cpp +++ b/project2/cgi/p2webCgi.cpp @@ -2,12 +2,23 @@ #include "scriptLoader.h" #include <boost/bind.hpp> +class GetEnv : public CgiEnvInput { + public: + std::string + getenv(const std::string & varName) const + { + const char * env = ::getenv(varName.c_str()); + return env ? env : ""; + } +}; + int main(void) { LoaderBase::onAllComponents(boost::bind(&ComponentLoader::onBegin, _1)); CgiEnvironment env; - cgiServe(NULL, &env, std::cout); + GetEnv ge; + cgiServe(NULL, &env, std::cout, &ge); LoaderBase::onAllComponents(boost::bind(&ComponentLoader::onIteration, _1)); LoaderBase::onAllComponents(boost::bind(&ComponentLoader::onPeriodic, _1)); LoaderBase::onAllComponents(boost::bind(&ComponentLoader::onIdle, _1)); |