From c90b0c9bd05a8ea4c7b213fdc158474cdbb6edb0 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Wed, 12 Feb 2003 02:00:20 +0000
Subject: [PATCH] Prompt is not output after "reading .ini" file line (made
 usage display ugly). Added [path/ini_file] to usage info. lputs() no longer
 tries to print prompt if it is NULL. Using fexistcase() for $HOSTNAME.ini
 (case insensitive). ini file can now be specified on the command-line using
 forward-slash on Win32.

---
 src/sbbs3/sbbscon.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/sbbs3/sbbscon.c b/src/sbbs3/sbbscon.c
index f38241e4f8..39102fc235 100644
--- a/src/sbbs3/sbbscon.c
+++ b/src/sbbs3/sbbscon.c
@@ -109,10 +109,9 @@ BOOL				is_daemon=FALSE;
 BOOL				std_facilities=FALSE;
 #endif
 
-static const char* prompt = 
-"[Threads: %d  Sockets: %d  Clients: %d  Served: %lu] (?=Help): ";
+static const char* prompt;
 
-static const char* usage  = "usage: %s [[setting] [...]]\n"
+static const char* usage  = "\nusage: %s [[setting] [...]] [path/ini_file]\n"
 							"\n"
 							"Telnet server settings:\n\n"
 							"\ttf<node>   set first Telnet node number\n"
@@ -199,7 +198,8 @@ static int lputs(char *str)
 	if(str!=NULL)
 		printf("%s\n",str);
 	/* re-display prompt with current stats */
-	prompt_len = printf(prompt, thread_count, socket_count, client_count, served);
+	if(prompt!=NULL)
+		prompt_len = printf(prompt, thread_count, socket_count, client_count, served);
 	fflush(stdout);
 	pthread_mutex_unlock(&mutex);
 
@@ -855,10 +855,10 @@ int main(int argc, char** argv)
 
 	sprintf(ini_file,"%s%c%s.ini",ctrl_dir,BACKSLASH,host_name);
 #if defined(__unix__) && defined(PREFIX)
-	if(!fexist(ini_file))
+	if(!fexistcase(ini_file))
 		sprintf(ini_file,"%s/etc/sbbs.ini",PREFIX);
 #endif
-	if(!fexist(ini_file))
+	if(!fexistcase(ini_file))
 		sprintf(ini_file,"%s%csbbs.ini",ctrl_dir,BACKSLASH);
 
 	/* Initialize BBS startup structure */
@@ -967,7 +967,7 @@ int main(int argc, char** argv)
 		arg=argv[i];
 		while(*arg=='-')
 			arg++;
-		if(strchr(arg,BACKSLASH)) {
+		if(strcspn(arg,"\\/")!=strlen(arg)) {
 			strcpy(ini_file,arg);
 			continue;
 		}
@@ -983,6 +983,8 @@ int main(int argc, char** argv)
 		bbs_lputs(str);
 	}
 
+	prompt = "[Threads: %d  Sockets: %d  Clients: %d  Served: %lu] (?=Help): ";
+
 	/* We call this function to set defaults, even if there's no .ini file */
 	sbbs_read_ini(fp, 
 		&run_bbs,		&bbs_startup,
@@ -1007,7 +1009,7 @@ int main(int argc, char** argv)
 		arg=argv[i];
 		while(*arg=='-')
 			arg++;
-		if(strchr(arg,BACKSLASH))	/* ini_file name */
+		if(strcspn(arg,"\\/")!=strlen(arg))	/* ini_file name */
 			continue;
 		if(!stricmp(arg,"defaults")) {
 			printf("Default settings:\n");
-- 
GitLab