blob: 7f0cef36d8bf3ab3830283a2f695f77d95e118db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
$NetBSD: patch-aa,v 1.8 2002/05/21 17:57:04 tron Exp $
--- pty.c.orig Mon Feb 11 13:44:18 2002
+++ pty.c Tue May 21 19:55:36 2002
@@ -318,6 +318,47 @@
/***************************************************************/
+#if defined(__NetBSD__) && !defined(PTY_DONE)
+#define PTY_DONE
+
+#include <sys/param.h>
+
+#include <string.h>
+#include <util.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)
|