From e1d4a4af9c43adff1fec0afced5a761b454caecc Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sun, 31 Dec 2000 03:41:55 +0000
Subject: [PATCH] semaphore file paths can now include command-line specifiers
 (e.g. %j)

---
 src/sbbs3/fido.cpp     | 9 ++++++---
 src/sbbs3/netmail.cpp  | 3 ++-
 src/sbbs3/postmsg.cpp  | 3 ++-
 src/sbbs3/un_qwk.cpp   | 3 ++-
 src/sbbs3/un_rep.cpp   | 3 ++-
 src/sbbs3/upload.cpp   | 3 ++-
 src/sbbs3/writemsg.cpp | 2 +-
 7 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/sbbs3/fido.cpp b/src/sbbs3/fido.cpp
index 50c04e814b..f58ff59ca8 100644
--- a/src/sbbs3/fido.cpp
+++ b/src/sbbs3/fido.cpp
@@ -379,7 +379,8 @@ bool sbbs_t::netmail(char *into, char *title, long mode)
 		cc_sent++; }
 
 	if(cfg.netmail_sem[0])		/* update semaphore file */
-		if((file=nopen(cfg.netmail_sem,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
+		if((file=nopen(cmdstr(cfg.netmail_sem,nulstr,nulstr,NULL)
+				,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
 			close(file);
 
 	FREE(buf);
@@ -690,7 +691,8 @@ void sbbs_t::qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub)
 		else {		/* Successful */
 			if(inet) {
 				if(cfg.inetmail_sem[0]) 	 /* update semaphore file */
-					if((fido=nopen(cfg.inetmail_sem,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
+					if((fido=nopen(cmdstr(cfg.inetmail_sem,nulstr,nulstr,NULL)
+						,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
 						close(fido);
 				if(!(useron.exempt&FLAG('S')))
 					subtract_cdt(&cfg,&useron,cfg.inetmail_cost); }
@@ -846,7 +848,8 @@ void sbbs_t::qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub)
 	close(fido);
 	FREE((char *)qwkbuf);
 	if(cfg.netmail_sem[0])		/* update semaphore file */
-		if((fido=nopen(cfg.netmail_sem,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
+		if((fido=nopen(cmdstr(cfg.netmail_sem,nulstr,nulstr,NULL)
+			,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
 			close(fido);
 	if(!(useron.exempt&FLAG('S')))
 		subtract_cdt(&cfg,&useron,cfg.netmail_cost);
diff --git a/src/sbbs3/netmail.cpp b/src/sbbs3/netmail.cpp
index a42a4000f8..68785cfc77 100644
--- a/src/sbbs3/netmail.cpp
+++ b/src/sbbs3/netmail.cpp
@@ -270,7 +270,8 @@ bool sbbs_t::inetmail(char *into, char *subj, long mode)
 		autohangup();
 
 	if(cfg.inetmail_sem[0]) 	 /* update semaphore file */
-		if((file=nopen(cfg.inetmail_sem,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
+		if((file=nopen(cmdstr(cfg.inetmail_sem,nulstr,nulstr,NULL)
+			,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
 			close(file);
 	if(!(useron.exempt&FLAG('S')))
 		subtract_cdt(&cfg,&useron,cfg.inetmail_cost);
diff --git a/src/sbbs3/postmsg.cpp b/src/sbbs3/postmsg.cpp
index 967b77b7cc..65f3965766 100644
--- a/src/sbbs3/postmsg.cpp
+++ b/src/sbbs3/postmsg.cpp
@@ -335,7 +335,8 @@ bool sbbs_t::postmsg(uint subnum, smbmsg_t *remsg, long wm_mode)
 	sprintf(str,"Posted on %s %s",cfg.grp[cfg.sub[subnum]->grp]->sname,cfg.sub[subnum]->lname);
 	logline("P+",str);
 	if(cfg.sub[subnum]->misc&SUB_FIDO && cfg.sub[subnum]->echomail_sem[0]) /* semaphore */
-		if((file=nopen(cfg.sub[subnum]->echomail_sem,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
+		if((file=nopen(cmdstr(cfg.sub[subnum]->echomail_sem,nulstr,nulstr,NULL)
+			,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
 			close(file);
 	return(true);
 }
diff --git a/src/sbbs3/un_qwk.cpp b/src/sbbs3/un_qwk.cpp
index fac926b2d7..56bdaedc01 100644
--- a/src/sbbs3/un_qwk.cpp
+++ b/src/sbbs3/un_qwk.cpp
@@ -232,7 +232,8 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
 		}
 
 		if(cfg.sub[j]->misc&SUB_FIDO && cfg.sub[j]->echomail_sem[0]) /* update semaphore */
-			if((file=nopen(cfg.sub[j]->echomail_sem,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
+			if((file=nopen(cmdstr(cfg.sub[j]->echomail_sem,nulstr,nulstr,NULL)
+				,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
 				close(file);
 		lprintf("Message from %s Posted on %s %s"
 			,cfg.qhub[hubnum]->id,cfg.grp[cfg.sub[j]->grp]->sname,cfg.sub[j]->lname); 
diff --git a/src/sbbs3/un_rep.cpp b/src/sbbs3/un_rep.cpp
index d918b126fb..55357fd8db 100644
--- a/src/sbbs3/un_rep.cpp
+++ b/src/sbbs3/un_rep.cpp
@@ -396,7 +396,8 @@ bool sbbs_t::unpack_rep(char* repfile)
 			sprintf(str,"Posted on %s/%s",cfg.grp[cfg.sub[n]->grp]->sname
 				,cfg.sub[n]->lname);
 			if(cfg.sub[n]->misc&SUB_FIDO && cfg.sub[n]->echomail_sem[0])  /* semaphore */
-				if((file=nopen(cfg.sub[n]->echomail_sem,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
+				if((file=nopen(cmdstr(cfg.sub[n]->echomail_sem,nulstr,nulstr,NULL)
+					,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
 					close(file);
 			logline("P+",str); } }         /* end of public message */
 
diff --git a/src/sbbs3/upload.cpp b/src/sbbs3/upload.cpp
index 7cf8ab0b03..9ea26379a9 100644
--- a/src/sbbs3/upload.cpp
+++ b/src/sbbs3/upload.cpp
@@ -177,7 +177,8 @@ bool sbbs_t::uploadfile(file_t *f)
 	sprintf(str,"Uploaded %s to %s %s",f->name,cfg.lib[cfg.dir[f->dir]->lib]->sname
 		,cfg.dir[f->dir]->sname);
 	if(cfg.dir[f->dir]->upload_sem[0])
-		if((file=nopen(cfg.dir[f->dir]->upload_sem,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
+		if((file=nopen(cmdstr(cfg.dir[f->dir]->upload_sem,nulstr,nulstr,NULL)
+			,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
 			close(file);
 	logline("U+",str);
 	/**************************/
diff --git a/src/sbbs3/writemsg.cpp b/src/sbbs3/writemsg.cpp
index 0184fc92df..f241036265 100644
--- a/src/sbbs3/writemsg.cpp
+++ b/src/sbbs3/writemsg.cpp
@@ -1187,7 +1187,7 @@ bool sbbs_t::movemsg(smbmsg_t* msg, uint subnum)
 		,cfg.grp[cfg.sub[subnum]->grp]->sname,cfg.sub[subnum]->sname);
 	logline("M+",str);
 	if(cfg.sub[newsub]->misc&SUB_FIDO && cfg.sub[newsub]->echomail_sem[0])
-		if((file=nopen(cfg.sub[newsub]->echomail_sem
+		if((file=nopen(cmdstr(cfg.sub[newsub]->echomail_sem,nulstr,nulstr,NULL)
 			,O_WRONLY|O_CREAT|O_TRUNC))!=-1)
 			close(file);
 	return(true);
-- 
GitLab