...
 
Commits (1)
  • Rob Swindell's avatar
    Rewrite recycle_servers() · ff90a5a0
    Rob Swindell authored
    Added an "All Servers" option.
    Fixed the "Telnet server" (now "Terminal Server") to set the correct/modern semaphore file.
    Simplified the implementation of this function.
    ff90a5a0
...@@ -643,57 +643,53 @@ int run_events(scfg_t *cfg) ...@@ -643,57 +643,53 @@ int run_events(scfg_t *cfg)
int recycle_servers(scfg_t *cfg) int recycle_servers(scfg_t *cfg)
{ {
char str[1024]; char str[MAX_PATH + 1];
char **opt; char **opt;
int i=0; int i=0;
const int opt_count = 6;
if((opt=(char **)alloca(sizeof(char *)*(5+1)))==NULL) if((opt=(char **)alloca(sizeof(char *)*(opt_count+1)))==NULL)
allocfail(sizeof(char *)*(5+1)); allocfail(sizeof(char *)*(opt_count+1));
for(i=0;i<(5+1);i++)
if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
allocfail(MAX_OPLN);
i=0; opt[i++] = "All Servers";
strcpy(opt[i++],"FTP server"); opt[i++] = "Terminal Server";
strcpy(opt[i++],"Mail server"); opt[i++] = "Mail Server";
strcpy(opt[i++],"Services"); opt[i++] = "FTP Server";
strcpy(opt[i++],"Telnet server"); opt[i++] = "Web Server";
strcpy(opt[i++],"Web server"); opt[i++] = "Services";
opt[i][0]=0; opt[i] = NULL;
uifc.helpbuf= "`Recycle Servers\n" uifc.helpbuf= "`Recycle Servers\n"
"`---------------\n\n" "`---------------\n\n"
"To rerun a server, highlight it and press Enter.\n" "To recycle a server, highlight it and press Enter.\n"
"This will reload the configuration files for selected\n" "This will reload the configuration files for selected\n"
"server."; "server.";
i=0; i=0;
while(1) { while(1) {
const char* ext = "";
switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"Recycle Servers",opt)) { switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"Recycle Servers",opt)) {
case -1: case -1:
return(0); return(0);
break; break;
case 0:
sprintf(str,"%sftpsrvr.rec",cfg->ctrl_dir);
ftouch(str);
break;
case 1: case 1:
sprintf(str,"%smailsrvr.rec",cfg->ctrl_dir); ext = ".term";
ftouch(str);
break; break;
case 2: case 2:
sprintf(str,"%sservices.rec",cfg->ctrl_dir); ext = ".mail";
ftouch(str);
break; break;
case 3: case 3:
sprintf(str,"%stelnet.rec",cfg->ctrl_dir); ext = ".ftp";
ftouch(str);
break; break;
case 4: case 4:
sprintf(str,"%swebsrvr.rec",cfg->ctrl_dir); ext = ".web";
ftouch(str); break;
case 5:
ext = ".services";
break; break;
} }
SAFEPRINTF2(str, "%srecycle%s", cfg->ctrl_dir, ext);
ftouch(str);
} }
return(0); return(0);
} }
......