Fix build under 9.0 (with new utmpx).

This commit is contained in:
Cy Schubert 2011-09-25 05:48:13 +00:00
parent 877f0e69fb
commit ed5b7be17f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=282352
2 changed files with 94 additions and 11 deletions

View file

@ -44,10 +44,6 @@ X11BASE2FIX= clients/olwmslave/help_file.c lib/libxview/help/help_file.c \
CFLAGS+= -DCOMPAT_43TTY
.endif
.if ${OSVERSION} > 900007
BROKEN= fails to build with new utmpx
.endif
pre-configure:
@${REINPLACE_CMD} -e 's+/usr/local+${PREFIX}+;' \
${WRKSRC}/config/XView.cf

View file

@ -1,5 +1,5 @@
--- lib/libxview/ttysw/tty_init.c.orig Tue Jun 29 00:17:19 1993
+++ lib/libxview/ttysw/tty_init.c Fri Oct 17 09:40:42 2003
--- lib/libxview/ttysw/tty_init.c.orig 1993-06-28 22:17:19.000000000 -0700
+++ lib/libxview/ttysw/tty_init.c 2011-09-24 22:14:48.726921496 -0700
@@ -14,6 +14,7 @@
* Ttysw initialization, destruction and error procedures
*/
@ -8,7 +8,25 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -82,7 +83,11 @@
@@ -23,10 +24,17 @@
#include <xview_private/portable.h> /* for XV* defines and termios */
+#if defined(__FreeBSD_version) && __FreeBSD_version > 900007
+#define SVR4
+#define XV_USE_SVR4_PTYS
+#endif
+
#ifdef XV_USE_SVR4_PTYS
+#if !(defined(__FreeBSD_version) && __FreeBSD_version > 900007)
#include <sys/stream.h>
#include <sys/stropts.h>
#include <sys/bufmod.h>
+#endif
#endif /* XV_USE_SVR4_PTYS */
#ifndef SVR4
@@ -82,7 +90,11 @@
extern char *strncpy();
extern char *strcpy();
@ -20,7 +38,7 @@
char *textsw_checkpoint_undo();
/* static */ void ttysw_parseargs();
@@ -106,6 +111,7 @@
@@ -106,6 +118,7 @@
extern int ttysel_use_seln_service;
@ -28,7 +46,7 @@
struct ttysw_createoptions {
int becomeconsole; /* be the console */
@@ -518,6 +524,9 @@
@@ -518,6 +531,9 @@
(void) dup2(ttysw->ttysw_tty, 2);
(void) close(ttysw->ttysw_tty);
@ -38,7 +56,76 @@
if (*argv == (char *) NULL || strcmp("-c", *argv) == 0) {
/* Process arg list */
int argc;
@@ -955,7 +964,11 @@
@@ -544,15 +560,25 @@
* ttcompat seems to leave things in a funny state and assumes
* (seemingly) that login will fix things up. Do it here.
*/
+#if defined(__FreeBSD_version) && __FreeBSD_version > 900007
+ if (tcgetattr (0, &tp) == -1)
+ perror("tcgetattr");
+#else
if (ioctl (0, TCGETS, &tp) == -1)
perror("ioctl TCGETS");
+#endif
else {
tp.c_lflag |= ECHO;
tp.c_oflag |= ONLCR;
tp.c_iflag |= ICRNL;
}
+#if defined(__FreeBSD_version) && __FreeBSD_version > 900007
+ if (tcsetattr (0, TCSANOW, &tp) == -1)
+ perror("tcsetattr");
+#else
if (ioctl (0, TCSETS, &tp) == -1)
perror("ioctl TCSETS");
+#endif
#endif /* BSD_TTY_COMPAT */
#endif /* SVR4 */
@@ -739,7 +765,9 @@
#ifdef SB_NO_DROPS /* defined as result of including new bufmod.h */
+#if !defined(__FreeBSD_version)
if(ioctl(pty, I_PUSH, "bufmod") == -1) { /* some buffering ... */
+#endif
/* we can't push bufmod... this means we're probably
running on a generic SVR4 system - we can ignore this
@@ -864,13 +892,16 @@
#endif SB_NO_DROPS
+#ifndef __FreeBSD_version
if (ioctl(pty, I_PUSH, "pckt") == -1) { /* must use getmsg for read */
perror("push pckt");
return XV_ERROR;
}
+#endif
if ((tty = open(ptsname(pty),O_RDWR))<0)
return XV_ERROR;
+#ifndef __FreeBSD_version
if (ioctl(tty, I_PUSH, "ptem") == -1) {
perror("push ptem");
return XV_ERROR;
@@ -879,12 +910,15 @@
perror("push ldterm");
return XV_ERROR;
}
+#endif
#ifdef BSD_TTY_COMPAT
+#ifndef __FreeBSD_version
if (ioctl(tty, I_PUSH, "ttcompat") == -1) { /* for csh */
perror("push ttcompat");
return XV_ERROR;
}
#endif
+#endif
#endif /* SVR4 */
@@ -955,7 +989,11 @@
struct utmpx utmp;
#endif
struct passwd *passwdent;
@ -50,7 +137,7 @@
int f;
char *ttyn;
extern char *ttyname();
@@ -1007,13 +1020,22 @@
@@ -1007,13 +1045,22 @@
XV_MSG("Add tty[qrs][0-f] to /etc/ttys file.\n"));
return (0);
}