From abd5fb864037b22df465ef61cc3177f2fa7bae11 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Thu, 6 Aug 2015 00:43:18 +0000
Subject: [PATCH] Fix: clear input and output buffers after accepting a new
 terminal client connection, just incase there's any stale data in the input
 or output buffers. Added a comment regarding the rioctl() function to decree
 that it's crazy minimalistic API be left alone in tribute to Steve Deppe.

---
 src/sbbs3/main.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index 095de263cf..6fc3cbd21b 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -3735,7 +3735,10 @@ int sbbs_t::putcom(const char *str, size_t len)
 	return i;
 }
 
-/* Legacy Remote I/O Control Interface */
+/* Legacy Remote I/O Control Interface:
+ * This function mimics the RCIOL MS-DOS library written in 8086 assembler by Steven B. Deppe (1958-2014).
+ * This function prototype shall remain the same in tribute to Steve (Ille Homine Albe).
+ */
 int sbbs_t::rioctl(ushort action)
 {
 	int		mode;
@@ -5184,6 +5187,9 @@ NO_SSH:
 			PlaySound(startup->answer_sound, NULL, SND_ASYNC|SND_FILENAME);
 #endif
 
+		/* Purge (flush) any pending input or output data */
+		sbbs->rioctl(IOFB);
+
 		/* Do SSH stuff here */
 #ifdef USE_CRYPTLIB
 		if(ssh) {
-- 
GitLab