use posix_openpt() and UNIX98 ptys

This commit is contained in:
naddy 2012-12-08 20:46:05 +00:00
parent 904c17e112
commit 592e83e766
4 changed files with 58 additions and 2 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.20 2012/08/27 13:38:08 sthen Exp $
# $OpenBSD: Makefile,v 1.21 2012/12/08 20:46:05 naddy Exp $
COMMENT= GNU awk
V= 4.0.1
DISTNAME= gawk-$V
REVISION= 0
CATEGORIES= lang
MASTER_SITES= ${MASTER_SITE_GNU:=gawk/}
@ -24,8 +25,11 @@ LIB_DEPENDS= devel/libsigsegv
SUBST_VARS= V
CONFIGURE_STYLE= gnu
SEPARATE_BUILD= Yes
AUTOCONF_VERSION=2.68
CONFIGURE_STYLE=autoconf
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"
REORDER_DEPENDENCIES=${FILESDIR}/automake.dep
.include <bsd.port.mk>

View File

@ -0,0 +1,5 @@
# $OpenBSD: automake.dep,v 1.1 2012/12/08 20:46:05 naddy Exp $
configh.in configure.in
configh.in configure.ac
configh.in aclocal.m4
/Maketests /Makefile.am

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-configure_ac,v 1.1 2012/12/08 20:46:05 naddy Exp $
--- configure.ac.orig Sat Dec 8 16:02:43 2012
+++ configure.ac Sat Dec 8 16:03:03 2012
@@ -265,7 +265,7 @@ esac
AC_CHECK_FUNCS(atexit btowc fmod getgrent getgroups grantpt \
isascii iswctype iswlower iswupper mbrlen \
memcmp memcpy memcpy_ulong memmove memset \
- memset_ulong mkstemp setenv setlocale setsid snprintf strchr \
+ memset_ulong mkstemp posix_openpt setenv setlocale setsid snprintf strchr \
strerror strftime strncasecmp strcoll strtod strtoul \
system tmpfile towlower towupper tzset usleep wcrtomb \
wcscoll wctype)

View File

@ -0,0 +1,35 @@
$OpenBSD: patch-io_c,v 1.1 2012/12/08 20:46:05 naddy Exp $
--- io.c.orig Sat Dec 8 16:04:24 2012
+++ io.c Sat Dec 8 16:05:39 2012
@@ -1598,7 +1598,7 @@ two_way_open(const char *str, struct redirect *rp)
if (! no_ptys && pty_vs_pipe(str)) {
static int initialized = FALSE;
static char first_pty_letter;
-#ifdef HAVE_GRANTPT
+#if defined(HAVE_GRANTPT) && ! defined(HAVE_POSIX_OPENPT)
static int have_dev_ptmx;
#endif
char slavenam[32];
@@ -1615,7 +1615,7 @@ two_way_open(const char *str, struct redirect *rp)
if (! initialized) {
initialized = TRUE;
-#ifdef HAVE_GRANTPT
+#if defined(HAVE_GRANTPT) && ! defined(HAVE_POSIX_OPENPT)
have_dev_ptmx = (stat("/dev/ptmx", &statb) >= 0);
#endif
i = 0;
@@ -1630,8 +1630,13 @@ two_way_open(const char *str, struct redirect *rp)
}
#ifdef HAVE_GRANTPT
+#ifdef HAVE_POSIX_OPENPT
+ {
+ master = posix_openpt(O_RDWR|O_NOCTTY);
+#else
if (have_dev_ptmx) {
master = open("/dev/ptmx", O_RDWR);
+#endif
if (master >= 0) {
char *tem;