--- parser3/src/targets/cgi/parser3.C 2001/05/19 19:10:20 1.84 +++ parser3/src/targets/cgi/parser3.C 2001/08/24 09:27:53 1.96 @@ -4,9 +4,8 @@ Copyright(c) 2001 ArtLebedev Group(http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - - $Id: parser3.C,v 1.84 2001/05/19 19:10:20 parser Exp $ */ +static const char *RCSId="$Id: parser3.C,v 1.96 2001/08/24 09:27:53 parser Exp $"; #include "pa_config_includes.h" @@ -52,7 +51,8 @@ static LONG WINAPI TopLevelExceptionFilt #endif // SAPI -// appends to parser3.log located beside my binary + +// appends to parser3.log located beside my binary if openable, to stderr otherwize void SAPI::log(Pool& pool, const char *fmt, ...) { bool opened; FILE *f=0; @@ -83,6 +83,8 @@ void SAPI::log(Pool& pool, const char *f if(opened) fclose(f); + else + fflush(f); } const char *SAPI::get_env(Pool& pool, const char *name) { @@ -254,7 +256,7 @@ int main(int argc, char *argv[]) { // prepare to process request Request request(pool, request_info, - true ||cgi ? String::UL_USER_HTML : String::UL_AS_IS + cgi ? String::UL_USER_HTML : String::UL_AS_IS ); // some root-controlled location @@ -269,8 +271,13 @@ int main(int argc, char *argv[]) { // beside by binary static char site_auto_path[MAX_STRING]; - strncpy(site_auto_path, argv[0], MAX_STRING); // filespec of my binary - rsplit(site_auto_path, '/'); rsplit(site_auto_path, '\\');// strip filename + strncpy(site_auto_path, argv0, MAX_STRING); // filespec of my binary + if(!( + rsplit(site_auto_path, '/') || + rsplit(site_auto_path, '\\'))) { // strip filename + // no path, just filename + site_auto_path[0]='.'; site_auto_path[1]=0; + } // process the request request.core( @@ -290,6 +297,10 @@ int main(int argc, char *argv[]) { #ifdef WIN32 SetUnhandledExceptionFilter(0); #endif + // + if(!cgi) + SAPI::send_body(pool, "\n", 1); + // successful finish return 0; } PCATCH(e) { // global problem @@ -321,6 +332,10 @@ int main(int argc, char *argv[]) { if(!header_only) SAPI::send_body(pool, body, content_length); + // + if(!cgi) + SAPI::send_body(pool, "\n", 1); + // unsuccessful finish return 1; }