pkgsrc/misc/screen/patches/patch-aa
2002-09-15 06:51:35 +00:00

50 lines
918 B
Text

$NetBSD: patch-aa,v 1.9 2002/09/15 06:51:37 kim Exp $
--- pty.c.orig Mon Feb 11 07:44:18 2002
+++ pty.c Mon Aug 5 19:58:48 2002
@@ -318,6 +318,45 @@
/***************************************************************/
+#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
+
+/***************************************************************/
+
#ifndef PTY_DONE
int
OpenPTY(ttyn)