Hi all,

The pty ranges of FreeBSD are different than other systems, and
PTYCHAR2 (in ptytty.c) should have a bit wide.  Yes, I posted a patch
from ports system, but that tightly depends on the system, so it
cannot be flexible.

Then I saw a check routine of pty ranges in screen that is just my
expectation.  It is able to take pty ranges automatically while
running configure.

The following is the diff from cvs on today.

======================================================================
--- autoconf/acconfig.h.orig    Mon Aug 12 12:57:14 2002
+++ autoconf/acconfig.h Mon Aug 12 13:05:56 2002
@@ -193,3 +193,7 @@
 #undef PTYS_ARE_GETPT
 #undef PTYS_ARE_CLONE
 #undef PTYS_ARE_SEARCHED
+
+/* Define possible pty ranges */
+#undef PTYCHAR1
+#undef PTYCHAR2
--- autoconf/configure.in.orig  Mon Aug 12 12:57:06 2002
+++ autoconf/configure.in       Mon Aug 12 13:11:53 2002
@@ -995,6 +995,17 @@
   AC_SUBST(PTYS_ARE_SEARCHED)
 fi
 
+AC_CHECKING(for pty ranges)
+ptys=`echo /dev/pty??`
+pch1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d 
+'\012'`
+pch2=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
+if test x$pch1 != x; then
+  AC_DEFINE_UNQUOTED(PTYCHAR1, "$pch1")
+fi
+if test x$pch2 != x; then
+  AC_DEFINE_UNQUOTED(PTYCHAR2, "$pch2")
+fi
+
 dnl# FreeBSD needs to link libxpg4
 AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"])
 
--- src/ptytty.c.orig   Mon Aug 12 12:57:25 2002
+++ src/ptytty.c        Mon Aug 12 12:58:26 2002
@@ -164,8 +164,12 @@
        char            pty_name[] = "/dev/pty??";
        char            tty_name[] = "/dev/tty??";
 
-# define PTYCHAR1      "pqrstuvwxyz"
-# define PTYCHAR2      "0123456789abcdef"
+# ifndef PTYCHAR1
+#  define PTYCHAR1     "pqrstuvwxyz"
+# endif
+# ifndef PTYCHAR2
+#  define PTYCHAR2     "0123456789abcdef"
+# endif
        for (c1 = PTYCHAR1; *c1; c1++) {
            pty_name[(sizeof(pty_name) - 3)] =
                tty_name[(sizeof(pty_name) - 3)] = *c1;
======================================================================

Regards,
-----
Kazutoshi Kubota <[EMAIL PROTECTED]>

Reply via email to