OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Christoph Schug
Root: /v/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-src Date: 13-Jul-2006 19:09:25
Branch: HEAD Handle: 2006071318092400
Modified files:
openpkg-src/screen screen.patch screen.spec
Log:
fix NetBSD build by adding patches from pkgsrc
Summary:
Revision Changes Path
1.6 +515 -90 openpkg-src/screen/screen.patch
1.48 +8 -1 openpkg-src/screen/screen.spec
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-src/screen/screen.patch
============================================================================
$ cvs diff -u -r1.5 -r1.6 screen.patch
--- openpkg-src/screen/screen.patch 10 Feb 2006 22:00:37 -0000 1.5
+++ openpkg-src/screen/screen.patch 13 Jul 2006 17:09:24 -0000 1.6
@@ -1,9 +1,10 @@
-Security Bugfix
-http://www.securityfocus.com/archive/1/345844/2003-11-24/2003-11-30/0
-
++---------------------------------------------------------------------------
+| Security Bugfix
+| http://www.securityfocus.com/archive/1/345844/2003-11-24/2003-11-30/0
++---------------------------------------------------------------------------
Index: ansi.c
---- ansi.c.orig 2003-09-08 16:24:44.000000000 +0200
-+++ ansi.c 2003-11-27 20:08:53.000000000 +0100
+--- ansi.c.orig 2003-12-05 14:57:05 +0100
++++ ansi.c 2006-07-13 17:08:06 +0200
@@ -559,7 +559,7 @@
{
case '0': case '1': case '2': case '3': case '4':
@@ -14,8 +15,8 @@
if (curr->w_args[curr->w_NumArgs] < 100000000)
curr->w_args[curr->w_NumArgs] =
Index: resize.c
---- resize.c.orig 2003-09-08 16:26:31.000000000 +0200
-+++ resize.c 2003-11-27 20:09:49.000000000 +0100
+--- resize.c.orig 2003-09-08 16:26:31 +0200
++++ resize.c 2006-07-13 17:08:06 +0200
@@ -682,6 +682,17 @@
if (wi == 0)
he = hi = 0;
@@ -34,38 +35,98 @@
if (p->w_width == wi && p->w_height == he && p->w_histheight == hi)
{
debug("ChangeWindowSize: No change.\n");
-Index: configure.in
---- configure.in.orig 2003-06-03 13:58:24.000000000 +0200
-+++ configure.in 2004-05-27 12:43:38.909016000 +0200
-@@ -206,7 +206,7 @@
-
- AC_CHECKING(for Solaris 2.x)
- AC_EGREP_CPP(yes,
--[#if defined(SVR4) && defined(sun)
-+[#if defined(__SVR4) && defined(__sun)
+
++---------------------------------------------------------------------------
+| In Solaris 10, the setenv() function has been added.
++---------------------------------------------------------------------------
+Index: misc.c
+--- misc.c.orig 2003-12-05 14:45:41 +0100
++++ misc.c 2006-07-13 18:00:46 +0200
+@@ -613,7 +613,7 @@
+ */
+ # endif /* NEEDSETENV */
+ #else /* USESETENV */
+-# if defined(linux) || defined(__convex__) || (BSD >= 199103)
++# if defined(linux) || defined(__convex__) || (BSD >= 199103) ||
defined(__sun)
+ setenv(var, value, 1);
+ # else
+ setenv(var, value);
+
++---------------------------------------------------------------------------
+| Mainly NetBSD specific patches taken from pkgsrc, partly relevant to
+| FreeBSD and Solaris as well
++---------------------------------------------------------------------------
+Index: config.h.in
+--- config.h.in.orig 2003-12-05 14:59:39 +0100
++++ config.h.in 2006-07-13 17:42:35 +0200
+@@ -431,6 +431,11 @@
+ #undef HAVE_DIRENT_H
+
+ /*
++ * Define HAVE_SYS_STROPTS_H if your system has <sys/stropts.h>
++ */
++#undef HAVE_SYS_STROPTS_H
++
++/*
+ * If your system has getutent(), pututline(), etc. to write to the
+ * utmp file, define GETUTENT.
+ */
+@@ -514,6 +519,15 @@
+ */
+ #undef USEVARARGS
+
++#ifdef __NetBSD__
++/*
++ * XXX gcc 3.3 on some NetBSD platforms fails the configure test for this
++ * so force it on anyway.
++ */
++#undef USEVARARGS
++#define USEVARARGS 1
++#endif
++
+ /*
+ * If your system has strerror() define this.
+ */
+Index: configure
+--- configure.orig 2003-12-05 14:46:53 +0100
++++ configure 2006-07-13 17:54:05 +0200
+@@ -3911,7 +3911,7 @@
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* end confdefs.h. */
+-#if defined(SVR4) && defined(sun)
++#if defined(__SVR4) && defined(__sun)
yes
#endif
- ], LIBS="$LIBS -lsocket -lnsl -lkstat")
-@@ -270,7 +270,7 @@
- dnl multiuser screen sessions
- AC_CHECKING(seteuid)
- AC_TRY_LINK(,[
+
+@@ -4042,7 +4042,7 @@
+ main ()
+ {
+
-#if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX)
|| defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) ||
defined(sony_news)
+#if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX)
|| defined(ultrix) || (defined(__sun) && defined(__SVR4)) || defined(ISC) ||
defined(sony_news)
seteuid_is_broken(0);
#else
seteuid(0);
-@@ -815,7 +815,7 @@
- AC_TRY_LINK([
+@@ -5572,9 +5572,15 @@
+
#include <time.h> /* to get time_t on SCO */
#include <sys/types.h>
-#if defined(SVR4) && !defined(DGUX)
-+#if defined(__SVR4) && !defined(DGUX)
++#include <sys/param.h>
++#if defined(__SVR4) && !defined(DGUX) \
++ || (defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106050000))
#include <utmpx.h>
#define utmp utmpx
++# ifdef __NetBSD__
++# define pututline pututxline
++# define getutent getutxent
++# endif
#else
-@@ -832,7 +832,7 @@
- AC_TRY_LINK([
+ #include <utmp.h>
+ #endif
+@@ -5624,7 +5630,7 @@
+
#include <time.h>
#include <sys/types.h>
-#if defined(SVR4) && !defined(DGUX)
@@ -73,8 +134,8 @@
#include <utmpx.h>
#define utmp utmpx
#else
-@@ -848,7 +848,7 @@
- AC_TRY_COMPILE([
+@@ -5680,7 +5686,7 @@
+
#include <time.h>
#include <sys/types.h>
-#if defined(SVR4) && !defined(DGUX)
@@ -82,16 +143,16 @@
#include <utmpx.h>
#define utmp utmpx
#else
-@@ -979,7 +979,7 @@
- #include <sys/types.h>
- #include <sys/param.h>
- ],[
+@@ -6316,7 +6322,7 @@
+
+ _CUT_HERE_
+
-#if !defined(LOADAV_GETLOADAVG) && ((defined(hp300) && !defined(__hpux)) ||
defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) ||
defined(sgi) || (defined(SVR4) && !defined(__hpux)) || defined(sony_news) ||
(!defined(__osf__) && defined(__alpha)) || defined(_IBMR2) ||
defined(_AUX_SOURCE) || defined(AUX) || defined(m88k))
+#if !defined(LOADAV_GETLOADAVG) && ((defined(hp300) && !defined(__hpux)) ||
defined(__sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) ||
defined(sgi) || (defined(__SVR4) && !defined(__hpux)) || defined(sony_news) ||
(!defined(__osf__) && defined(__alpha)) || defined(_IBMR2) ||
defined(_AUX_SOURCE) || defined(AUX) || defined(m88k))
loadtype=long
# if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) ||
defined(AUX)
loadscale=65536
-@@ -992,7 +992,7 @@
+@@ -6329,7 +6335,7 @@
loadtype=int
loadscale=1024
# else
@@ -100,38 +161,194 @@
loadscale=256
# else /* not MIPS */
loadscale=1000 /* our default value */
-Index: configure
---- configure.orig 2003-12-05 14:46:53.000000000 +0100
-+++ configure 2004-05-27 12:45:06.186001000 +0200
-@@ -3911,7 +3911,7 @@
- cat confdefs.h >>conftest.$ac_ext
- cat >>conftest.$ac_ext <<_ACEOF
- /* end confdefs.h. */
--#if defined(SVR4) && defined(sun)
-+#if defined(__SVR4) && defined(__sun)
- yes
- #endif
+@@ -7501,6 +7507,147 @@
-@@ -4042,7 +4042,7 @@
- main ()
- {
+ fi
++for ac_header in sys/stropts.h
++do
++as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
++if eval "test \"\${$as_ac_Header+set}\" = set"; then
++ echo "$as_me:$LINENO: checking for $ac_header" >&5
++echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
++if eval "test \"\${$as_ac_Header+set}\" = set"; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++fi
++echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
++echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
++else
++ # Is the header compilable?
++echo "$as_me:$LINENO: checking $ac_header usability" >&5
++echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
++cat >conftest.$ac_ext <<_ACEOF
++#line $LINENO "configure"
++/* confdefs.h. */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h. */
++$ac_includes_default
++#include <$ac_header>
++_ACEOF
++rm -f conftest.$ac_objext
++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++ (eval $ac_compile) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } &&
++ { ac_try='test -s conftest.$ac_objext'
++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
++ (eval $ac_try) 2>&5
++ ac_status=$?
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); }; }; then
++ ac_header_compiler=yes
++else
++ echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ac_header_compiler=no
++fi
++rm -f conftest.$ac_objext conftest.$ac_ext
++echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
++echo "${ECHO_T}$ac_header_compiler" >&6
++
++# Is the header present?
++echo "$as_me:$LINENO: checking $ac_header presence" >&5
++echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
++cat >conftest.$ac_ext <<_ACEOF
++#line $LINENO "configure"
++/* confdefs.h. */
++_ACEOF
++cat confdefs.h >>conftest.$ac_ext
++cat >>conftest.$ac_ext <<_ACEOF
++/* end confdefs.h. */
++#include <$ac_header>
++_ACEOF
++if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
++ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
++ ac_status=$?
++ grep -v '^ *+' conftest.er1 >conftest.err
++ rm -f conftest.er1
++ cat conftest.err >&5
++ echo "$as_me:$LINENO: \$? = $ac_status" >&5
++ (exit $ac_status); } >/dev/null; then
++ if test -s conftest.err; then
++ ac_cpp_err=$ac_c_preproc_warn_flag
++ else
++ ac_cpp_err=
++ fi
++else
++ ac_cpp_err=yes
++fi
++if test -z "$ac_cpp_err"; then
++ ac_header_preproc=yes
++else
++ echo "$as_me: failed program was:" >&5
++sed 's/^/| /' conftest.$ac_ext >&5
++
++ ac_header_preproc=no
++fi
++rm -f conftest.err conftest.$ac_ext
++echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
++echo "${ECHO_T}$ac_header_preproc" >&6
++
++# So? What about this header?
++case $ac_header_compiler:$ac_header_preproc in
++ yes:no )
++ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler,
rejected by the preprocessor!" >&5
++echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by
the preprocessor!" >&2;}
++ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the
preprocessor's result" >&5
++echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's
result" >&2;}
++ (
++ cat <<\_ASBOX
++## ------------------------------------ ##
++## Report this to [EMAIL PROTECTED] ##
++## ------------------------------------ ##
++_ASBOX
++ ) |
++ sed "s/^/$as_me: WARNING: /" >&2
++ ;;
++ no:yes )
++ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be
compiled" >&5
++echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
++ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing
prerequisite headers?" >&5
++echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?"
>&2;}
++ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the
preprocessor's result" >&5
++echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's
result" >&2;}
++ (
++ cat <<\_ASBOX
++## ------------------------------------ ##
++## Report this to [EMAIL PROTECTED] ##
++## ------------------------------------ ##
++_ASBOX
++ ) |
++ sed "s/^/$as_me: WARNING: /" >&2
++ ;;
++esac
++echo "$as_me:$LINENO: checking for $ac_header" >&5
++echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
++if eval "test \"\${$as_ac_Header+set}\" = set"; then
++ echo $ECHO_N "(cached) $ECHO_C" >&6
++else
++ eval "$as_ac_Header=$ac_header_preproc"
++fi
++echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
++echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
++
++fi
++if test `eval echo '${'$as_ac_Header'}'` = yes; then
++ cat >>confdefs.h <<_ACEOF
++#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
++_ACEOF
++
++fi
++
++done
++
+
+ echo "$as_me:$LINENO: checking for setenv" >&5
+ echo $ECHO_N "checking for setenv... $ECHO_C" >&6
+Index: configure.in
+--- configure.in.orig 2003-06-03 13:58:24 +0200
++++ configure.in 2006-07-13 17:50:35 +0200
+@@ -206,7 +206,7 @@
+
+ AC_CHECKING(for Solaris 2.x)
+ AC_EGREP_CPP(yes,
+-[#if defined(SVR4) && defined(sun)
++[#if defined(__SVR4) && defined(__sun)
+ yes
+ #endif
+ ], LIBS="$LIBS -lsocket -lnsl -lkstat")
+@@ -270,7 +270,7 @@
+ dnl multiuser screen sessions
+ AC_CHECKING(seteuid)
+ AC_TRY_LINK(,[
-#if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX)
|| defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) ||
defined(sony_news)
+#if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX)
|| defined(ultrix) || (defined(__sun) && defined(__SVR4)) || defined(ISC) ||
defined(sony_news)
seteuid_is_broken(0);
#else
seteuid(0);
-@@ -5572,7 +5572,7 @@
-
+@@ -815,9 +815,15 @@
+ AC_TRY_LINK([
#include <time.h> /* to get time_t on SCO */
#include <sys/types.h>
-#if defined(SVR4) && !defined(DGUX)
-+#if defined(__SVR4) && !defined(DGUX)
++#include <sys/param.h>
++#if defined(__SVR4) && !defined(DGUX) \
++ || (defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106050000))
#include <utmpx.h>
#define utmp utmpx
++# ifdef __NetBSD__
++# define pututline pututxline
++# define getutent getutxent
++# endif
#else
-@@ -5624,7 +5624,7 @@
-
+ #include <utmp.h>
+ #endif
+@@ -832,7 +838,7 @@
+ AC_TRY_LINK([
#include <time.h>
#include <sys/types.h>
-#if defined(SVR4) && !defined(DGUX)
@@ -139,8 +356,8 @@
#include <utmpx.h>
#define utmp utmpx
#else
-@@ -5680,7 +5680,7 @@
-
+@@ -848,7 +854,7 @@
+ AC_TRY_COMPILE([
#include <time.h>
#include <sys/types.h>
-#if defined(SVR4) && !defined(DGUX)
@@ -148,16 +365,16 @@
#include <utmpx.h>
#define utmp utmpx
#else
-@@ -6316,7 +6316,7 @@
-
- _CUT_HERE_
-
+@@ -979,7 +985,7 @@
+ #include <sys/types.h>
+ #include <sys/param.h>
+ ],[
-#if !defined(LOADAV_GETLOADAVG) && ((defined(hp300) && !defined(__hpux)) ||
defined(sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) ||
defined(sgi) || (defined(SVR4) && !defined(__hpux)) || defined(sony_news) ||
(!defined(__osf__) && defined(__alpha)) || defined(_IBMR2) ||
defined(_AUX_SOURCE) || defined(AUX) || defined(m88k))
+#if !defined(LOADAV_GETLOADAVG) && ((defined(hp300) && !defined(__hpux)) ||
defined(__sun) || (defined(ultrix) && defined(mips)) || defined(_SEQUENT_) ||
defined(sgi) || (defined(__SVR4) && !defined(__hpux)) || defined(sony_news) ||
(!defined(__osf__) && defined(__alpha)) || defined(_IBMR2) ||
defined(_AUX_SOURCE) || defined(AUX) || defined(m88k))
loadtype=long
# if defined(apollo) || defined(_IBMR2) || defined(_AUX_SOURCE) ||
defined(AUX)
loadscale=65536
-@@ -6329,7 +6329,7 @@
+@@ -992,7 +998,7 @@
loadtype=int
loadscale=1024
# else
@@ -166,21 +383,17 @@
loadscale=256
# else /* not MIPS */
loadscale=1000 /* our default value */
-Index: misc.c
---- misc.c.orig 2004-05-27 13:32:29.762001000 +0200
-+++ misc.c 2004-05-27 13:39:40.883005000 +0200
-@@ -613,7 +613,7 @@
- */
- # endif /* NEEDSETENV */
- #else /* USESETENV */
--# if defined(linux) || defined(__convex__) || (BSD >= 199103)
-+# if defined(linux) || defined(__sun) || defined(__convex__) || (BSD >=
199103)
- setenv(var, value, 1);
- # else
- setenv(var, value);
+@@ -1209,6 +1215,7 @@
+ AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS),
AC_MSG_RESULT(no))
+
+ AC_HEADER_DIRENT
++AC_CHECK_HEADERS(sys/stropts.h)
+
+ AC_MSG_CHECKING(for setenv)
+ AC_TRY_LINK(,[setenv((char *)0,(char *)0);unsetenv((char *)0);],
AC_MSG_RESULT(yes);AC_DEFINE(USESETENV),
Index: os.h
--- os.h.orig 2002-01-08 16:42:33 +0100
-+++ os.h 2005-11-08 11:01:37 +0100
++++ os.h 2006-07-13 17:37:58 +0200
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <errno.h>
@@ -198,10 +411,238 @@
# define USE_SETEUID
#endif
+@@ -260,9 +261,15 @@
+ #endif
+
+ #if defined(UTMPOK) || defined(BUGGYGETLOGIN)
+-# if defined(SVR4) && !defined(DGUX) && !defined(__hpux) && !defined(linux)
++# if defined(SVR4) && !defined(DGUX) && !defined(__hpux) && !defined(linux)
\
++ || (defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106050000))
+ # include <utmpx.h>
+-# define UTMPFILE UTMPX_FILE
++# ifdef __NetBSD__
++# define UTMPFILE _PATH_UTMPX
++# define NetBSD_UTMP
++# else
++# define UTMPFILE UTMPX_FILE
++# endif
+ # define utmp utmpx
+ # define getutent getutxent
+ # define getutid getutxid
+Index: process.c
+--- process.c.orig 2003-09-18 14:53:54 +0200
++++ process.c 2006-07-13 17:43:26 +0200
+@@ -5466,7 +5466,7 @@
+ *buf = 0;
+ return;
+ }
+- act.nr = (int)data;
++ act.nr = (int)(long)data;
+ act.args = noargs;
+ act.argl = 0;
+ DoAction(&act, -1);
+Index: pty.c
+--- pty.c.orig 2003-09-08 16:26:18 +0200
++++ pty.c 2006-07-13 17:41:29 +0200
+@@ -33,10 +33,12 @@
+ # include <sys/ioctl.h>
+ #endif
+
++#ifndef __FreeBSD__
+ /* for solaris 2.1, Unixware (SVR4.2) and possibly others */
+-#ifdef HAVE_SVR4_PTYS
++#ifdef HAVE_SYS_STROPTS_H
+ # include <sys/stropts.h>
+ #endif
++#endif
+
+ #if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL)
+ # include <sys/ttold.h>
+@@ -332,6 +334,46 @@
+
+ /***************************************************************/
+
++#if defined(__NetBSD__) && !defined(PTY_DONE)
++#define PTY_DONE
++
++#include <sys/param.h>
++#include <string.h>
++
++int
++OpenPTY(ttyn)
++char **ttyn;
++{
++ int m, s, f;
++ char *t;
++
++ do
++ {
++ if (openpty(&m, &s, TtyName, NULL, NULL) < 0)
++ return -1;
++ close(m);
++ close(s);
++
++ strcpy(PtyName, TtyName);
++ t = strrchr(PtyName, '/');
++ if ((t == NULL ) || (*++t != 't'))
++ return -1;
++ *t = 'p';
++
++ f = open(PtyName, O_RDWR | O_NOCTTY);
++ }
++ while (f < 0);
++
++ initmaster(f);
++ *ttyn = TtyName;
++
++ return f;
++}
++#endif
++
++/***************************************************************/
++
++
+ #ifndef PTY_DONE
+ int
+ OpenPTY(ttyn)
+Index: utmp-netbsd.c
+--- utmp-netbsd.c.orig 1970-01-01 01:00:00 +0100
++++ utmp-netbsd.c 2006-07-13 17:57:44 +0200
+@@ -0,0 +1,80 @@
++#include <sys/param.h>
++#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106050000)
++
++#include <sys/types.h>
++#include <sys/time.h>
++#include <sys/wait.h>
++
++#include <errno.h>
++#include <fcntl.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <time.h>
++#include <ttyent.h>
++#include <unistd.h>
++#include <util.h>
++#include <utmp.h>
++
++static struct utmp saved_utmp;
++static int saved_utmp_ok = 0;
++
++int
++lineslot(line)
++char *line;
++{
++ int slot;
++ struct ttyent *ttyp;
++
++ setttyent();
++ for (slot = 1; (ttyp = getttyent()) != NULL; ++slot)
++ if (!strcmp(ttyp->ty_name, line)) {
++ endttyent();
++ return(slot);
++ }
++ endttyent();
++ return(0);
++}
++
++void
++utmp_login(line)
++char *line;
++{
++ int fd;
++ int tty;
++
++ if (!saved_utmp_ok)
++ return;
++
++ tty = lineslot(line);
++ if (tty > 0 && (fd = open(_PATH_UTMP, O_WRONLY|O_CREAT, 0644)) >= 0) {
++ (void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET);
++ (void)write(fd, &saved_utmp, sizeof(struct utmp));
++ (void)close(fd);
++ }
++}
++
++void
++utmp_logout(const char *line)
++{
++ int fd;
++ struct utmp ut;
++
++ if ((fd = open(_PATH_UTMP, O_RDWR, 0)) < 0)
++ return;
++ while (read(fd, &ut, sizeof(ut)) == sizeof(ut)) {
++ if (!ut.ut_name[0] || strncmp(ut.ut_line, line, UT_LINESIZE))
++ continue;
++ memcpy(&saved_utmp, &ut, sizeof(ut));
++ saved_utmp_ok = 1;
++ memset(ut.ut_name, 0, UT_NAMESIZE);
++ memset(ut.ut_host, 0, UT_HOSTSIZE);
++ (void)time(&ut.ut_time);
++ (void)lseek(fd, -(off_t)sizeof(ut), SEEK_CUR);
++ (void)write(fd, &ut, sizeof(ut));
++ }
++ (void)close(fd);
++}
++
++#endif
++
Index: utmp.c
--- utmp.c.orig 2003-09-08 16:27:17 +0200
-+++ utmp.c 2006-01-11 16:53:48 +0100
-@@ -726,9 +726,12 @@
++++ utmp.c 2006-07-13 17:11:46 +0200
+@@ -42,6 +42,11 @@
+ extern char *LoginName;
+ extern int real_uid, eff_uid;
+
++#ifdef NetBSD_UTMP
++extern void utmp_login __P((char *));
++extern void utmp_logout __P((char *));
++#endif
++
+
+ /*
+ * UTNOKEEP: A (ugly) hack for apollo that does two things:
+@@ -310,6 +315,9 @@
+
+ ASSERT(display);
+ debug("RemoveLoginSlot: removing your logintty\n");
++#ifdef NetBSD_UTMP
++ utmp_logout(stripdev(D_usertty));
++#endif
+ D_loginslot = TtyNameSlot(D_usertty);
+ if (D_loginslot == (slot_t)0 || D_loginslot == (slot_t)-1)
+ return;
+@@ -374,6 +382,9 @@
+
+ debug("RestoreLoginSlot()\n");
+ ASSERT(display);
++#ifdef NetBSD_UTMP
++ utmp_login(stripdev(D_usertty));
++#endif
+ if (utmpok && D_loginslot != (slot_t)0 && D_loginslot != (slot_t)-1)
+ {
+ debug1(" logging you in again (slot %#x)\n", (int)D_loginslot);
+@@ -604,6 +615,7 @@
+ char *line, *user;
+ int pid;
+ {
++ time_t temp;
+ u->ut_type = USER_PROCESS;
+ strncpy(u->ut_user, user, sizeof(u->ut_user));
+ /* Now the tricky part... guess ut_id */
+@@ -618,7 +630,8 @@
+ #endif /* sgi */
+ strncpy(u->ut_line, line, sizeof(u->ut_line));
+ u->ut_pid = pid;
+- (void)time((time_t *)&u->ut_time);
++ (void)time(&temp);
++ u->ut_time = temp;
+ }
+
+ static slot_t
+@@ -726,9 +739,12 @@
char *line, *user;
int pid;
{
@@ -215,19 +656,3 @@
}
static slot_t
-Index: pty.c
---- pty.c.orig Mon Feb 6 18:54:37 2006
-+++ pty.c Mon Feb 6 18:56:50 2006
-@@ -33,10 +33,12 @@
- # include <sys/ioctl.h>
- #endif
-
-+#ifndef __FreeBSD__
- /* for solaris 2.1, Unixware (SVR4.2) and possibly others */
- #ifdef HAVE_SVR4_PTYS
- # include <sys/stropts.h>
- #endif
-+#endif
-
- #if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL)
- # include <sys/ttold.h>
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/screen/screen.spec
============================================================================
$ cvs diff -u -r1.47 -r1.48 screen.spec
--- openpkg-src/screen/screen.spec 10 Feb 2006 22:00:37 -0000 1.47
+++ openpkg-src/screen/screen.spec 13 Jul 2006 17:09:24 -0000 1.48
@@ -33,7 +33,7 @@
Group: Terminal
License: GPL
Version: 4.0.2
-Release: 20060210
+Release: 20060713
# list of sources
Source0:
ftp://ftp.uni-erlangen.de/pub/utilities/screen/screen-%{version}.tar.gz
@@ -67,6 +67,13 @@
%prep
%setup -q
%patch -p0
+ case "%{l_platform -t}" in
+ *-netbsd* )
+ %{l_shtool} subst \
+ -e 's;^\(.* nethack.[co] encoding.\([co]\).*\)$;\1
utmp-netbsd.\2;'\
+ Makefile.in
+ ;;
+ esac
%build
# configure package
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [email protected]