# Patch #4 for x3270 3.2.18.
# Sends script error output back to the script, rather than to x3270's stderr.

--- x3270-3.2/macros.c	2001/12/25 03:40:21	1.37
+++ x3270-3.2/macros.c	2002/01/07 18:02:18
@@ -1074,7 +1074,15 @@
 sms_error(const char *msg)
 {
 	/* Print the error message. */
-	(void) fprintf(stderr, "%s\n", msg);
+	switch (sms->type) {
+	case ST_PEER:
+	case ST_CHILD:
+		(void) fprintf(sms->outfile, "data: %s\n", msg);
+		break;
+	default:
+		(void) fprintf(stderr, "%s\n", msg);
+		break;
+	}
 
 	/* Fail the command. */
 	sms->success = False;
