[comp.sys.mips] Patches to RISC/OS 4.5 for MIT X11R4

datri@convex.com (Anthony A. Datri) (02/16/91)

I posted this once before, but that was long ago and it's small.

Here's a set of patches to MIT's X11R4 to allow it to build under RISC/OS
or Umips or whatever it's really called.  It worked fine for me under 4.50
with X11R$pl12; I haven't tried to rebuild it since.  There's no server --
library and client only.

I didn't do the hard hard -- I just cleaned up and repackaged work done by
one Tony Rick.  The shar file I got is included intact, as well as my
repackaged stuff.  The biggest problem is that Mips doesn't define a unique
cpp symbol -- we invent one here.


Again, *I didn't write this, don't credit (or blame) me with it *.


# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by lovecraft!datri on Mon Jul 16 18:31:16 CDT 1990
# Contents:  mips.patches mips.readme mips40.cf mips.original
 
echo x - mips.patches
sed 's/^@//' > "mips.patches" <<'@//E*O*F mips.patches//'
*** mit/clients/xdm/sessreg.c	Mon Jul 16 11:36:39 1990
--- mit/clients/xdm/sessreg.c.orig	Sun May 14 11:08:50 1989
***************
*** 268,279 ****
  		u->ut_type = DEAD_PROCESS;
  	}
  #else
- #ifndef mips40  /* mips RISC/os4.0bsd has no ut_host field; sorry. */
  	if (addp && host)
  		(void) strncpy (u->ut_host, host, sizeof (u->ut_host));
  	else
  		bzero (u->ut_host, sizeof (u->ut_host));
- #endif /* mips40 */
  #endif
  	u->ut_time = date;
  }
--- 268,277 ----
*** mit/clients/xterm/main.c	Mon Jul 16 08:43:15 1990
--- mit/clients/xterm/main.c.orig	Mon Jul 16 08:41:29 1990
***************
*** 99,107 ****
  #ifndef SYSV				/* BSD systems */
  #include <sgtty.h>
  #include <sys/resource.h>
- #ifndef mips40
  #define HAS_UTMP_UT_HOST
- #endif /* mips40 */
  #define HAS_BSD_GROUPS
  #endif	/* !SYSV */
  
--- 99,105 ----
*** mit/config/imakemdep.h	Mon Jul 16 08:40:00 1990
--- mit/config/imakemdep.h.orig	Mon Dec 18 13:56:39 1989
***************
*** 126,134 ****
  #ifdef ibm
  	"-Dibm",	/* IBM PS/2 and RT under both AOS and AIX */
  #endif
- #ifdef mips40
-         "-Dmips40",     /* MIPS RISC/os 4.0 */
- #endif
  };
  #else /* else MAKEDEPEND */
  /*
--- 126,131 ----
***************
*** 172,180 ****
  	{"att", "1"},
  #endif
  #ifdef mips
-         {"mips", "1"},
- #endif
- #ifdef mips40
  	{"mips", "1"},
  #endif
  #ifdef ultrix
--- 169,174 ----
*** mit/config/Imake.tmpl	Mon Jul 16 08:13:17 1990
--- mit/config/Imake.tmpl.orig	Mon Dec 18 14:01:44 1989
***************
*** 58,73 ****
  #define UltrixArchitecture
  #endif
  
- #ifdef mips40
- /* MIPS RISC/os 4.0 cpp has no unique symbol: */
- /* build imake with BOOTSTRAPCFLAGS=-Dmips40 */
- #define MacroIncludeFile <mips40.cf>
- #define MacroFile mips40.cf
- #undef mips40
- #define Mips40Architecture
- #endif /* mips40 */
- 
- 
  #if defined(vax) && !defined(UltrixArchitecture)
  #define MacroIncludeFile <bsd.cf>
  #define MacroFile bsd.cf
--- 58,63 ----
@//E*O*F mips.patches//
chmod u=rw,g=r,o=r mips.patches
 
echo x - mips.readme
sed 's/^@//' > "mips.readme" <<'@//E*O*F mips.readme//'
Mon Jul 16 17:53:18 CDT 1990 datri@convex.com (Anthony A. Datri)

Here's all you should need to make MIT X11R4, fixes 1-12 work under RISC/OS
4.50.

I got the patches and the mips40.cf file from a comp.sys.mips post, and
changed a couple of things, and made the whole more palatable (context
diffs instead of ad-hoc and ed scripts).  Note that Tony Rick did the
hard work -- I'm repackaging and cleaning up.  The post that I started with
can be found in mips.original.

This should apply to and work with X11R4, fixes 1-12.  It seems to work
on a 3240 and a 6280, both running 4.50.  My experience with this OS
and MIPS is very limited, so please forgive any mistakes here, and please
let me know any that you find, or if you find this useful.

You want to make sure that the following lines are somewhere in your
installed /usr/lib/X11/config directory, preferably on the end of site.def
where imake can find them.  Because of the unobvious way that -systype works,
you don't get the right include/lib directories otherwise.

#define DefaultCCOptions -systype bsd43 -L/usr/lib/X11
#define StandardIncludes -I/bsd43/usr/include -I/usr/include
#define BOOTSTRAPCFLAGS -systype bsd43 -Dmips40

@//E*O*F mips.readme//
chmod u=rw,g=r,o=r mips.readme
 
echo x - mips40.cf
sed 's/^@//' > "mips40.cf" <<'@//E*O*F mips40.cf//'
/*mips40.cf*/
/******************************************************************/
/*
 * SET VERSION NUMBERS BEFORE MAKING MAKEFILES
 */


#define OSName            RISC/os4.5
#define OSMajorVersion    4
#define OSMinorVersion    5


/**/# platform:  $XConsortium: bsd.cf,v 1.8 89/12/23 14:19:17 jim Exp $
/**/# operating system:  OSName

/*****************************************************************************
 *			  Platform-specfic parameters                        *
 *****************************************************************************/

#define CcCmd             cc -Wf,-XNp6000,-XNd4000 -Dmips40
#define DefaultCCOptions  -systype bsd43 
#define BuildServer       NO
#define BuildExamples	  NO
#define ExtraLibraries    -lmld
#define BootstrapCFlags   -Dmips40
#define DependCmd	  $(DEPENDSRC)/makedepend -I/usr/include/bsd43

@//E*O*F mips40.cf//
chmod u=rw,g=r,o=r mips40.cf
 
echo x - mips.original
sed 's/^@//' > "mips.original" <<'@//E*O*F mips.original//'
\begindata{text822, 0}
X-Andrew-Authenticated-As: 0;lovecraft.convex.com;Superuser
@From macdonal@mips2.cr.bull.com Fri Jul 13 12:34:30 1990
Received: by concave (5.51/7.0)
	id AA07652; Fri, 13 Jul 90 12:34:22 CDT
Received: by convex.COM (5.51/4.7)
	id AA23483; Fri, 13 Jul 90 12:34:17 CDT
Received: from nic.near.net by hydra.convex.com (5.61/1.00Inomad)
	id AA27070; Fri, 13 Jul 90 12:34:08 -0500
Received: from mips2.cr.bull.com by nic.near.net id aa00766; 13 Jul 90 12:22 EDT
Received: by mips2.cr.bull.com (5.52/4.7)
	id AA19911; Fri, 13 Jul 90 13:15:26 EDT
@From: Rindress MacDonald <macdonal@mips2.cr.bull.com>
Message-Id: <9007131715.AA19911@mips2.cr.bull.com>
Subject: Help with X11R4 on MIPS 6820.
To: datri@mips2.cr.bull.com
Date: Fri, 13 Jul 90 13:15:25 EDT
X-Mailer: ELM [version 2.2 PL0]




Hi,

	The following is an article I grabbed of the net a while ago.
Please let me know how everything goes.




>From granite!bbn!mit-eddie!uw-beaver!zephyr.ens.tek.com!tekig5!tonyr Mon Feb 26 08:20:30 EST 1990
Article 1 of comp.sys.mips:
Path: mips2!granite!bbn!mit-eddie!uw-beaver!zephyr.ens.tek.com!tekig5!tonyr
>From: tonyr@tekig5.PEN.TEK.COM (Tony Rick)
Newsgroups: comp.sys.mips
Subject: X11R4 build experience on m120-5
Keywords: windows, X
Message-ID: <5684@tekig5.PEN.TEK.COM>
Date: 23 Feb 90 21:53:34 GMT
Organization: Tektronix Inc., Beaverton, Or.
Lines: 216


I have been asked to post my adventures in building X11R4 under
RISC/os 4.0 on my m120-5.  So here it is.  I would like to thank
Keith Sparacin (keith@csc.ti.com) for reviewing my process and pointing 
out glaring errors which resulted from my method of attack ( I dove in, 
machete in one hand, whip in the other ;-) ).  

MIPS has an X product they call RISCwindows for $1000.  I do not know if 
it is based on R3 or R4.  Their literature says it is a "native 
implementation ... highly tuned for optimum performance on MIPS 
RISComputers(tm) and RISCstations(tm)".

I only built the client side.  Of that we use only xterm and one local
application using the libraries, so there has been no extensive
testing.  It should be a reasonable starting point, however.

Since RISC/os 4.0 is a strange hybrid of ATT_V3_0 and 4.3bsd, I 
thought it safest to proceed on some convenient simplifying assumptions, 
which were:

	o   a bsd43 compilation environment
	o   no preprocessor symbol defined

The first assumption means that /bsd43/bin must appear in your search path
before /bin.  Mine looks  like this:

path = (/bsd43/bin /usr/sbin /usr/lbin /usr/ucb /usr/bin /bin /etc /usr/new /usr/local/bin)


The second assumption means that you have to go through the process proscribed
by the instructions for creating your own preprocessor symbol. I saw 'mips' 
and 'umips' defined in the code and control files,  but there is nothing 
to indicate which variety of MIPS operating system they applies to 
(there are several).  Mips is not one of the mentioned supported platforms.  
I defined 'mips40' for RISC/os 4.0 and made all the necessary control file 
modifications.  I have included changes and additions to all the files that 
make this happen. It almost works.

There were some things I had to force with my bare hands.  
The utmp structure in the bsd43 environment does not define the field 
'ut_host', so there are source modifications to .../clients/xterm/main.c 
and .../clients/xdm/sessreg.c.

The included changes are for files:

    mips40.cf 
    Imake.tmpl 
    imakemdep.h.
    .../clients/xterm/main.c
    .../clients/xdm/sessreg.c

There are source segments and ed files created by 'diff -e' that may 
be applied to the distributed versions.  mips40.cf is included in 
its entirety.

Everything will compile except .../clients/xterm/charproc.c .  You 
will have to edit the Makefile there to remove the string 
'-Wf,-XNp6000,-XNd5000' from the macros CC and PREPROCESSORCMD 
and make xterm locally.  I would appreciate responses and comments
if anyone uses this.  


mips40.cf
****************************************************************
/*
 * SET VERSION NUMBERS BEFORE MAKING MAKEFILES
 */


#define OSName            RISC/os4.0
#define OSMajorVersion    4
#define OSMinorVersion    0


/**/# platform:  $XConsortium: bsd.cf,v 1.8 89/12/23 14:19:17 jim Exp $
/**/# operating system:  OSName

/*****************************************************************************
 *			  Platform-specfic parameters                        *
 *****************************************************************************/

#define CcCmd             cc -Wf,-XNp6000,-XNd4000
#define DefaultCCOptions  -systype bsd43 
#define BuildServer       NO
#define BuildExamples	  NO
#define ExtraLibraries    -lmld
#define BootstrapCFlags   -Dmips40
#define DependCmd	  $(DEPENDSRC)/makedepend -I/usr/include/bsd43
****************************************************************



Imake.tmpl ( near the beginning, before other stuff like this )
****************************************************************
#ifdef mips40
/* MIPS RISC/os 4.0 cpp has no unique symbol: */ 
/* build imake with BOOTSTRAPCFLAGS=-Dmips40 */
#define MacroIncludeFile <mips40.cf>
#define MacroFile mips40.cf
#undef mips40
#define Mips40Architecture
#endif /* mips40 */
****************************************************************
ed.command
****************************************************************
45a
#ifdef mips40
/* MIPS RISC/os 4.0 cpp has no unique symbol: */ 
/* build imake with BOOTSTRAPCFLAGS=-Dmips40 */
#define MacroIncludeFile <mips40.cf>
#define MacroFile mips40.cf
#undef mips40
#define Mips40Architecture
#endif /* mips40 */

@. 
****************************************************************



imakemdep.h 
****************************************************************
(after #ifdef ibm ... #endif)
#ifdef mips40
	"-Dmips40",	/* MIPS RISC/os 4.0 */
#endif

( after #ifdef mips ... #endif)
#ifdef mips40
	{"mips40", "1"},
#endif
****************************************************************
ed command
****************************************************************
171a
	{"mips", "1"},
#endif
#ifdef mips40
@. 
128a
#ifdef mips40
	"-Dmips40",	/* MIPS RISC/os 4.0 */
#endif
@. 
****************************************************************


@.../clients/xterm/main.c
****************************************************************
***old> line 99
#ifndef SYSV				/* BSD systems */
#include <sgtty.h>
#include <sys/resource.h>
#define HAS_UTMP_UT_HOST
#define HAS_BSD_GROUPS
#endif	/* !SYSV */

***new>
#ifndef SYSV				/* BSD systems */
#include <sgtty.h>
#include <sys/resource.h>
#ifndef mips40				/* RISC/os4.0 is weird */
#define HAS_UTMP_UT_HOST
#endif /* mips40 */
#define HAS_BSD_GROUPS
#endif	/* !SYSV */
****************************************************************
ed command
****************************************************************
102a
#endif /* mips40 */
@. 
101a
#ifndef mips40				/* RISC/os4.0 is weird */
@. 
****************************************************************



@.../clients/xdm/sessreg.c
****************************************************************
***old> line 270
#else
	if (addp && host)
		(void) strncpy (u->ut_host, host, sizeof (u->ut_host));
	else
		bzero (u->ut_host, sizeof (u->ut_host));
#endif



***new>
#else
#ifndef mips40  /* mips RISC/os4.0bsd has no ut_host field; sorry. */
	if (addp && host)
		(void) strncpy (u->ut_host, host, sizeof (u->ut_host));
	else
		bzero (u->ut_host, sizeof (u->ut_host));
#endif /* mips40 */
#endif
****************************************************************
ed command
****************************************************************
274a
#endif /* mips40 */
@. 
270a
#ifndef mips40  /* mips RISC/os4.0bsd has no ut_host field; sorry. */
@. 

****************************************************************


Tony Rick
tonyr@tekadg.adg.tek.com
Tektronix, Inc.


>From granite!bbn!uwm.edu!rpi!zaphod.mps.ohio-state.edu!usc!ucsd!helios.ee.lbl.gov!epb2.lbl.gov!envbvs Mon Feb 26 08:24:58 EST 1990
Article 19 of comp.windows.x:
Path: mips2!granite!bbn!uwm.edu!rpi!zaphod.mps.ohio-state.edu!usc!ucsd!helios.ee.lbl.gov!epb2.lbl.gov!envbvs
>From: envbvs@epb2.lbl.gov (Brian V. Smith)
Newsgroups: comp.windows.x
Subject: xfig 2.0 patch2
Message-ID: <4930@helios.ee.lbl.gov>
Date: 23 Feb 90 22:49:45 GMT
Sender: usenet@helios.ee.lbl.gov
Reply-To: envbvs@epb2.lbl.gov (Brian V. Smith)
Organization: lbl
Lines: 55
X-Local-Date: 23 Feb 90 14:49:45 PST

I said I would wait a while before posting the next patch (2),
but the moderator of comp.sources.x wanted to patch the source
before posting it.  So, here is patch2 (it is also on expo now).
This fixes bus errors etc from drawing circles/ellipses:

*** curve.c.old	Tue Jan 16 17:21:04 1990
--- curve.c	Thu Feb 22 15:58:24 1990
***************
*** 117,121
  		}
  	pw_lines(window, points, npoints, val? PAINT: ERASE,
  			thick, area_fill);
- 	free(points);
  	}

--- 117,120 -----
  		}
  	pw_lines(window, points, npoints, val? PAINT: ERASE,
  			thick, area_fill);
  	}

*** patchlevel.h.old	Tue Feb 20 15:35:01 1990
--- patchlevel.h	Fri Feb 23 08:58:00 1990
***************
*** 1
! #define PATCHLEVEL 1

--- 1 -----
! #define PATCHLEVEL 2

*** Imakefile.old	Tue Feb 20 15:10:16 1990
--- Imakefile	Fri Feb 23 09:03:01 1990
***************
*** 5,11
  
  SRCS=   addpt.c arc.c arcbox.c arrow.c autoarrow.c\
          bitmap.c blink.c bound.c box.c break.c\
!         canvas.c changestyle.o changetext.o changethick.c \
          char.c color.c copy.c cursor.c curve.c\
          deletept.c dir.c drag.c draw.c ellipse.c\
          file.c flip.c font.c free.c\

--- 5,11 -----
  
  SRCS=   addpt.c arc.c arcbox.c arrow.c autoarrow.c\
          bitmap.c blink.c bound.c box.c break.c\
!         canvas.c changestyle.c changetext.c changethick.c \
          char.c color.c copy.c cursor.c curve.c\
          deletept.c dir.c drag.c draw.c ellipse.c\
          file.c flip.c font.c free.c\

_____________________________________
Brian V. Smith    (bvsmith@lbl.gov)
Lawrence Berkeley Laboratory
I don't speak for LBL, these non-opinions are all mine.


>From granite!bbn!mit-eddie!uw-beaver!zephyr.ens.tek.com!tekig5!tonyr Wed Feb 28 08:28:51 EST 1990
Article 1 of comp.sys.mips:
Path: mips2!granite!bbn!mit-eddie!uw-beaver!zephyr.ens.tek.com!tekig5!tonyr
>From: tonyr@tekig5.PEN.TEK.COM (Tony Rick)
Newsgroups: comp.sys.mips
Subject: X11R4 build experience on m120-5
Keywords: windows, X
Message-ID: <5684@tekig5.PEN.TEK.COM>
Date: 23 Feb 90 21:53:34 GMT
Organization: Tektronix Inc., Beaverton, Or.
Lines: 216


I have been asked to post my adventures in building X11R4 under
RISC/os 4.0 on my m120-5.  So here it is.  I would like to thank
Keith Sparacin (keith@csc.ti.com) for reviewing my process and pointing 
out glaring errors which resulted from my method of attack ( I dove in, 
machete in one hand, whip in the other ;-) ).  

MIPS has an X product they call RISCwindows for $1000.  I do not know if 
it is based on R3 or R4.  Their literature says it is a "native 
implementation ... highly tuned for optimum performance on MIPS 
RISComputers(tm) and RISCstations(tm)".

I only built the client side.  Of that we use only xterm and one local
application using the libraries, so there has been no extensive
testing.  It should be a reasonable starting point, however.

Since RISC/os 4.0 is a strange hybrid of ATT_V3_0 and 4.3bsd, I 
thought it safest to proceed on some convenient simplifying assumptions, 
which were:

	o   a bsd43 compilation environment
	o   no preprocessor symbol defined

The first assumption means that /bsd43/bin must appear in your search path
before /bin.  Mine looks  like this:

path = (/bsd43/bin /usr/sbin /usr/lbin /usr/ucb /usr/bin /bin /etc /usr/new /usr/local/bin)


The second assumption means that you have to go through the process proscribed
by the instructions for creating your own preprocessor symbol. I saw 'mips' 
and 'umips' defined in the code and control files,  but there is nothing 
to indicate which variety of MIPS operating system they applies to 
(there are several).  Mips is not one of the mentioned supported platforms.  
I defined 'mips40' for RISC/os 4.0 and made all the necessary control file 
modifications.  I have included changes and additions to all the files that 
make this happen. It almost works.

There were some things I had to force with my bare hands.  
The utmp structure in the bsd43 environment does not define the field 
'ut_host', so there are source modifications to .../clients/xterm/main.c 
and .../clients/xdm/sessreg.c.

The included changes are for files:

    mips40.cf 
    Imake.tmpl 
    imakemdep.h.
    .../clients/xterm/main.c
    .../clients/xdm/sessreg.c

There are source segments and ed files created by 'diff -e' that may 
be applied to the distributed versions.  mips40.cf is included in 
its entirety.

Everything will compile except .../clients/xterm/charproc.c .  You 
will have to edit the Makefile there to remove the string 
'-Wf,-XNp6000,-XNd5000' from the macros CC and PREPROCESSORCMD 
and make xterm locally.  I would appreciate responses and comments
if anyone uses this.  


mips40.cf
****************************************************************
/*
 * SET VERSION NUMBERS BEFORE MAKING MAKEFILES
 */


#define OSName            RISC/os4.0
#define OSMajorVersion    4
#define OSMinorVersion    0


/**/# platform:  $XConsortium: bsd.cf,v 1.8 89/12/23 14:19:17 jim Exp $
/**/# operating system:  OSName

/*****************************************************************************
 *			  Platform-specfic parameters                        *
 *****************************************************************************/

#define CcCmd             cc -Wf,-XNp6000,-XNd4000
#define DefaultCCOptions  -systype bsd43 
#define BuildServer       NO
#define BuildExamples	  NO
#define ExtraLibraries    -lmld
#define BootstrapCFlags   -Dmips40
#define DependCmd	  $(DEPENDSRC)/makedepend -I/usr/include/bsd43
****************************************************************



Imake.tmpl ( near the beginning, before other stuff like this )
****************************************************************
#ifdef mips40
/* MIPS RISC/os 4.0 cpp has no unique symbol: */ 
/* build imake with BOOTSTRAPCFLAGS=-Dmips40 */
#define MacroIncludeFile <mips40.cf>
#define MacroFile mips40.cf
#undef mips40
#define Mips40Architecture
#endif /* mips40 */
****************************************************************
ed.command
****************************************************************
45a
#ifdef mips40
/* MIPS RISC/os 4.0 cpp has no unique symbol: */ 
/* build imake with BOOTSTRAPCFLAGS=-Dmips40 */
#define MacroIncludeFile <mips40.cf>
#define MacroFile mips40.cf
#undef mips40
#define Mips40Architecture
#endif /* mips40 */

@. 
****************************************************************



imakemdep.h 
****************************************************************
(after #ifdef ibm ... #endif)
#ifdef mips40
	"-Dmips40",	/* MIPS RISC/os 4.0 */
#endif

( after #ifdef mips ... #endif)
#ifdef mips40
	{"mips40", "1"},
#endif
****************************************************************
ed command
****************************************************************
171a
	{"mips", "1"},
#endif
#ifdef mips40
@. 
128a
#ifdef mips40
	"-Dmips40",	/* MIPS RISC/os 4.0 */
#endif
@. 
****************************************************************


@.../clients/xterm/main.c
****************************************************************
***old> line 99
#ifndef SYSV				/* BSD systems */
#include <sgtty.h>
#include <sys/resource.h>
#define HAS_UTMP_UT_HOST
#define HAS_BSD_GROUPS
#endif	/* !SYSV */

***new>
#ifndef SYSV				/* BSD systems */
#include <sgtty.h>
#include <sys/resource.h>
#ifndef mips40				/* RISC/os4.0 is weird */
#define HAS_UTMP_UT_HOST
#endif /* mips40 */
#define HAS_BSD_GROUPS
#endif	/* !SYSV */
****************************************************************
ed command
****************************************************************
102a
#endif /* mips40 */
@. 
101a
#ifndef mips40				/* RISC/os4.0 is weird */
@. 
****************************************************************



@.../clients/xdm/sessreg.c
****************************************************************
***old> line 270
#else
	if (addp && host)
		(void) strncpy (u->ut_host, host, sizeof (u->ut_host));
	else
		bzero (u->ut_host, sizeof (u->ut_host));
#endif



***new>
#else
#ifndef mips40  /* mips RISC/os4.0bsd has no ut_host field; sorry. */
	if (addp && host)
		(void) strncpy (u->ut_host, host, sizeof (u->ut_host));
	else
		bzero (u->ut_host, sizeof (u->ut_host));
#endif /* mips40 */
#endif
****************************************************************
ed command
****************************************************************
274a
#endif /* mips40 */
@. 
270a
#ifndef mips40  /* mips RISC/os4.0bsd has no ut_host field; sorry. */
@. 

****************************************************************


Tony Rick
tonyr@tekadg.adg.tek.com
Tektronix, Inc.




\enddata{text822, 0}
@//E*O*F mips.original//
chmod u=rw,g=r,o=r mips.original
 
exit 0


--
--
In MDDT no one can hear you scream
 

pphillip@cs.ubc.ca (Peter Phillips) (02/19/91)

We've been using the libraries and clients from X11R4 on our R3260
under RiscOS 4.51 for quite some time now but have run into a small
problem with xterm.

If an xterm is started from a login which has no controlling tty (like
from /usr/ucb/rsh) then the xterm will not get a controlling tty.  The
lack of a controlling tty breaks programs like "su" and "script".
This problem doesn't occur under other UNIX machines running X11R4 nor
does it occur using xterm from RiscWindows 3.21.

Has anyone else run into or solved this problem?  Our X11R4 was
installed using the BSD compiler/libraries.  The only patch applied to
xterm was to make sure that HAS_UTMP_UT_HOST was undefined.

You can see if your xterm has this bug by doing something like:

/usr/ucb/rsh mips-host xterm -display display:0.0

From the resulting xterm doing something like:

echo foo >/dev/tty

Should give you:

/dev/tty: No such device or address

I've been trying to debug this but I'm more than a little confused
about how a controlling tty is set.  In termio(7-SysV) it implies that
opening a tty device will make that tty the process' controlling tty
but this isn't true in all situations.  Under SunOS there is an
ioctl() call which will make an open tty device the controlling tty
but I can't seem to find any corresponding system call in RiscOS 4.51.
(I suspect there isn't one).  Help!

--
Peter Phillips, pphillip@cs.ubc.ca | "It's worse than that ... He has
{alberta,uunet}!ubc-cs!pphillip    | no brain." -- McCoy, "Spock's Brain"

k2@bl.physik.tu-muenchen.de (Klaus Steinberger) (02/21/91)

pphillip@cs.ubc.ca (Peter Phillips) writes:


>We've been using the libraries and clients from X11R4 on our R3260
>under RiscOS 4.51 for quite some time now but have run into a small
>problem with xterm.

>If an xterm is started from a login which has no controlling tty (like
>from /usr/ucb/rsh) then the xterm will not get a controlling tty.  The
>lack of a controlling tty breaks programs like "su" and "script".
>This problem doesn't occur under other UNIX machines running X11R4 nor
>does it occur using xterm from RiscWindows 3.21.

I'm also running into this problem, I'm very very interested in a
solution. I have no idea, why this happened.

Sincerely,
Klaus Steinberger

--
Klaus Steinberger               Beschleunigerlabor der TU und LMU Muenchen
Phone: (+49 89)3209 4287        Hochschulgelaende
FAX:   (+49 89)3209 4280        D-8046 Garching, Germany
BITNET: K2@DGABLG5P             Internet: k2@bl.physik.tu-muenchen.de

lawc@super.ece.jhu.edu (Chiu-Tai Law) (02/22/91)

In article <k2.667143745@woodstock> k2@bl.physik.tu-muenchen.de (Klaus Steinberger) writes:
>pphillip@cs.ubc.ca (Peter Phillips) writes:
>
>>If an xterm is started from a login which has no controlling tty (like
>>from /usr/ucb/rsh) then the xterm will not get a controlling tty.  The
>>lack of a controlling tty breaks programs like "su" and "script".
>>This problem doesn't occur under other UNIX machines running X11R4 nor
>>does it occur using xterm from RiscWindows 3.21.
>
>I'm also running into this problem, I'm very very interested in a
>solution. I have no idea, why this happened.
>

I have talked to Mips at CA a long while ago.  However, I cannot
file a bug report (it is difficult to isolate the bug and give an
SHORT example).  One way to work around is to compile xterm in SYSV
environment.  The bug has been persisted from OS 4.0 to 4.51 (do not
know about 4.52).
-- 
Chiu Tai Law				lawc@super.ece.jhu.edu
(301) 338-7976

pphillip@cs.ubc.ca (Peter Phillips) (02/23/91)

In article <k2.667143745@woodstock> k2@bl.physik.tu-muenchen.de (Klaus Steinberger) writes:
>pphillip@cs.ubc.ca (Peter Phillips) writes:
>
>
>>We've been using the libraries and clients from X11R4 on our R3260
>>under RiscOS 4.51 for quite some time now but have run into a small
>>problem with xterm.
>
>>If an xterm is started from a login which has no controlling tty (like
>>from /usr/ucb/rsh) then the xterm will not get a controlling tty.  The
>>lack of a controlling tty breaks programs like "su" and "script".
>>This problem doesn't occur under other UNIX machines running X11R4 nor
>>does it occur using xterm from RiscWindows 3.21.
>
>I'm also running into this problem, I'm very very interested in a
>solution. I have no idea, why this happened.
>
>Sincerely,
>Klaus Steinberger
>
>--
>Klaus Steinberger               Beschleunigerlabor der TU und LMU Muenchen
>Phone: (+49 89)3209 4287        Hochschulgelaende
>FAX:   (+49 89)3209 4280        D-8046 Garching, Germany
>BITNET: K2@DGABLG5P             Internet: k2@bl.physik.tu-muenchen.de

I now have a fix for this thanks to <chris@softway.sw.oz.au>.  It
turns out that the BSD setpgrp system call doesn't work properly.  The
fix is to use the SYSV setpgrp call.  To do, make sure that
HAS_SYSV_SETPGRP is defined in main.c in the xterm source code.  Then,
when linking xterm, use the setpgrp.o object file from /lib/libc.a to
make sure that the right setpgrp is used.  I've put the diffs for
Imakefile and main.c at the end of this message.  Our mips.cf file
uses the symbol MIPS to indicate compilation under RiscOS.

--
Peter Phillips, pphillip@cs.ubc.ca | "It's worse than that ... He has
{alberta,uunet}!ubc-cs!pphillip    | no brain." -- McCoy, "Spock's Brain"

---- cut here --------------------
*** Imakefile   Tue Apr  3 20:04:14 1990
--- /staff/pphillip/tmp/xterm2/Imakefile        Wed Feb 20 00:51:14 1991
***************
*** 40,46 ****
--- 40,52 ----
                  main.c menu.c misc.c screen.c scrollbar.c tabs.c \
                  TekPrsTbl.c Tekproc.c util.c VTPrsTbl.c
+ #ifdef MIPS
            OBJS1 = main.o input.o charproc.o cursor.o util.o tabs.o \
                  screen.o scrollbar.o button.o Tekproc.o misc.o \
+                 VTPrsTbl.o TekPrsTbl.o data.o menu.o setpgrp.o
+ #else /* MIPS */
+           OBJS1 = main.o input.o charproc.o cursor.o util.o tabs.o \
+                 screen.o scrollbar.o button.o Tekproc.o misc.o \
                  VTPrsTbl.o TekPrsTbl.o data.o menu.o
+ #endif /* MIPS */
            SRCS2 = resize.c
            OBJS2 = resize.o
***************
*** 82,83 ****
--- 88,94 ----
  InstallManPage(resize,$(MANDIR))
  DependTarget()
+
+ #ifdef MIPS
+ setpgrp.o:
+       ar x /lib/libc.a setpgrp.o
+ #endif /* MIPS */
*** main.c      Sun Feb 18 20:25:21 1990
--- /staff/pphillip/tmp/xterm2/main.c   Tue Feb 19 23:35:22 1991
***************
*** 109,112 ****
--- 109,113 ----
  #undef HAS_UTMP_UT_HOST
  #define USE_SYSV_UTMP
+ #define USE_SYSV_PGRP
  #endif

houman@mips2.cr.bull.com (Houman Shafiezadeh) (03/08/91)

In article <1991Feb21.160803.5157@aplcen.apl.jhu.edu>, lawc@super.ece.jhu.edu (Chiu-Tai Law) writes:
|> In article <k2.667143745@woodstock> k2@bl.physik.tu-muenchen.de (Klaus Steinberger) writes:
|> >pphillip@cs.ubc.ca (Peter Phillips) writes:
|> >
|> >>If an xterm is started from a login which has no controlling tty (like
|> >>from /usr/ucb/rsh) then the xterm will not get a controlling tty.  The
|> >>lack of a controlling tty breaks programs like "su" and "script".
|> >>This problem doesn't occur under other UNIX machines running X11R4 nor
|> >>does it occur using xterm from RiscWindows 3.21.
|> >
|> >I'm also running into this problem, I'm very very interested in a
|> >solution. I have no idea, why this happened.
|> >
|> 
|> I have talked to Mips at CA a long while ago.  However, I cannot
|> file a bug report (it is difficult to isolate the bug and give an
|> SHORT example).  One way to work around is to compile xterm in SYSV
|> environment.  The bug has been persisted from OS 4.0 to 4.51 (do not
|> know about 4.52).
|> -- 
|> Chiu Tai Law				lawc@super.ece.jhu.edu
|> (301) 338-7976

I'm running 4.52 and X11.4 and have not noticedd the problem mentioned above.
-- 

==========================================================================
|				||					 |
|Houman Shafiezadeh		||	houman@mips2.cr.bull.com	 |
|Unix Software Development	||					 |
|Bull H.N. Information Systems	||=======================================|
|300 Concord RD.		||					 |
|Billerica, MA 01821		||					 |
|				||					 |
==========================================================================