--- parser3/src/targets/cgi/parser3.C 2001/09/05 09:33:33 1.110 +++ parser3/src/targets/cgi/parser3.C 2001/10/09 14:30:19 1.119 @@ -2,10 +2,10 @@ Parser: scripting and CGI main. Copyright(c) 2001 ArtLebedev Group(http://www.artlebedev.com) - Author: Alexander Petrosyan (http://design.ru/paf) + + $Id: parser3.C,v 1.119 2001/10/09 14:30:19 parser Exp $ */ -static const char *RCSId="$Id: parser3.C,v 1.110 2001/09/05 09:33:33 parser Exp $"; #include "pa_config_includes.h" @@ -24,6 +24,32 @@ static const char *RCSId="$Id: parser3.C // consts +extern const char *main_RCSIds[]; +#ifdef USE_SMTP +extern const char *smtp_RCSIds[]; +#endif +extern const char *gd_RCSIds[]; +extern const char *classes_RCSIds[]; +extern const char *types_RCSIds[]; +extern const char *parser3_RCSIds[]; +#ifdef XML +extern const char *xalan_patched_RCSIds[]; +#endif +const char **RCSIds[]={ + main_RCSIds, +#ifdef USE_SMTP + smtp_RCSIds, +#endif + gd_RCSIds, + classes_RCSIds, + types_RCSIds, + parser3_RCSIds, +#ifdef XML + xalan_patched_RCSIds, +#endif + 0 +}; + /// IIS refuses to read bigger chunks const size_t READ_POST_CHUNK_SIZE=0x400*0x400; // 1M @@ -77,7 +103,12 @@ void SAPI::log(Pool& pool, const char *f // message va_list args; va_start(args,fmt); - vfprintf(f, fmt, args); + + char buf[MAX_STRING]; + size_t size=vsnprintf(buf, MAX_STRING, fmt, args); + remove_crlf(buf, buf+size); + + fwrite(buf, size, 1, f); va_end(args); // newline fprintf(f, "\n"); @@ -275,31 +306,42 @@ int main(int argc, char *argv[]) { // some root-controlled location #ifdef SYSCONFDIR - const char *root_auto_path=SYSCONFDIR; + const char *root_config_filespec=SYSCONFDIR "/" CONFIG_FILE_NAME; #else # ifdef WIN32 // c:\windows - static char root_auto_path[MAX_STRING]; - GetWindowsDirectory(root_auto_path, MAX_STRING); + char root_config_path[MAX_STRING]; + GetWindowsDirectory(root_config_path, MAX_STRING); + + char root_config_filespec[MAX_STRING]; + snprintf(root_config_filespec, MAX_STRING, + "%s/%s", + root_config_path, CONFIG_FILE_NAME); # else #error must be compiled either configure/make or MSVC++ # endif #endif // beside by binary - static char site_auto_path[MAX_STRING]; - strncpy(site_auto_path, argv0, MAX_STRING-1); site_auto_path[MAX_STRING-1]=0; // filespec of my binary + // @todo full path, not ./! + static char site_config_path[MAX_STRING]; + strncpy(site_config_path, argv0, MAX_STRING-1); site_config_path[MAX_STRING-1]=0; // filespec of my binary if(!( - rsplit(site_auto_path, '/') || - rsplit(site_auto_path, '\\'))) { // strip filename + rsplit(site_config_path, '/') || + rsplit(site_config_path, '\\'))) { // strip filename // no path, just filename - site_auto_path[0]='.'; site_auto_path[1]=0; + site_config_path[0]='.'; site_config_path[1]=0; } + + char site_config_filespec[MAX_STRING]; + snprintf(site_config_filespec, MAX_STRING, + "%s/%s", + site_config_path, CONFIG_FILE_NAME); // process the request request.core( - root_auto_path, false, - site_auto_path, false, + root_config_filespec, false, + site_config_filespec, false, header_only); //