[comp.windows.x] X11R3 under Apollo SR10.0

dj@dorsai.cognet.ucla.edu (David J. Wells) (11/16/88)

It has become apparent that the patches that Casey posted are not
sufficient to bring a stable X11R3 up under Apollo's SR10.0.  One of us
will repost when we are satisfied with what we have.  
								David J Wells
							       dj@cs.ucla.edu
								w213/206-3960

casey@admin.cognet.ucla.edu (Casey Leedom) (11/16/88)

| From: dj@dorsai.cognet.ucla.edu (David J. Wells)
| 
| It has become apparent that the patches that Casey posted are not
| sufficient to bring a stable X11R3 up under Apollo's SR10.0.  One of us
| will repost when we are satisfied with what we have.  

  My young and impetuous colleague has no confidence.  I don't show up
till 1:30pm today and he's already posting about my lack of progress ...
:-)

  But he's right, there are a number of other problems yet to work out.
One of the worst is with xterm not properly setting up the tty.  What
happens is that xterm (started simply via ``xterm &'') gives you a good
tty, but doesn't properly detach from the original tty - thus your new
pseudo tty isn't your controlling tty.  This only leads to problem (that
we've discovered so far) when you attempt to access /dev/tty.

	[The stupid OS allows you to open /dev/tty for R/W, but then
	gives you a EBADF (bad file descriptor)!!!  I wouldn't mind if it
	choked on the open with an EACCES, or the I/O with a EIO or even
	a ENXIO, but EBADF when it was the one who gave me that file
	descriptor???  Talk about your brain damaged error returns ...]

  In any case, I've added back in some code from the R2 xterm which seems
to solve the problem.  I've ifdef'ed it on apollo, but it's probably
correct for all BSD systems.  I don't know why no other system has the
same problem.  I'd check further, but there are a bunch of other fires I
have to get to now ...

Casey

P.S.  I also changed the

	#ifdef apollo
	#define ttyslot() 1
	#define vhangup() ;
	#endif /* apollo */

    to ``#if defined(apollo) && !defined(_APOLLO_SR10)'' in main.c.  I
    did this in an earlier attempt to fix the problem and haven't
    bothered pulling it back out (the real fix is further down).  This
    should be cool because SR10 is supposed to be a lot closer to BSD4.3.
    Thus many of the ifdef's on apollo you may have in your source will
    probably have to be changed in similar ways.  Note also that
    _APOLLO_SR10 is a define that I added in my previous fixes for the
    Apollo.

-----
*** clients/xterm/main.c-dist	Wed Nov  9 13:01:20 1988
--- clients/xterm/main.c	Tue Nov 15 14:09:17 1988
***************
*** 96,105 ****
  #include <sys/utsname.h>
  #endif /* hpux */
  
! #ifdef apollo
  #define ttyslot() 1
  #define vhangup() ;
! #endif /* apollo */
  
  #include <utmp.h>
  #include <sys/param.h>	/* for NOFILE */
--- 96,105 ----
  #include <sys/utsname.h>
  #endif /* hpux */
  
! #if defined(apollo) && !defined(_APOLLO_SR10)
  #define ttyslot() 1
  #define vhangup() ;
! #endif /* apollo && !_APOLLO_SR10 */
  
  #include <utmp.h>
  #include <sys/param.h>	/* for NOFILE */
***************
*** 719,724 ****
--- 719,725 ----
  	term->flags |= AUTOREPEAT;
  #endif /* DO_AUTOREPEAT */
  	if (!screen->jumpscroll)	term->flags |= SMOOTHSCROLL;
+ 	if (term->misc.re_verse)		term->flags |= REVERSE_VIDEO;
  	if (term->misc.reverseWrap)		term->flags |= REVERSEWRAP;
  
  	inhibit = 0;
***************
*** 1220,1225 ****
--- 1221,1240 ----
  			close (tty);
  			/* tty is no longer an open fd! */
  			tty = -1;
+ 
+ #ifdef apollo
+ 			/* close all std file descriptors */
+ 			for (index1 = 0; index1 < 3; index1++)
+ 				close (index1);
+ #ifndef SYSV
+ 			if ((tty = open ("/dev/tty", O_RDWR, 0)) < 0)
+ 				SysError (ERROR_OPDEVTTY2);
+ 
+ 			if (ioctl (tty, TIOCNOTTY, (char *) NULL) == -1)
+ 				SysError (ERROR_NOTTY);
+ 			close (tty);
+ #endif	/* !SYSV */
+ #endif /* apollo */
  		}
  
  		if (get_pty (&screen->respond)) {

casey@admin.cognet.ucla.edu (Casey Leedom) (11/16/88)

  By the way, it strikes me that I forgot to include one note on my
earlier fixes for compiling X.V11R3 on the Apollo under the new release
of their operating system.  Apollo has decided not to include most of the
files from /usr/include/netinet.  I've already bitch and moaned about the
problem.  So far they're sticking to their position that there's nothing
in those files that users should need - even though tcp(4P) mentions
<netinet/tcp.h> ...

  In any case, as far as I can see, the only file you need that's
missing is tcp.h.  I've attached a copy here for your use.  (This is a
slightly modified version (byte ordering differences) of the file
distributed with 4.3BSD.  There's a Regents of California copyright on
it, but Berkeley has explicitly made the later releases of the file
publically available.  I'll probably get in trouble in any case ...)

Casey

-----
/*
 * Copyright (c) 1982, 1986 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)tcp.h	7.1 (Berkeley) 6/5/86
 */

typedef	u_long	tcp_seq;
/*
 * TCP header.
 * Per RFC 793, September, 1981.
 */
struct tcphdr {
	u_short	th_sport;		/* source port */
	u_short	th_dport;		/* destination port */
	tcp_seq	th_seq;			/* sequence number */
	tcp_seq	th_ack;			/* acknowledgement number */
#ifdef vax
	u_char	th_x2:4,		/* (unused) */
		th_off:4;		/* data offset */
#endif
#if defined(mc68000) || defined(m68000) || defined(_ISP__M68K) || defined(_ISP__A68K)
	u_char	th_off:4,		/* data offset */
		th_x2:4;		/* (unused) */
#endif
	u_char	th_flags;
#define	TH_FIN	0x01
#define	TH_SYN	0x02
#define	TH_RST	0x04
#define	TH_PUSH	0x08
#define	TH_ACK	0x10
#define	TH_URG	0x20
	u_short	th_win;			/* window */
	u_short	th_sum;			/* checksum */
	u_short	th_urp;			/* urgent pointer */
};

#define	TCPOPT_EOL	0
#define	TCPOPT_NOP	1
#define	TCPOPT_MAXSEG	2

/*
 * Default maximum segment size for TCP.
 * With an IP MSS of 576, this is 536,
 * but 512 is probably more convenient.
 */
#ifdef	lint
#define	TCP_MSS	536
#else
#define	TCP_MSS	MIN(512, IP_MSS - sizeof (struct tcpiphdr))
#endif

/*
 * User-settable options (used with setsockopt).
 */
#define	TCP_NODELAY	0x01	/* don't delay send to coalesce packets */
#define	TCP_MAXSEG	0x02	/* set maximum segment size */

casey@admin.cognet.ucla.edu (Casey Leedom) (11/16/88)

  In my R3/xterm, SR10/Apollo fix earlier today I included the first part
of a fix to get xterm to keep track of its reverse video status properly:

	*** clients/xterm/main.c-dist	Wed Nov  9 13:01:20 1988
	--- clients/xterm/main.c	Tue Nov 15 14:09:17 1988
	***************
	*** 719,724 ****
	--- 719,725 ----
	  	term->flags |= AUTOREPEAT;
	  #endif /* DO_AUTOREPEAT */
	  	if (!screen->jumpscroll)	term->flags |= SMOOTHSCROLL;
	+ 	if (term->misc.re_verse)		term->flags |= REVERSE_VIDEO;
	  	if (term->misc.reverseWrap)		term->flags |= REVERSEWRAP;
	  
	  	inhibit = 0;

I forgot to include the other part, sorry.

Casey

-----
*** charproc.c-dist	Sat Oct 15 13:30:08 1988
--- charproc.c	Tue Nov 15 17:23:10 1988
***************
*** 2652,2657 ****
--- 2652,2658 ----
  		break;
  
  	case MMENU_VIDEO:
+ 		term->flags ^= REVERSE_VIDEO;
  		ReverseVideo(term);
  		break;