blob: adc4e02cb4663d2d3945970ab23e1b62d8567c64 (
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
|
$NetBSD: patch-ad,v 1.2 2005/11/03 21:51:57 rillig Exp $
--- src/uartctrl.cpp 2003/08/14 08:54:51 1.1
+++ src/uartctrl.cpp 2003/08/14 09:15:14
@@ -40,6 +40,29 @@
//
int CUARTCtrl::GetPty()
{
+#ifdef __NetBSD__
+#include <sys/param.h>
+ // masterpty = fd of master pty
+ const char *letters = "pqrstuvwxyzPQRST";
+ const char *numbers = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ const char *let;
+ const char *num;
+ char ptyname[MAXPATHLEN];
+ int cc;
+
+ cc = strlcpy(ptyname, "/dev/pty", sizeof(ptyname));
+ ptyname[cc + 2] = 0x0;
+ for (let = letters ; *let ; let++) {
+ ptyname[cc] = *let;
+ for (num = numbers ; *num ; num++) {
+ ptyname[cc + 1] = *num;
+ }
+ if ((masterpty = open(ptyname, O_RDWR | O_NONBLOCK, 0666)) >= 0) {
+ return 0;
+ }
+ }
+ return -1;
+#else
char *namepty;
struct termios tiopty;
int curFlags;
@@ -102,6 +125,7 @@
getchar();
}
return 0;
+#endif
}
///////////////////////////////////////////////////////////////////////////////
|