--- parser3/src/classes/Attic/exec.C 2001/04/09 11:04:08 1.2 +++ parser3/src/classes/Attic/exec.C 2001/04/09 11:30:35 1.3 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: exec.C,v 1.2 2001/04/09 11:04:08 paf Exp $ + $Id: exec.C,v 1.3 2001/04/09 11:30:35 paf Exp $ */ #include "pa_config_includes.h" @@ -15,52 +15,8 @@ VStateless_class *exec_class; -/// ^exec[file-name] -/// ^exec[file-name;env hash] -/// ^exec[file-name;env hash;cmd;line;arg;s] -static void _cgi(Request& r, const String& method_name, Array *params) { - Pool& pool=r.pool(); - - Value& vfile_name=*static_cast(params->get(0)); - // forcing [this param type] - r.fail_if_junction_(true, vfile_name, - method_name, "file name must not be code"); - - Hash *env=0; - if(params->size()>1) { - Value& venv=*static_cast(params->get(1)); - // forcing [this param type] - r.fail_if_junction_(true, venv, - method_name, "env must not be code"); - env=venv.get_hash(); - if(!env) - PTHROW(0, 0, - &method_name, - "env must be hash"); - } - - Array *argv=0; - if(params->size()>2) { - argv=new(pool) Array(pool, params->size()-2); - for(int i=2; isize(); i++) - *argv+=&static_cast(params->get(i))->as_string(); - } - - const String in(pool, r.post_data, r.post_size); - String out(pool); - String err(pool); - SAPI::execute(r.absolute(vfile_name.as_string()), env, argv, - in, out, err); - r.write_pass_lang(out); - if(err.size()) - SAPI::log(pool, "cgi:%s", err.cstr()); -} // initialize void initialize_exec_class(Pool& pool, VStateless_class& vclass) { - // ^exec[file-name] - // ^exec[file-name;env hash] - // ^exec[file-name;env hash;1cmd;2line;3ar;4g;5s] - vclass.add_native_method("cgi", Method::CT_STATIC, _cgi, 1, 2+5); }