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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
diff -urNad xxgdb-1.12~/calldbx.c xxgdb-1.12/calldbx.c
--- xxgdb-1.12~/calldbx.c 1996-10-02 10:59:45.000000000 +0200
+++ xxgdb-1.12/calldbx.c 2008-05-16 17:44:05.000000000 +0200
@@ -85,8 +85,10 @@
#include <sys/un.h>
#endif /* CREATE_IO_WINDOW */
-#ifdef SVR4
+#if defined(SVR4) || defined(UNIX98)
#define MASTER_CLONE "/dev/ptmx"
+#endif
+#ifdef SVR4
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stropts.h>
@@ -125,13 +127,14 @@
{
int master;
-#ifdef SVR4 /* (MJH) Use STREAMS */
+#if defined(SVR4) || defined(UNIX98)
if((master = open(MASTER_CLONE, O_RDWR)) < 0)
perror(MASTER_CLONE);
else
return master;
-#else
+#endif
+#if !defined(SVR4) && !defined(UNIX98)
int i;
char c;
@@ -150,7 +153,7 @@
#ifndef sco
}
#endif
-#endif /* SVR4 */
+#endif /* !defined(SVR4) && !defined(UNIX98) */
#ifdef GDB
fprintf(stderr, "xxgdb: all ptys in use\n");
@@ -166,6 +169,25 @@
{
int slave;
+#if defined(UNIX98)
+
+ int n;
+ int zero=0;
+ char ptsname[16];
+
+ if (ioctl(master, TIOCGPTN, &n) < 0)
+ exit(2);
+ snprintf(ptsname,sizeof(ptsname),"/dev/pts/%i", n);
+ if (ioctl(master, TIOCSPTLCK, &zero) < 0)
+ exit(3);
+ if ((slave = open(ptsname, O_RDWR)) < 0) {
+ perror(ptsname);
+ exit(4);
+ }
+ return slave;
+
+#else
+
#ifdef SVR4 /* (MJH) */
char *slave_name = "unknown";
extern char *ptsname(int master);
@@ -193,6 +215,8 @@
}
return slave;
#endif /* SVR4 */
+
+#endif /* UNIX98 */
}
#ifdef CREATE_IO_WINDOW
|