--- parser3/src/targets/cgi/parser3.C 2020/11/13 23:08:24 1.311 +++ parser3/src/targets/cgi/parser3.C 2020/11/13 23:35:53 1.314 @@ -5,7 +5,7 @@ Author: Alexandr Petrosian (http://paf.design.ru) */ -volatile const char * IDENT_PARSER3_C="$Id: parser3.C,v 1.311 2020/11/13 23:08:24 moko Exp $"; +volatile const char * IDENT_PARSER3_C="$Id: parser3.C,v 1.314 2020/11/13 23:35:53 moko Exp $"; #include "pa_config_includes.h" @@ -39,7 +39,7 @@ volatile const char * IDENT_PARSER3_C="$ #define PARSER_LOG_ENV_NAME "CGI_PARSER_LOG" static const char* filespec_to_process=0; // [file] -static const char* config_filespec=0; // -f option or beside executable +static const char* config_filespec=0; // -f option or next to the executable static const char* httpd_host_port=0; // -p option static bool mail_received=false; // -m option? [asked to parse incoming message to $mail:received] @@ -124,7 +124,7 @@ static void log(const char* fmt, ...) { } #endif -// appends to parser3.log located beside my executable if openable, to stderr otherwize +// appends to parser3.log located next to the executable if openable, to stderr otherwize void SAPI::log(SAPI_Info&, const char* fmt, ...) { va_list args; va_start(args,fmt); @@ -178,7 +178,7 @@ size_t SAPI::send_body(SAPI_Info& info, return info.send_body(buf, size); } -static void full_file_spec(const char* file_name, char *buf, size_t buf_size) { +static void full_disk_path(const char* file_name, char *buf, size_t buf_size) { if(file_name[0]=='/' #ifdef WIN32 || file_name[0] && file_name[1]==':' @@ -276,7 +276,7 @@ static void connection_handler(SAPI_Info memset(&request_info, 0, sizeof(request_info)); char document_root_buf[MAX_STRING]; - full_file_spec("", document_root_buf, sizeof(document_root_buf)); + full_disk_path("", document_root_buf, sizeof(document_root_buf)); request_info.document_root = document_root_buf; request_info.path_translated = filespec_to_process; request_info.method = connection.method(); @@ -398,7 +398,7 @@ static void real_parser_handler() { request_info.uri = path_info; } } else{ - full_file_spec("", document_root_buf, sizeof(document_root_buf)); + full_disk_path("", document_root_buf, sizeof(document_root_buf)); request_info.document_root = document_root_buf; request_info.uri = ""; } @@ -496,9 +496,9 @@ static void locate_config(const char *ex if(!config_filespec) config_filespec=getenv(REDIRECT_PREFIX PARSER_CONFIG_ENV_NAME); if(!config_filespec){ - // beside my executable + // next to the executable char beside_executable_path[MAX_STRING]; - strncpy(beside_executable_path, executable_path, MAX_STRING-1); beside_executable_path[MAX_STRING-1]=0; // filespec of my executable + strncpy(beside_executable_path, executable_path, MAX_STRING-1); beside_executable_path[MAX_STRING-1]=0; if(!(rsplit(beside_executable_path, '/') || rsplit(beside_executable_path, '\\'))) { // strip filename // no path, just filename // @todo full path, not ./! @@ -615,7 +615,7 @@ int main(int argc, char *argv[]) { char filespec_to_process_buf[MAX_STRING]; if(raw_filespec_to_process && *raw_filespec_to_process){ - full_file_spec(raw_filespec_to_process, filespec_to_process_buf, sizeof(filespec_to_process_buf)); + full_disk_path(raw_filespec_to_process, filespec_to_process_buf, sizeof(filespec_to_process_buf)); filespec_to_process=filespec_to_process_buf; }