use openpty(); ex_script.c part from millert@

This commit is contained in:
naddy 2012-12-03 21:26:50 +00:00
parent 1c78f0bc94
commit e6a3ce8572
4 changed files with 95 additions and 21 deletions

View File

@ -1,12 +1,10 @@
# $OpenBSD: Makefile,v 1.32 2012/07/14 10:19:14 naddy Exp $
# NetBSD: Makefile,v 1.6 2000/01/19 12:28:44 hubertf Exp
# FreeBSD Id: Makefile,v 1.11 1999/04/17 10:51:03 itojun Exp
# $OpenBSD: Makefile,v 1.33 2012/12/03 21:26:50 naddy Exp $
COMMENT= multilingual clone of vi/ex
DISTNAME= nvi-1.79
PKGNAME= nvi-m17n-1.79.19991117
REVISION= 4
REVISION= 5
CATEGORIES= editors
MASTER_SITES= ftp://ftp.foretune.co.jp/pub/tools/nvi/
@ -27,7 +25,8 @@ FLAVOR?=
PATCH_DIST_STRIP=-p1
WRKSRC= ${WRKDIR}/${DISTNAME}/build
CONFIGURE_STYLE=gnu dest
AUTOCONF_VERSION=2.13
CONFIGURE_STYLE=autoconf dest
CONFIGURE_ENV= OPTFLAG='-D_PATH_SYSEXRC=\"${SYSCONFDIR}/vi.exrc\"'
CONFIGURE_ARGS+=--enable-multibyte --program-prefix=n --host=${ARCH}-unknown-netbsd
USE_GROFF = Yes
@ -63,6 +62,7 @@ ENCODING+= euc-jp euc-cn euc-kr sjis big5 euc-tw hz
# nvi provides an outdated version of queue.h, stupid stunt...
post-extract:
@rm -f ${WRKDIST}/include/sys/queue.h
@chmod u+w ${WRKSRC}/configure
post-build:
.for encoding in ${ENCODING}

View File

@ -1,16 +0,0 @@
$OpenBSD: patch-build_configure,v 1.1 2007/10/26 20:49:32 ajacoutot Exp $
--- build/configure.orig Fri Oct 26 22:46:41 2007
+++ build/configure Fri Oct 26 22:46:42 2007
@@ -1807,10 +1807,8 @@ if test "$vi_cv_canna" = "yes"; then
case "$host_os" in
bsdi2.1)
vi_cannapath="/usr/contrib/canna";;
- freebsd2.2*|freebsd3*)
- vi_cannapath="/usr/local";;
- freebsd2*)
- vi_cannapath="/usr/local/canna";;
+ freebsd*|netbsd*|openbsd*)
+ vi_cannapath="${prefix}";;
*)
vi_cannapath="/usr/local/canna";;
esac

View File

@ -0,0 +1,42 @@
$OpenBSD: patch-build_configure_in,v 1.1 2012/12/03 21:26:50 naddy Exp $
--- build/configure.in.orig Mon Dec 3 22:18:08 2012
+++ build/configure.in Mon Dec 3 22:20:33 2012
@@ -229,10 +229,8 @@ dnl for freebsd2.*, order DOES matter. don't bother.
case "$host_os" in
bsdi2.1)
vi_cannapath="/usr/contrib/canna";;
- freebsd2.2*|freebsd3*)
- vi_cannapath="/usr/local";;
- freebsd2*)
- vi_cannapath="/usr/local/canna";;
+ freebsd*|netbsd*|openbsd*)
+ vi_cannapath="${prefix}";;
*)
vi_cannapath="/usr/local/canna";;
esac
@@ -616,14 +614,17 @@ fi
AC_MSG_RESULT($vi_cv_gettimeofday)
dnl Check for which version of openpty to use, System V or Berkeley.
-AC_MSG_CHECKING(for System V pty calls)
-AC_CACHE_VAL(vi_cv_sys5_pty, [dnl
-AC_TRY_LINK(, [grantpt(0);],
- [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])])
-if test "$vi_cv_sys5_pty" = yes; then
- AC_DEFINE(HAVE_SYS5_PTY)
-fi
-AC_MSG_RESULT($vi_cv_sys5_pty)
+AC_CHECK_FUNCS(openpty,,
+ [AC_CHECK_LIB(util,openpty,
+ [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"],
+ [AC_MSG_CHECKING(for System V pty calls)
+ AC_CACHE_VAL(vi_cv_sys5_pty, [dnl
+ AC_TRY_LINK(, [grantpt(0);],
+ [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])])
+ if test "$vi_cv_sys5_pty" = yes; then
+ AC_DEFINE(HAVE_SYS5_PTY)
+ fi
+ AC_MSG_RESULT($vi_cv_sys5_pty)])])
dnl Check for the revoke system call.
AC_MSG_CHECKING(for revoke system call)

View File

@ -0,0 +1,48 @@
$OpenBSD: patch-ex_ex_script_c,v 1.1 2012/12/03 21:26:50 naddy Exp $
--- ex/ex_script.c.orig Mon Dec 3 22:07:06 2012
+++ ex/ex_script.c Mon Dec 3 22:08:43 2012
@@ -26,6 +26,9 @@ static const char sccsid[] = "@(#)ex_script.c 10.30 (B
#ifdef HAVE_SYS5_PTY
#include <sys/stropts.h>
#endif
+#ifdef HAVE_OPENPTY
+#include <util.h>
+#endif
#include <sys/time.h>
#include <sys/wait.h>
@@ -690,7 +693,18 @@ sscr_check(sp)
F_CLR(gp, G_SCRWIN);
}
-#ifdef HAVE_SYS5_PTY
+#if defined(HAVE_OPENPTY)
+static int
+sscr_pty(amaster, aslave, name, termp, winp)
+ int *amaster, *aslave;
+ char *name;
+ struct termios *termp;
+ void *winp;
+{
+ return (openpty(amaster, aslave, name, termp, winp));
+}
+
+#elif defined(HAVE_SYS5_PTY)
static int ptys_open __P((int, char *));
static int ptym_open __P((char *));
@@ -804,7 +818,7 @@ ptys_open(fdm, pts_name)
return (fds);
}
-#else /* !HAVE_SYS5_PTY */
+#else /* !HAVE_SYS5_PTY && !HAVE_OPENPTY */
static int
sscr_pty(amaster, aslave, name, termp, winp)
@@ -860,4 +874,4 @@ sscr_pty(amaster, aslave, name, termp, winp)
errno = ENOENT; /* out of ptys */
return (-1);
}
-#endif /* HAVE_SYS5_PTY */
+#endif /* !HAVE_SYS5_PTY && !HAVE_OPENPTY */