Commit dd80907f authored by rswindell's avatar rswindell
Browse files

Changed BACKSLASH macro to (unbiased) PATH_DELIM.

Created IS_PATH_DELIM() macro (stole websrvr.c->is_slash macro).
Defines BSD _PATH_TMP and _PATH_DEVNULL macros for all platforms.
parent 3972ee78
...@@ -504,7 +504,7 @@ char* DLLCALL prep_dir(char* base, char* path, size_t buflen) ...@@ -504,7 +504,7 @@ char* DLLCALL prep_dir(char* base, char* path, size_t buflen)
if(ch=='\\' || ch=='/') if(ch=='\\' || ch=='/')
sprintf(str,"%s%s",base,path); sprintf(str,"%s%s",base,path);
else else
sprintf(str,"%s%c%s",base,BACKSLASH,path); sprintf(str,"%s%c%s",base,PATH_DELIM,path);
} else } else
strcpy(str,path); strcpy(str,path);
......
...@@ -231,11 +231,7 @@ void sbbs_t::errormsg(int line, const char *source, char action, const char *obj ...@@ -231,11 +231,7 @@ void sbbs_t::errormsg(int line, const char *source, char action, const char *obj
errormsg_inside=true; errormsg_inside=true;
/* Don't log path to source code */ /* Don't log path to source code */
src=strrchr(source,BACKSLASH); src=getfname(source);
if(src==NULL)
src=source;
else
src++;
switch(action) { switch(action) {
case ERR_OPEN: case ERR_OPEN:
......
...@@ -1450,7 +1450,7 @@ void event_thread(void* arg) ...@@ -1450,7 +1450,7 @@ void event_thread(void* arg)
sbbs->batch_add_list(bat_list); sbbs->batch_add_list(bat_list);
sprintf(str,"%sfile%c%04u.qwk" sprintf(str,"%sfile%c%04u.qwk"
,sbbs->cfg.data_dir,BACKSLASH,sbbs->useron.number); ,sbbs->cfg.data_dir,PATH_DELIM,sbbs->useron.number);
if(sbbs->pack_qwk(str,&l,true /* pre-pack/off-line */)) { if(sbbs->pack_qwk(str,&l,true /* pre-pack/off-line */)) {
eprintf("Packing completed"); eprintf("Packing completed");
sbbs->qwk_success(l,0,1); sbbs->qwk_success(l,0,1);
...@@ -1497,7 +1497,7 @@ void event_thread(void* arg) ...@@ -1497,7 +1497,7 @@ void event_thread(void* arg)
sbbs->getusrsubs(); sbbs->getusrsubs();
sbbs->batdn_total=0; sbbs->batdn_total=0;
sprintf(str,"%sfile%c%04u.qwk" sprintf(str,"%sfile%c%04u.qwk"
,sbbs->cfg.data_dir,BACKSLASH,sbbs->useron.number); ,sbbs->cfg.data_dir,PATH_DELIM,sbbs->useron.number);
if(sbbs->pack_qwk(str,&l,true /* pre-pack */)) { if(sbbs->pack_qwk(str,&l,true /* pre-pack */)) {
sbbs->qwk_success(l,0,1); sbbs->qwk_success(l,0,1);
sbbs->putmsgptrs(); sbbs->putmsgptrs();
......
...@@ -438,12 +438,7 @@ void sbbs_read_ini( ...@@ -438,12 +438,7 @@ void sbbs_read_ini(
=iniGetShortInt(fp,section,"MaxCgiInactivity",120); /* seconds */ =iniGetShortInt(fp,section,"MaxCgiInactivity",120); /* seconds */
#ifdef __unix__ default_cgi_temp = _PATH_TMP;
default_cgi_temp = "/tmp";
#else
if((default_cgi_temp = getenv("TEMP")) == NULL)
default_cgi_temp = nulstr;
#endif
SAFECOPY(web->cgi_temp_dir SAFECOPY(web->cgi_temp_dir
,iniGetString(fp,section,"CGITempDirectory",default_cgi_temp,value)); ,iniGetString(fp,section,"CGITempDirectory",default_cgi_temp,value));
......
...@@ -882,13 +882,13 @@ int main(int argc, char** argv) ...@@ -882,13 +882,13 @@ int main(int argc, char** argv)
if(!winsock_cleanup()) if(!winsock_cleanup())
return(-1); return(-1);
sprintf(ini_file,"%s%c%s.ini",ctrl_dir,BACKSLASH,host_name); sprintf(ini_file,"%s%c%s.ini",ctrl_dir,PATH_DELIM,host_name);
#if defined(__unix__) && defined(PREFIX) #if defined(__unix__) && defined(PREFIX)
if(!fexistcase(ini_file)) if(!fexistcase(ini_file))
sprintf(ini_file,"%s/etc/sbbs.ini",PREFIX); sprintf(ini_file,"%s/etc/sbbs.ini",PREFIX);
#endif #endif
if(!fexistcase(ini_file)) if(!fexistcase(ini_file))
sprintf(ini_file,"%s%csbbs.ini",ctrl_dir,BACKSLASH); sprintf(ini_file,"%s%csbbs.ini",ctrl_dir,PATH_DELIM);
/* Initialize BBS startup structure */ /* Initialize BBS startup structure */
memset(&bbs_startup,0,sizeof(bbs_startup)); memset(&bbs_startup,0,sizeof(bbs_startup));
......
...@@ -287,8 +287,8 @@ void backslashcolon(char *str) ...@@ -287,8 +287,8 @@ void backslashcolon(char *str)
int i; int i;
i=strlen(str); i=strlen(str);
if(i && str[i-1]!='\\' && str[i-1]!='/' && str[i-1]!=':') { if(i && !IS_PATH_DELIM(str[i-1]) && str[i-1]!=':') {
str[i]=BACKSLASH; str[i]=PATH_DELIM;
str[i+1]=0; str[i+1]=0;
} }
} }
......
...@@ -84,13 +84,6 @@ extern const uchar* nular; ...@@ -84,13 +84,6 @@ extern const uchar* nular;
#define MAX_REQUEST_LINE 1024 #define MAX_REQUEST_LINE 1024
#define MAX_HEADERS_SIZE 16384 /* Maximum total size of all headers */ #define MAX_HEADERS_SIZE 16384 /* Maximum total size of all headers */
/* These probobly exists somewhere else to... ToDo */
#ifdef _WIN32
#define is_slash(x) ((x)=='/' || (x)=='\\')
#else
#define is_slash(x) (x=='/')
#endif
static scfg_t scfg; static scfg_t scfg;
static BOOL scfg_reloaded=TRUE; static BOOL scfg_reloaded=TRUE;
static uint http_threads_running=0; static uint http_threads_running=0;
...@@ -1449,11 +1442,11 @@ static BOOL check_request(http_session_t * session) ...@@ -1449,11 +1442,11 @@ static BOOL check_request(http_session_t * session)
lprintf("Path is: %s",path); lprintf("Path is: %s",path);
if(isdir(path)) { if(isdir(path)) {
last_ch=*lastchar(path); last_ch=*lastchar(path);
if(!is_slash(last_ch)) { if(!IS_PATH_DELIM(last_ch)) {
strcat(path,"/"); strcat(path,"/");
} }
last_ch=*lastchar(session->req.virtual_path); last_ch=*lastchar(session->req.virtual_path);
if(!is_slash(last_ch)) { if(!IS_PATH_DELIM(last_ch)) {
strcat(session->req.virtual_path,"/"); strcat(session->req.virtual_path,"/");
} }
last_slash=find_last_slash(path); last_slash=find_last_slash(path);
...@@ -2460,8 +2453,8 @@ void DLLCALL web_server(void* arg) ...@@ -2460,8 +2453,8 @@ void DLLCALL web_server(void* arg)
prep_dir(startup->ctrl_dir, error_dir, sizeof(error_dir)); prep_dir(startup->ctrl_dir, error_dir, sizeof(error_dir));
/* Trim off trailing slash/backslash */ /* Trim off trailing slash/backslash */
if(*(p=lastchar(root_dir))==BACKSLASH) *p=0; if(IS_PATH_DELIM(*(p=lastchar(root_dir)))) *p=0;
if(*(p=lastchar(error_dir))==BACKSLASH) *p=0; if(IS_PATH_DELIM(*(p=lastchar(error_dir)))) *p=0;
uptime=0; uptime=0;
served=0; served=0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment