Commit 27fed1d2 authored by deuce's avatar deuce
Browse files

All of the various sbbs_* binaries are now identical. If the sbbs binary

is ran as sbbs_bbs, it just runs the telnet server, etc.

For UNIX users, this means they can all just be links to the sbbs binary.

For Windows users, just copy sbbs.exe to sbbs_bbs.exe for a BBS only
executable.
parent 1991b07f
...@@ -514,67 +514,26 @@ $(MSG2ANS): $(LIBODIR)/msg2ans.o ...@@ -514,67 +514,26 @@ $(MSG2ANS): $(LIBODIR)/msg2ans.o
@echo Linking $@ @echo Linking $@
$(QUIET)$(CC) -o $@ $^ $(QUIET)$(CC) -o $@ $^
# Single servers # "Single servers"
FTPCON_OBJS = $(LIBODIR)/sbbsftp.o $(LIBODIR)/conwrap.o \ $(SBBSWEB): $(SBBSCON)
$(LIBODIR)/sbbs_ini.o @echo Copying $@ for no good reason
WEBCON_OBJS = $(LIBODIR)/sbbsweb.o $(LIBODIR)/conwrap.o \ $(QUIET)cp $(SBBSCON) $@
$(LIBODIR)/sbbs_ini.o
MAILCON_OBJS = $(LIBODIR)/sbbsmail.o $(LIBODIR)/conwrap.o \ $(SBBSFTP): $(SBBSCON)
$(LIBODIR)/sbbs_ini.o @echo Copying $@ for no good reason
SRVCCON_OBJS = $(LIBODIR)/sbbssrvc.o $(LIBODIR)/conwrap.o \ $(QUIET)cp $(SBBSCON) $@
$(LIBODIR)/sbbs_ini.o
BBSCON_OBJS = $(LIBODIR)/sbbs_bbs.o $(LIBODIR)/conwrap.o \ $(SBBSMAIL): $(SBBSCON)
$(LIBODIR)/sbbs_ini.o @echo Copying $@ for no good reason
$(QUIET)cp $(SBBSCON) $@
$(LIBODIR)/sbbsweb.o : sbbscon.c
ifndef bcc $(SBBSSRVC): $(SBBSCON)
@echo $(COMPILE_MSG) $< @echo Copying $@ for no good reason
endif $(QUIET)cp $(SBBSCON) $@
$(QUIET)$(CC) $(CFLAGS) -o $@ -c $< -DNO_TELNET_SERVER -DNO_FTP_SERVER -DNO_MAIL_SERVER -DNO_SERVICES
$(SBBS_BBS): $(SBBSCON)
$(LIBODIR)/sbbsftp.o : sbbscon.c @echo Copying $@ for no good reason
ifndef bcc $(QUIET)cp $(SBBSCON) $@
@echo $(COMPILE_MSG) $<
endif
$(QUIET)$(CC) $(CFLAGS) -o $@ -c $< -DNO_TELNET_SERVER -DNO_MAIL_SERVER -DNO_SERVICES -DNO_WEB_SERVER
$(LIBODIR)/sbbsmail.o : sbbscon.c
ifndef bcc
@echo $(COMPILE_MSG) $<
endif
$(QUIET)$(CC) $(CFLAGS) -o $@ -c $< -DNO_TELNET_SERVER -DNO_FTP_SERVER -DNO_SERVICES -DNO_WEB_SERVER
$(LIBODIR)/sbbssrvc.o : sbbscon.c
ifndef bcc
@echo $(COMPILE_MSG) $<
endif
$(QUIET)$(CC) $(CFLAGS) -o $@ -c $< -DNO_TELNET_SERVER -DNO_FTP_SERVER -DNO_MAIL_SERVER -DNO_WEB_SERVER
$(LIBODIR)/sbbs_bbs.o : sbbscon.c
ifndef bcc
@echo $(COMPILE_MSG) $<
endif
$(QUIET)$(CC) $(CFLAGS) -o $@ -c $< -DNO_FTP_SERVER -DNO_MAIL_SERVER -DNO_SERVICES -DNO_WEB_SERVER
$(SBBSWEB): $(WEBCON_OBJS) $(SBBSLIB) $(WEBSRVR)
@echo Linking $@
$(QUIET)$(CC) $(CFLAGS) $(LFLAGS) -lwebsrvr -o $@ $(WEBCON_OBJS) $(SBBSLIB)
$(SBBSFTP): $(FTPCON_OBJS) $(SBBSLIB) $(FTPSRVR)
@echo Linking $@
$(QUIET)$(CC) $(CFLAGS) $(LFLAGS) -lftpsrvr -o $@ $(FTPCON_OBJS) $(SBBSLIB)
$(SBBSMAIL): $(MAILCON_OBJS) $(SBBSLIB) $(MAILSRVR)
@echo Linking $@
$(QUIET)$(CC) $(CFLAGS) $(LFLAGS) -lmailsrvr -o $@ $(MAILCON_OBJS) $(SBBSLIB)
$(SBBSSRVC): $(SRVCCON_OBJS) $(SBBSLIB) $(SERVICES)
@echo Linking $@
$(QUIET)$(CC) $(CFLAGS) $(LFLAGS) -lservices -o $@ $(SRVCCON_OBJS) $(SBBSLIB)
$(SBBS_BBS): $(BBSCON_OBJS) $(SBBSLIB)
@echo Linking $@
$(QUIET)$(CC) $(CFLAGS) $(LFLAGS) -o $@ $(BBSCON_OBJS) $(SBBSLIB)
depend: depend:
......
...@@ -79,25 +79,30 @@ ...@@ -79,25 +79,30 @@
#define SBBS_LOG_NAME "synchronet" #define SBBS_LOG_NAME "synchronet"
/* Global variables */ /* Global variables */
BOOL run_bbs=TRUE; BOOL run_bbs=FALSE;
BOOL bbs_running=FALSE; BOOL bbs_running=FALSE;
BOOL bbs_stopped=FALSE; BOOL bbs_stopped=FALSE;
BOOL has_bbs=FALSE;
bbs_startup_t bbs_startup; bbs_startup_t bbs_startup;
BOOL run_ftp=TRUE; BOOL run_ftp=FALSE;
BOOL ftp_running=FALSE; BOOL ftp_running=FALSE;
BOOL ftp_stopped=FALSE; BOOL ftp_stopped=FALSE;
BOOL has_ftp=FALSE;
ftp_startup_t ftp_startup; ftp_startup_t ftp_startup;
BOOL run_mail=TRUE; BOOL run_mail=FALSE;
BOOL mail_running=FALSE; BOOL mail_running=FALSE;
BOOL mail_stopped=FALSE; BOOL mail_stopped=FALSE;
BOOL has_mail=FALSE;
mail_startup_t mail_startup; mail_startup_t mail_startup;
BOOL run_services=TRUE; BOOL run_services=FALSE;
BOOL services_running=FALSE; BOOL services_running=FALSE;
BOOL services_stopped=FALSE; BOOL services_stopped=FALSE;
BOOL has_services=FALSE;
services_startup_t services_startup; services_startup_t services_startup;
BOOL run_web=TRUE; BOOL run_web=FALSE;
BOOL web_running=FALSE; BOOL web_running=FALSE;
BOOL web_stopped=FALSE; BOOL web_stopped=FALSE;
BOOL has_web=FALSE;
web_startup_t web_startup; web_startup_t web_startup;
uint thread_count=1; uint thread_count=1;
uint socket_count=0; uint socket_count=0;
...@@ -121,8 +126,31 @@ static const char* prompt; ...@@ -121,8 +126,31 @@ static const char* prompt;
static const char* usage = "\nusage: %s [[setting] [...]] [path/ini_file]\n" static const char* usage = "\nusage: %s [[setting] [...]] [path/ini_file]\n"
"\n" "\n"
#ifndef NO_TELNET_SERVER "Global settings:\n"
"Telnet server settings:\n\n" "\n"
"\thn[host] set hostname for this instance\n"
"\t if host not specified, uses gethostname\n"
#ifdef __unix__
"\tun<user> set username for BBS to run as\n"
"\tug<group> set group for BBS to run as\n"
"\td[x] run as daemon, log using syslog\n"
"\t x is the optional LOCALx facility to use\n"
"\t if none is specified, uses USER\n"
"\t if 'S' is specified, uses standard facilities\n"
#endif
"\tgi get user identity (using IDENT protocol)\n"
"\tnh disable hostname lookups\n"
"\tnj disable JavaScript support\n"
"\tne disable event thread\n"
"\tni do not read settings from .ini file\n"
#ifdef __unix__
"\tnd do not read run as daemon - overrides .ini file\n"
#endif
"\tlt use local timezone (do not force UTC/GMT)\n"
"\tdefaults show default settings and options\n"
"\n"
;
static const char* telnet_usage = "Telnet server settings:\n\n"
"\ttf<node> set first Telnet node number\n" "\ttf<node> set first Telnet node number\n"
"\ttl<node> set last Telnet node number\n" "\ttl<node> set last Telnet node number\n"
"\ttp<port> set Telnet server port\n" "\ttp<port> set Telnet server port\n"
...@@ -135,17 +163,15 @@ static const char* usage = "\nusage: %s [[setting] [...]] [path/ini_file]\n" ...@@ -135,17 +163,15 @@ static const char* usage = "\nusage: %s [[setting] [...]] [path/ini_file]\n"
"\ttq disable QWK events\n" "\ttq disable QWK events\n"
"\tt- disable Telnet/RLogin server\n" "\tt- disable Telnet/RLogin server\n"
"\n" "\n"
#endif ;
#ifndef NO_FTP_SERVER static const char* ftp_usage = "FTP server settings:\n"
"FTP server settings:\n"
"\n" "\n"
"\tfp<port> set FTP server port\n" "\tfp<port> set FTP server port\n"
"\tfo<value> set FTP server options value (advanced)\n" "\tfo<value> set FTP server options value (advanced)\n"
"\tf- disable FTP server\n" "\tf- disable FTP server\n"
"\n" "\n"
#endif ;
#ifndef NO_MAIL_SERVER static const char* mail_usage = "Mail server settings:\n"
"Mail server settings:\n"
"\n" "\n"
"\tms<port> set SMTP server port\n" "\tms<port> set SMTP server port\n"
"\tmp<port> set POP3 server port\n" "\tmp<port> set POP3 server port\n"
...@@ -157,36 +183,12 @@ static const char* usage = "\nusage: %s [[setting] [...]] [path/ini_file]\n" ...@@ -157,36 +183,12 @@ static const char* usage = "\nusage: %s [[setting] [...]] [path/ini_file]\n"
"\tmp- disable POP3 server\n" "\tmp- disable POP3 server\n"
"\tms- disable SendMail thread\n" "\tms- disable SendMail thread\n"
"\n" "\n"
#endif ;
#ifndef NO_SERVICES static const char* services_usage = "Services settings:\n"
"Services settings:\n"
"\n" "\n"
"\tso<value> set Services option value (advanced)\n" "\tso<value> set Services option value (advanced)\n"
"\ts- disable Services (no services module)\n" "\ts- disable Services (no services module)\n"
"\n" "\n"
#endif
"Global settings:\n"
"\n"
"\thn[host] set hostname for this instance\n"
"\t if host not specified, uses gethostname\n"
#ifdef __unix__
"\tun<user> set username for BBS to run as\n"
"\tug<group> set group for BBS to run as\n"
"\td[x] run as daemon, log using syslog\n"
"\t x is the optional LOCALx facility to use\n"
"\t if none is specified, uses USER\n"
"\t if 'S' is specified, uses standard facilities\n"
#endif
"\tgi get user identity (using IDENT protocol)\n"
"\tnh disable hostname lookups\n"
"\tnj disable JavaScript support\n"
"\tne disable event thread\n"
"\tni do not read settings from .ini file\n"
#ifdef __unix__
"\tnd do not read run as daemon - overrides .ini file\n"
#endif
"\tlt use local timezone (do not force UTC/GMT)\n"
"\tdefaults show default settings and options\n"
; ;
static int lputs(char *str) static int lputs(char *str)
...@@ -725,18 +727,12 @@ static void terminate(void) ...@@ -725,18 +727,12 @@ static void terminate(void)
{ {
ulong count=0; ulong count=0;
#ifndef NO_TELNET_SERVER
bbs_terminate(); bbs_terminate();
#endif
#ifndef NO_FTP_SERVER
ftp_terminate(); ftp_terminate();
#endif
#ifndef NO_WEB_SERVER #ifndef NO_WEB_SERVER
web_terminate(); web_terminate();
#endif #endif
#ifndef NO_MAIL_SERVER
mail_terminate(); mail_terminate();
#endif
#ifndef NO_SERVICES #ifndef NO_SERVICES
services_terminate(); services_terminate();
#endif #endif
...@@ -884,6 +880,33 @@ static void handle_sigs(void) { ...@@ -884,6 +880,33 @@ static void handle_sigs(void) {
} }
#endif /* __unix__ */ #endif /* __unix__ */
/****************************************************************************/
/* Displays appropriate usage info */
/****************************************************************************/
void show_usage(char *cmd)
{
printf(usage,cmd);
if(has_bbs)
printf(telnet_usage);
if(has_ftp)
printf(ftp_usage);
if(has_mail)
printf(mail_usage);
if(has_services)
printf(services_usage);
}
int command_is(char *cmdline, char *cmd)
{
char *p;
while((p=strcasestr(cmdline,cmd))!=NULL) {
if(*(p+strlen(cmd))==0 || !stricmp(".EXE",p+strlen(cmd)))
return 1;
}
return(0);
}
/****************************************************************************/ /****************************************************************************/
/* Main Entry Point */ /* Main Entry Point */
/****************************************************************************/ /****************************************************************************/
...@@ -911,6 +934,32 @@ int main(int argc, char** argv) ...@@ -911,6 +934,32 @@ int main(int argc, char** argv)
sigset_t sigs; sigset_t sigs;
#endif #endif
if(command_is(argv[0],"sbbs_ftp"))
run_ftp=has_ftp=TRUE;
else if (command_is(argv[0],"sbbs_mail"))
run_mail=has_mail=TRUE;
else if (command_is(argv[0],"sbbs_bbs"))
run_bbs=has_bbs=TRUE;
#ifndef NO_SERVICES
else if (command_is(argv[0],"sbbs_srvc"))
run_services=has_services=TRUE;
#endif
#ifndef NO_WEB_SERVER
else if (command_is(argv[0],"sbbs_web"))
run_web=has_web=TRUE;
#endif
else {
run_bbs=has_bbs=TRUE;
run_ftp=has_ftp=TRUE;
run_mail=has_mail=TRUE;
#ifndef NO_SERVICES
run_services=has_services=TRUE;
#endif
#ifndef NO_WEB_SERVER
run_web=has_web=TRUE;
#endif
}
#ifdef __QNX__ #ifdef __QNX__
setlocale( LC_ALL, "C-TRADITIONAL" ); setlocale( LC_ALL, "C-TRADITIONAL" );
#endif #endif
...@@ -1147,7 +1196,7 @@ int main(int argc, char** argv) ...@@ -1147,7 +1196,7 @@ int main(int argc, char** argv)
bbs_startup.last_node=atoi(arg); bbs_startup.last_node=atoi(arg);
break; break;
default: default:
printf(usage,argv[0]); show_usage(argv[0]);
return(0); return(0);
} }
break; break;
...@@ -1161,7 +1210,7 @@ int main(int argc, char** argv) ...@@ -1161,7 +1210,7 @@ int main(int argc, char** argv)
bbs_startup.options|=BBS_OPT_USE_2ND_RLOGIN; bbs_startup.options|=BBS_OPT_USE_2ND_RLOGIN;
break; break;
default: default:
printf(usage,argv[0]); show_usage(argv[0]);
return(0); return(0);
} }
break; break;
...@@ -1177,7 +1226,7 @@ int main(int argc, char** argv) ...@@ -1177,7 +1226,7 @@ int main(int argc, char** argv)
ftp_startup.options=strtoul(arg,NULL,0); ftp_startup.options=strtoul(arg,NULL,0);
break; break;
default: default:
printf(usage,argv[0]); show_usage(argv[0]);
return(0); return(0);
} }
break; break;
...@@ -1199,7 +1248,7 @@ int main(int argc, char** argv) ...@@ -1199,7 +1248,7 @@ int main(int argc, char** argv)
mail_startup.options|=MAIL_OPT_NO_SENDMAIL; mail_startup.options|=MAIL_OPT_NO_SENDMAIL;
break; break;
default: default:
printf(usage,argv[0]); show_usage(argv[0]);
return(0); return(0);
} }
break; break;
...@@ -1213,7 +1262,7 @@ int main(int argc, char** argv) ...@@ -1213,7 +1262,7 @@ int main(int argc, char** argv)
mail_startup.options&=~MAIL_OPT_ALLOW_POP3; mail_startup.options&=~MAIL_OPT_ALLOW_POP3;
break; break;
default: default:
printf(usage,argv[0]); show_usage(argv[0]);
return(0); return(0);
} }
break; break;
...@@ -1233,7 +1282,7 @@ int main(int argc, char** argv) ...@@ -1233,7 +1282,7 @@ int main(int argc, char** argv)
mail_startup.options|=MAIL_OPT_ALLOW_RELAY; mail_startup.options|=MAIL_OPT_ALLOW_RELAY;
break; break;
default: default:
printf(usage,argv[0]); show_usage(argv[0]);
return(0); return(0);
} }
break; break;
...@@ -1246,7 +1295,7 @@ int main(int argc, char** argv) ...@@ -1246,7 +1295,7 @@ int main(int argc, char** argv)
services_startup.options=strtoul(arg,NULL,0); services_startup.options=strtoul(arg,NULL,0);
break; break;
default: default:
printf(usage,argv[0]); show_usage(argv[0]);
return(0); return(0);
} }
break; break;
...@@ -1259,7 +1308,7 @@ int main(int argc, char** argv) ...@@ -1259,7 +1308,7 @@ int main(int argc, char** argv)
services_startup.options|=BBS_OPT_GET_IDENT; services_startup.options|=BBS_OPT_GET_IDENT;
break; break;
default: default:
printf(usage,argv[0]); show_usage(argv[0]);
return(0); return(0);
} }
break; break;
...@@ -1280,7 +1329,7 @@ int main(int argc, char** argv) ...@@ -1280,7 +1329,7 @@ int main(int argc, char** argv)
printf("Setting hostname: %s\n",bbs_startup.host_name); printf("Setting hostname: %s\n",bbs_startup.host_name);
break; break;
default: default:
printf(usage,argv[0]); show_usage(argv[0]);
return(0); return(0);
} }
break; break;
...@@ -1303,7 +1352,7 @@ int main(int argc, char** argv) ...@@ -1303,7 +1352,7 @@ int main(int argc, char** argv)
#endif #endif
break; break;
default: default:
printf(usage,argv[0]); show_usage(argv[0]);
return(0); return(0);
} }
break; break;
...@@ -1347,7 +1396,7 @@ int main(int argc, char** argv) ...@@ -1347,7 +1396,7 @@ int main(int argc, char** argv)
#endif #endif
break; break;
default: default:
printf(usage,argv[0]); show_usage(argv[0]);
return(0); return(0);
} }
break; break;
...@@ -1360,13 +1409,13 @@ int main(int argc, char** argv) ...@@ -1360,13 +1409,13 @@ int main(int argc, char** argv)
services_startup.options|=BBS_OPT_LOCAL_TIMEZONE; services_startup.options|=BBS_OPT_LOCAL_TIMEZONE;
break; break;
default: default:
printf(usage,argv[0]); show_usage(argv[0]);
return(0); return(0);
} }
break; break;
default: default:
printf(usage,argv[0]); show_usage(argv[0]);
return(0); return(0);
} }
} }
...@@ -1465,24 +1514,12 @@ int main(int argc, char** argv) ...@@ -1465,24 +1514,12 @@ int main(int argc, char** argv)
_beginthread((void(*)(void*))handle_sigs,0,NULL); _beginthread((void(*)(void*))handle_sigs,0,NULL);
#endif #endif
#ifdef NO_TELNET_SERVER
run_bbs=FALSE;
#else
if(run_bbs) if(run_bbs)
_beginthread((void(*)(void*))bbs_thread,0,&bbs_startup); _beginthread((void(*)(void*))bbs_thread,0,&bbs_startup);
#endif
#ifdef NO_FTP_SERVER
run_ftp=FALSE;
#else
if(run_ftp) if(run_ftp)
_beginthread((void(*)(void*))ftp_server,0,&ftp_startup); _beginthread((void(*)(void*))ftp_server,0,&ftp_startup);
#endif
#ifdef NO_MAIL_SERVER
run_mail=FALSE;
#else
if(run_mail) if(run_mail)
_beginthread((void(*)(void*))mail_server,0,&mail_startup); _beginthread((void(*)(void*))mail_server,0,&mail_startup);
#endif
#ifdef NO_SERVICES #ifdef NO_SERVICES
run_services=FALSE; run_services=FALSE;
#else #else
......
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