Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 2fafda8f authored by rswindell's avatar rswindell

Renamed prep_path to prep_dir and created prep_path function to convert \ to /...

Renamed prep_path to prep_dir and created prep_path function to convert \ to / (Unix compatibility).
parent fad5e772
......@@ -72,7 +72,8 @@ BOOL read_file_cfg(scfg_t* cfg, read_cfg_text_t* txt);
BOOL read_msgs_cfg(scfg_t* cfg, read_cfg_text_t* txt);
BOOL read_chat_cfg(scfg_t* cfg, read_cfg_text_t* txt);
BOOL read_attr_cfg(scfg_t* cfg, read_cfg_text_t* txt);
void prep_path(char* base, char* path);
void prep_dir(char* base, char* dir);
void prep_path(char* path);
void make_data_dirs(scfg_t* cfg);
void free_node_cfg(scfg_t* cfg);
......
......@@ -40,7 +40,7 @@
const char *scfgnulstr="";
void prep_path(char* base, char* path)
void prep_dir(char* base, char* path)
{
#ifdef __unix__
char *p;
......@@ -67,6 +67,15 @@ void prep_path(char* base, char* path)
backslash(path);
}
void prep_path(char* path)
{
#ifdef __unix__ /* Change backslashes to forward slashes on Unix */
for(p=path;*p;p++)
if(*p=='\\')
*p='/';
#endif
}
char * get_alloc(long *offset, char *outstr, int maxlen, FILE *instream)
{
......@@ -177,7 +186,7 @@ BOOL read_node_cfg(scfg_t* cfg, read_cfg_text_t* txt)
strlwr(cfg->temp_dir); /* temporary Unix-compatibility hack */
#ifndef SCFG
prep_path(cfg->ctrl_dir, cfg->text_dir);
prep_dir(cfg->ctrl_dir, cfg->text_dir);
#endif
for(i=0;i<10;i++) { /* WFC 0-9 DOS commands */
......@@ -294,7 +303,7 @@ BOOL read_main_cfg(scfg_t* cfg, read_cfg_text_t* txt)
for(i=0;i<cfg->sys_nodes;i++) {
if(feof(instream)) break;
fread(str,LEN_DIR+1,1,instream);
prep_path(cfg->ctrl_dir, str);
prep_dir(cfg->ctrl_dir, str);
offset+=LEN_DIR+1;
if((cfg->node_path[i]=(char *)MALLOC(strlen(str)+1))==NULL)
return allocerr(txt,offset,fname,strlen(str)+1);
......@@ -309,8 +318,8 @@ BOOL read_main_cfg(scfg_t* cfg, read_cfg_text_t* txt)
strlwr(cfg->exec_dir); /* temporary Unix-compatibility hack */
#ifndef SCFG
prep_path(cfg->ctrl_dir, cfg->data_dir);
prep_path(cfg->ctrl_dir, cfg->exec_dir);
prep_dir(cfg->ctrl_dir, cfg->data_dir);
prep_dir(cfg->ctrl_dir, cfg->exec_dir);
#endif
get_str(cfg->sys_logon,instream);
......@@ -511,7 +520,7 @@ BOOL read_msgs_cfg(scfg_t* cfg, read_cfg_text_t* txt)
#ifndef SCFG
sprintf(cfg->data_dir_subs,"%ssubs/",cfg->data_dir);
prep_path(cfg->ctrl_dir, cfg->data_dir_subs);
prep_dir(cfg->ctrl_dir, cfg->data_dir_subs);
#endif
......@@ -634,7 +643,7 @@ BOOL read_msgs_cfg(scfg_t* cfg, read_cfg_text_t* txt)
fread(str,LEN_DIR+1,1,instream); /* substitute data dir */
offset+=LEN_DIR+1;
if(str[0]) {
prep_path(cfg->ctrl_dir, str);
prep_dir(cfg->ctrl_dir, str);
if((cfg->sub[i]->data_dir=(char *)MALLOC(strlen(str)+1))==NULL)
return allocerr(txt,offset,fname,strlen(str)+1);
strcpy(cfg->sub[i]->data_dir,str); }
......@@ -697,10 +706,11 @@ BOOL read_msgs_cfg(scfg_t* cfg, read_cfg_text_t* txt)
fread(str,1,LEN_DIR+1,instream); /* substitute echomail semaphore */
offset+=LEN_DIR+1;
if(str[0]) {
prep_path(str);
if((cfg->sub[i]->echomail_sem=(char *)MALLOC(strlen(str)+1))==NULL)
return allocerr(txt,offset,fname,strlen(str)+1);
strcpy(cfg->sub[i]->echomail_sem,str); }
else
strcpy(cfg->sub[i]->echomail_sem,str);
} else
cfg->sub[i]->echomail_sem=cfg->echomail_sem;
#endif
fread(str,1,LEN_DIR+1,instream); /* substitute EchoMail path */
......@@ -765,6 +775,12 @@ BOOL read_msgs_cfg(scfg_t* cfg, read_cfg_text_t* txt)
for(i=0;i<28;i++)
get_int(n,instream);
/* Fix-up paths */
prep_path(cfg->netmail_sem);
prep_path(cfg->echomail_sem);
prep_dir(cfg->netmail_dir,cfg->data_dir);
prep_dir(cfg->echomail_dir,cfg->data_dir);
prep_dir(cfg->fidofile_dir,cfg->data_dir);
/**********/
/* QWKnet */
......@@ -868,6 +884,7 @@ BOOL read_msgs_cfg(scfg_t* cfg, read_cfg_text_t* txt)
get_str(cfg->sys_inetaddr,instream); /* Internet address */
get_str(cfg->inetmail_sem,instream);
prep_path(cfg->inetmail_sem);
get_int(cfg->inetmail_misc,instream);
get_int(cfg->inetmail_cost,instream);
......
......@@ -412,7 +412,7 @@ BOOL read_file_cfg(scfg_t* cfg, read_cfg_text_t* txt)
fread(str,LEN_DIR+1,1,instream); /* substitute data dir */
offset+=LEN_DIR+1;
if(str[0]) {
prep_path(cfg->ctrl_dir, str);
prep_dir(cfg->ctrl_dir, str);
if((cfg->dir[i]->data_dir=(char *)MALLOC(strlen(str)+1))==NULL)
return allocerr(txt,offset,fname,strlen(str)+1);
strcpy(cfg->dir[i]->data_dir,str); }
......@@ -443,7 +443,7 @@ BOOL read_file_cfg(scfg_t* cfg, read_cfg_text_t* txt)
offset+=LEN_DIR+1;
if(!str[0]) /* no path specified */
sprintf(str,"%sdirs/%s/",cfg->data_dir,cfg->dir[i]->code);
prep_path(cfg->ctrl_dir, str);
prep_dir(cfg->ctrl_dir, str);
#ifndef SCFG
if((cfg->dir[i]->path=(char *)MALLOC(strlen(str)+1))==NULL)
......@@ -451,6 +451,7 @@ BOOL read_file_cfg(scfg_t* cfg, read_cfg_text_t* txt)
#endif
strcpy(cfg->dir[i]->path,str);
get_alloc(&offset,cfg->dir[i]->upload_sem,LEN_DIR,instream);
prep_path(cfg->dir[i]->upload_sem);
get_int(cfg->dir[i]->maxfiles,instream);
if(cfg->dir[i]->maxfiles>MAX_FILES)
cfg->dir[i]->maxfiles=MAX_FILES;
......@@ -688,7 +689,7 @@ BOOL read_xtrn_cfg(scfg_t* cfg, read_cfg_text_t* txt)
#ifdef SBBS
if(!str[0]) /* Minimum path of '.' */
strcpy(str,".");
prep_path(cfg->ctrl_dir, str);
prep_dir(cfg->ctrl_dir, str);
if((cfg->xtrn[i]->path=(char *)MALLOC(strlen(str)+1))==NULL)
return allocerr(txt,offset,fname,strlen(str)+1);
#endif
......@@ -729,7 +730,7 @@ BOOL read_xtrn_cfg(scfg_t* cfg, read_cfg_text_t* txt)
fread(str,LEN_DIR+1,1,instream);
offset+=LEN_DIR+1;
#ifdef SBBS
prep_path(cfg->ctrl_dir, str);
prep_dir(cfg->ctrl_dir, str);
if((cfg->event[i]->dir=(char *)MALLOC(strlen(str)+1))==NULL)
return allocerr(txt,offset,fname,strlen(str)+1);
#endif
......
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