Hello,

I just looked through screen's source code and I saw that it tries
almost any way to open up a PTY, except for the only way described in
POSIX, namely posix_openpt():

        
http://www.opengroup.org/onlinepubs/000095399/functions/posix_openpt.html

We can just call posix_openpt() and ptsname() to obtain a PTY and figure
out its name.

I've attached a really simple patch to fix screen to use posix_openpt(),
but I didn't add the autoconf parts, because for some reason, it gave a
lot of strange errors on my box. We can only use this code if
posix_openpt() and ptsname() are available. If someone else is willing
to add those bits for me, that would be great.

Yours,
-- 
 Ed Schouten <[EMAIL PROTECTED]>
 WWW: http://g-rave.nl/
--- pty.c	2003-09-08 16:26:18.000000000 +0200
+++ pty.c	2008-01-27 14:14:58.000000000 +0100
@@ -145,6 +145,35 @@
 
 /***************************************************************/
 
+#if 1 && !defined(PTY_DONE)
+#define PTY_DONE
+int
+OpenPTY(ttyn)
+char **ttyn;
+{
+  int f;
+  char *n;
+
+  f = posix_openpt(O_RDWR|O_NOCTTY);
+  if (f < 0)
+    return -1;
+
+  n = ptsname(f);
+  if (n == NULL) {
+    close(f);
+    return -1;
+  }
+
+  initmaster(f);
+  pty_preopen = 1;
+  strncpy(TtyName, n, sizeof(TtyName));
+  *ttyn = TtyName;
+  return f;    
+}
+#endif
+
+/***************************************************************/
+
 #if defined(OSX) && !defined(PTY_DONE)
 #define PTY_DONE
 int

Attachment: pgpRxu74AnCDo.pgp
Description: PGP signature

_______________________________________________
screen-devel mailing list
screen-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/screen-devel

Reply via email to