# Patch #11 for c3270 3.2.18.
# Prevents c3270 from dropping into the 'c3270>' prompt when there is a socket
# error, and allows the 'secure' option (-xrm 'c3270.secure: true') to disable
# the 'c3270>' prompt altogether.

--- c3270-3.2/c3270.c	2001/09/20 02:36:53	1.53
+++ c3270-3.2/c3270.c	2002/02/22 02:35:36
@@ -211,6 +211,9 @@
 				exit(1);
 		}
 	} else {
+		if (appres.secure) {
+			Error("Must specify hostname with secure option");
+		}
 		appres.once = False;
 		interact();
 	}
@@ -220,10 +223,6 @@
 	/* Process events forever. */
 	while (1) {
 		(void) process_events(True);
-		if (escaped) {
-			interact();
-			screen_resume();
-		}
 		if (!CONNECTED) {
 			screen_suspend();
 			(void) printf("Disconnected.\n");
@@ -231,6 +230,9 @@
 				exit(0);
 			interact();
 			screen_resume();
+		} else if (escaped) {
+			interact();
+			screen_resume();
 		}
 
 		if (children && waitpid(0, (int *)0, WNOHANG) > 0)
@@ -245,6 +247,14 @@
 	/* In case we got here because a command output, stop the pager. */
 	stop_pager();
 
+	if (appres.secure) {
+		char s[10];
+
+		printf("Press <RETURN>\n");
+		(void) fgets(s, sizeof(s), stdin);
+		return;
+	}
+
 	for (;;) {
 		int sl;
 		char *s;
@@ -757,7 +767,8 @@
     Cardinal *num_params unused)
 {
 	action_debug(Escape_action, event, params, num_params);
-	screen_suspend();
+	if (!appres.secure)
+		screen_suspend();
 }
 
 /* Support for c3270 profiles. */
