$OpenBSD: patch-ex_ex_script_c,v 1.1 2012/12/03 21:26:50 naddy Exp $
--- ex/ex_script.c.orig	Mon Dec  3 22:07:06 2012
+++ ex/ex_script.c	Mon Dec  3 22:08:43 2012
@@ -26,6 +26,9 @@ static const char sccsid[] = "@(#)ex_script.c	10.30 (B
 #ifdef HAVE_SYS5_PTY
 #include <sys/stropts.h>
 #endif
+#ifdef HAVE_OPENPTY
+#include <util.h>
+#endif
 #include <sys/time.h>
 #include <sys/wait.h>
 
@@ -690,7 +693,18 @@ sscr_check(sp)
 	F_CLR(gp, G_SCRWIN);
 }
 
-#ifdef HAVE_SYS5_PTY
+#if defined(HAVE_OPENPTY)
+static int
+sscr_pty(amaster, aslave, name, termp, winp)
+	int *amaster, *aslave;
+	char *name;
+	struct termios *termp;
+	void *winp;
+{
+	return (openpty(amaster, aslave, name, termp, winp));
+}
+
+#elif defined(HAVE_SYS5_PTY)
 static int ptys_open __P((int, char *));
 static int ptym_open __P((char *));
 
@@ -804,7 +818,7 @@ ptys_open(fdm, pts_name)
 	return (fds);
 }
 
-#else /* !HAVE_SYS5_PTY */
+#else /* !HAVE_SYS5_PTY && !HAVE_OPENPTY */
 
 static int
 sscr_pty(amaster, aslave, name, termp, winp)
@@ -860,4 +874,4 @@ sscr_pty(amaster, aslave, name, termp, winp)
 	errno = ENOENT;	/* out of ptys */
 	return (-1);
 }
-#endif /* HAVE_SYS5_PTY */
+#endif /* !HAVE_SYS5_PTY && !HAVE_OPENPTY */
