Commit 5edd4ff1 authored by rswindell's avatar rswindell
Browse files

Created sbbs_get_ini_fname() to handle the creation of the startup .ini

filename for a specific instance, in one common place.
parent 029c7891
......@@ -599,11 +599,8 @@ int main(int argc, char** argv)
if(!winsock_cleanup())
return(-1);
if(ini_file[0]==0) { /* INI file not specified on command-line */
sprintf(ini_file,"%s%c%s.ini",ctrl_dir,PATH_DELIM,host_name);
if(!fexistcase(ini_file))
sprintf(ini_file,"%s%csbbs.ini",ctrl_dir,PATH_DELIM);
}
if(ini_file[0]==0) /* INI file not specified on command-line */
sbbs_get_ini_fname(ini_file, ctrl_dir, host_name);
/* Initialize BBS startup structure */
memset(&bbs_startup,0,sizeof(bbs_startup));
......
......@@ -140,6 +140,16 @@ static ini_bitdesc_t service_options[] = {
{ -1 ,NULL }
};
void sbbs_get_ini_fname(char* ini_file, char* ctrl_dir, char* 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,PREFIX"/etc/sbbs.ini");
#endif
if(!fexistcase(ini_file))
sprintf(ini_file,"%s%csbbs.ini",ctrl_dir,PATH_DELIM);
}
void sbbs_read_ini(
FILE* fp
......
......@@ -56,6 +56,12 @@
extern "C" {
#endif
void sbbs_get_ini_fname(
char* ini_file
,char* ctrl_dir
,char* host_name
);
void sbbs_read_ini(
FILE* fp
,BOOL* run_bbs
......
......@@ -944,13 +944,7 @@ int main(int argc, char** argv)
if(!winsock_cleanup())
return(-1);
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,PREFIX"/etc/sbbs.ini");
#endif
if(!fexistcase(ini_file))
sprintf(ini_file,"%s%csbbs.ini",ctrl_dir,PATH_DELIM);
sbbs_get_ini_fname(ini_file, ctrl_dir, host_name);
/* Initialize BBS startup structure */
memset(&bbs_startup,0,sizeof(bbs_startup));
......
......@@ -410,13 +410,8 @@ int main(int argc, char** argv) {
strcat(ctrl_dir,"/");
gethostname(str,sizeof(str)-1);
sprintf(ini_file,"%s%c%s.ini",ctrl_dir,PATH_DELIM,str);
#if 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,PATH_DELIM);
sbbs_get_ini_fname(ini_file, ctrl_dir, str);
/* Initialize BBS startup structure */
memset(&bbs_startup,0,sizeof(bbs_startup));
......
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