# Patch #12 for c3270 3.2.18.
# Corrects an infinite loop in the SysReq action in TN3270E mode.

--- c3270-3.2/macros.c	2001/12/25 03:40:21	1.37
+++ c3270-3.2/macros.c	2002/02/28 16:43:42
@@ -1162,13 +1170,22 @@
 void
 sms_continue(void)
 {
+	static Boolean continuing = False;
+
+	if (continuing)
+		return;
+	continuing = True;
+
 	while (True) {
-		if (sms == SN)
+		if (sms == SN) {
+			continuing = False;
 			return;
+		}
 
 		switch (sms->state) {
 
 		    case SS_IDLE:
+			continuing = False;
 			return;		/* nothing to do */
 
 		    case SS_INCOMPLETE:
@@ -1176,8 +1193,10 @@
 			break;		/* let it proceed */
 
 		    case SS_KBWAIT:
-			if (KBWAIT)
+			if (KBWAIT) {
+				continuing = False;
 				return;
+			}
 			break;
 
 		    case SS_WAIT_ANSI:
@@ -1185,6 +1204,7 @@
 			    sms->state = SS_WAIT;
 			    continue;
 			}
+			continuing = False;
 			return;
 
 		    case SS_WAIT_3270:
@@ -1192,16 +1212,21 @@
 			    sms->state = SS_WAIT;
 			    continue;
 			}
+			continuing = False;
 			return;
 
 		    case SS_WAIT:
-			if (!CAN_PROCEED)
+			if (!CAN_PROCEED) {
+				continuing = False;
 				return;
+			}
 			/* fall through... */
 		    case SS_CONNECT_WAIT:
 			if (HALF_CONNECTED ||
-			    (CONNECTED && (kybdlock & KL_AWAITING_FIRST)))
+			    (CONNECTED && (kybdlock & KL_AWAITING_FIRST))) {
+				continuing = False;
 				return;
+			}
 			if (!CONNECTED) {
 				/* connection failed */
 				if (sms->need_prompt) {
@@ -1216,27 +1241,35 @@
 		    case SS_FT_WAIT:
 			if (ft_state == FT_NONE)
 				break;
-			else
+			else {
+				continuing = False;
 				return;
+			}
 #endif /*]*/
 
 		    case SS_WAIT_OUTPUT:
 		    case SS_SWAIT_OUTPUT:
+			continuing = False;
 			return;
 
 		    case SS_WAIT_DISC:
 			if (!CONNECTED)
 				break;
-			else
+			else {
+				continuing = False;
 				return;
+			}
 
 		    case SS_PAUSED:
+			continuing = False;
 			return;
 
 		    case SS_EXPECTING:
+			continuing = False;
 			return;
 
 		    case SS_CLOSING:
+			continuing = False;
 			return;	/* can't happen, I hope */
 
 		}
@@ -1266,6 +1299,8 @@
 			break;
 		}
 	}
+
+	continuing = False;
 }
 
 /*
