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)
if(ch=='\\' || ch=='/')
sprintf(str,"%s%s",base,path);
else
sprintf(str,"%s%c%s",base,BACKSLASH,path);
sprintf(str,"%s%c%s",base,PATH_DELIM,path);
} else
strcpy(str,path);
......
......@@ -231,11 +231,7 @@ void sbbs_t::errormsg(int line, const char *source, char action, const char *obj
errormsg_inside=true;
/* Don't log path to source code */
src=strrchr(source,BACKSLASH);
if(src==NULL)
src=source;
else
src++;
src=getfname(source);
switch(action) {
case ERR_OPEN:
......
......@@ -1450,7 +1450,7 @@ void event_thread(void* arg)
sbbs->batch_add_list(bat_list);
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 */)) {
eprintf("Packing completed");
sbbs->qwk_success(l,0,1);
......@@ -1497,7 +1497,7 @@ void event_thread(void* arg)
sbbs->getusrsubs();
sbbs->batdn_total=0;
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 */)) {
sbbs->qwk_success(l,0,1);
sbbs->putmsgptrs();
......
......@@ -438,12 +438,7 @@ void sbbs_read_ini(
=iniGetShortInt(fp,section,"MaxCgiInactivity",120); /* seconds */
#ifdef __unix__
default_cgi_temp = "/tmp";
#else
if((default_cgi_temp = getenv("TEMP")) == NULL)
default_cgi_temp = nulstr;
#endif
default_cgi_temp = _PATH_TMP;
SAFECOPY(web->cgi_temp_dir
,iniGetString(fp,section,"CGITempDirectory",default_cgi_temp,value));
......
......@@ -882,13 +882,13 @@ int main(int argc, char** argv)
if(!winsock_cleanup())
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(!fexistcase(ini_file))
sprintf(ini_file,"%s/etc/sbbs.ini",PREFIX);
#endif
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 */
memset(&bbs_startup,0,sizeof(bbs_startup));
......
......@@ -287,8 +287,8 @@ void backslashcolon(char *str)
int i;
i=strlen(str);
if(i && str[i-1]!='\\' && str[i-1]!='/' && str[i-1]!=':') {
str[i]=BACKSLASH;
if(i && !IS_PATH_DELIM(str[i-1]) && str[i-1]!=':') {
str[i]=PATH_DELIM;
str[i+1]=0;
}
}
......
......@@ -84,13 +84,6 @@ extern const uchar* nular;
#define MAX_REQUEST_LINE 1024
#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 BOOL scfg_reloaded=TRUE;
static uint http_threads_running=0;
......@@ -1449,11 +1442,11 @@ static BOOL check_request(http_session_t * session)
lprintf("Path is: %s",path);
if(isdir(path)) {
last_ch=*lastchar(path);
if(!is_slash(last_ch)) {
if(!IS_PATH_DELIM(last_ch)) {
strcat(path,"/");
}
last_ch=*lastchar(session->req.virtual_path);
if(!is_slash(last_ch)) {
if(!IS_PATH_DELIM(last_ch)) {
strcat(session->req.virtual_path,"/");
}
last_slash=find_last_slash(path);
......@@ -2460,8 +2453,8 @@ void DLLCALL web_server(void* arg)
prep_dir(startup->ctrl_dir, error_dir, sizeof(error_dir));
/* Trim off trailing slash/backslash */
if(*(p=lastchar(root_dir))==BACKSLASH) *p=0;
if(*(p=lastchar(error_dir))==BACKSLASH) *p=0;
if(IS_PATH_DELIM(*(p=lastchar(root_dir)))) *p=0;
if(IS_PATH_DELIM(*(p=lastchar(error_dir)))) *p=0;
uptime=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