From e995ce203f25446e1208afef8cf88345b2a37489 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Windows 11)" <rob@synchro.net>
Date: Mon, 3 Jun 2024 22:21:36 -0700
Subject: [PATCH] Add test command 'Z' for locking an SMB header until keypress

Just for testing/experimenting with proper recording locking support. e.g.
when one process or network node (on a LAN) has the SMB header locked, another
process/node should not be able to lock it or reading the status header.
---
 src/sbbs3/smbutil.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/sbbs3/smbutil.c b/src/sbbs3/smbutil.c
index 5f261a213c..b1ffc32e76 100644
--- a/src/sbbs3/smbutil.c
+++ b/src/sbbs3/smbutil.c
@@ -102,6 +102,7 @@ char *usage=
 "       u    = undelete all msgs (remove delete flag)\n"
 "       m    = maintain msg base - delete old msgs and msgs over max\n"
 "       p[k] = pack msg base (k specifies minimum packable Kbytes)\n"
+"       Z    = lock a msg base SMB header for testing, until keypress\n"
 "       L    = lock a msg base for exclusive-access/backup\n"
 "       U    = unlock a msg base\n"
 "\n"
@@ -2015,6 +2016,16 @@ int main(int argc, char **argv)
 						case 'M':
 							maint();
 							break;
+						case 'Z':
+							puts("Locking SMB header");
+							if((i=smb_locksmbhdr(&smb)) != SMB_SUCCESS) {
+								fprintf(errfp,"\n%s!smb_locksmbhdr returned %d: %s\n"
+									,beep,i,smb.last_error);
+								return EXIT_FAILURE;
+							}
+							fprintf(statfp,"\nHit enter to continue...");
+							getchar();
+							break;
 						default:
 							printf("%s",usage);
 							break; 
-- 
GitLab