1
0
Fork 0
mirror of git://slackware.nl/current.git synced 2025-01-14 08:01:11 +01:00
slackware-current/source/xap/xxgdb/xxgdb-1.12-debian-pty.patch

77 lines
1.5 KiB
Diff
Raw Normal View History

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