pkgsrc/misc/screen/patches/patch-aa
2015-02-13 04:44:40 +00:00

50 lines
955 B
Text

$NetBSD: patch-aa,v 1.13 2015/02/13 04:44:40 rodent Exp $
--- pty.c.orig 2014-04-26 10:58:35.000000000 +0000
+++ pty.c
@@ -318,6 +318,45 @@ char **ttyn;
/***************************************************************/
+#if defined(__NetBSD__) && !defined(PTY_DONE)
+#define PTY_DONE
+
+#include <sys/param.h>
+#include <string.h>
+
+int
+OpenPTY(ttyn)
+char **ttyn;
+{
+ int m, s, f;
+ char *t;
+
+ do
+ {
+ if (openpty(&m, &s, TtyName, NULL, NULL) < 0)
+ return -1;
+ close(m);
+ close(s);
+
+ strcpy(PtyName, TtyName);
+ t = strrchr(PtyName, '/');
+ if ((t == NULL ) || (*++t != 't'))
+ return -1;
+ *t = 'p';
+
+ f = open(PtyName, O_RDWR | O_NOCTTY);
+ }
+ while (f < 0);
+
+ initmaster(f);
+ *ttyn = TtyName;
+
+ return f;
+}
+#endif
+
+/***************************************************************/
+
#if defined(HAVE_OPENPTY) && !defined(PTY_DONE)
#define PTY_DONE
int