--- ./conf-end.h-pre	Thu Mar  7 11:46:46 1996
+++ ./conf-end.h	Thu Oct 18 19:27:08 2001
@@ -53,3 +53,27 @@
 # define GCC_FUNC_ATTR(x)
 # define GCC_FUNC_ATTR2(x,y)
 #endif /* HAVE_GCC_FUNC_ATTR */
+
+#ifdef OS2
+/* Due to a combination of two features, we might steal keys from the kid:
+   a) TERMIOS interface is implemented via a thread which constantly
+      reads-ahead from the keyboard.  The thread is auto-switched off for
+      syncroneously executed kids, but not for asyncroneous ones.  This
+      thread is *not* switched off after it starts.  TERMIO interface
+      grants a flag in c_lflags which switches this thread off when
+      restoring the state.
+
+   b) we execute kids asyncroneously.  Otherwise the following may happen:
+      the kid could forget to register itself as a target for Control-Break
+      (e.g., ping).  Then it is we who gets Control-Break and dies.  By
+      the semantic of OS/2 program exit, this leaves ourselves as zombies until
+      the kid terminates (and the kid unkillable).
+      Running kids asyncroneously allows up to we catch signals during the
+      kid execution, and pass them to the kid by force in the case it is
+      us who received the signal.
+ */
+# undef HAVE_TERMIOS_H
+# ifndef HAVE_TERMIO_H
+#  define HAVE_TERMIO_H
+# endif
+#endif
--- ./shf.c-pre	Thu Oct 18 17:42:36 2001
+++ ./shf.c	Thu Oct 18 18:08:40 2001
@@ -133,10 +133,6 @@ shf_reopen(fd, sflags, shf)
 	if ((sflags & SHF_GETFL) || SHF_WASTEXT) {
 		int flags = fcntl(fd, F_GETFL, 0);
 
-#if SHF_WASTEXT
-		if (!(flags & O_BINARY))
-		    sflags |= SHF_WASTEXT;
-#endif
 		if (!(sflags & SHF_GETFL)) ; /* Do nothing */
 		else if (flags < 0)
 			/* will get an error on first read/write */
@@ -147,6 +143,10 @@ shf_reopen(fd, sflags, shf)
 			case O_WRONLY: sflags |= SHF_WR; break;
 			case O_RDWR: sflags |= SHF_RDWR; break;
 			}
+#if SHF_WASTEXT
+		if (!(flags & O_BINARY) && (sflags & SHF_RD))
+		    sflags |= SHF_WASTEXT;
+#endif
 	}
 
 	if (!(sflags & (SHF_RD | SHF_WR)))
