[comp.windows.x] Sun Xserver on top of Sunview

aslam@uiucdcsm.cs.uiuc.edu (03/15/88)

I build the Sun Xserver with sunwindows so that I could run X on top off
sunview. It works except that the server messes up the designation of a
sunview window as the console. After the server stops, messages for the
console end up bloaching the screen instead of being directed to the
console window. Has any one else seen this behavior?

Sohail Aslam
Department of Computer Science
University of Illinois
arpa		aslam@a.cs.uiuc.edu
csnet		aslam@uiuc.csnet
usenet		{ihnp4,seismo}!uiucdcs!aslam

aslam@uiucdcsp.cs.uiuc.edu (03/16/88)

I apologize for putting together a rather vague note. I am running X11R2
on a sun 2/170 and SunOS 3.5. I start x via the alias

	alias x 'xinit uwm -- Xsun'

To use X while in sunview I simply type `x' in an of the sunview windows.
Once I exit X, I get back into sunview and all the windows I had. One of
these windows is the console window (via the -C option in .suntools).

I did get two reponses back. mlandau@diamond.bbn.com sent me the following
C program preceded by instructions. I compiled it and saved it in `xtop'

	% cc -o xtop xtop.c

My default .suntools file opens a few windows one of which is designated
as the console, i.e.,

 cmdtool -Wp 652 73 -Ws 495 434 -WP 0 0 -Wl "<< CONSOLE >>" -WL console -C

I determined what ttyp? was the console via `ps'

 7025 p1 I  3:25 cmdtool -Wp 652 73 -Ws 495 434 -WP 0 0 -Wl << CONSOLE >> -W

and issued the command 

 % xtop /dev/ttyp1

I then started x, did a y amount of work and exited. When I got back to
sunview, I checked whether the console was still bound the cmdtool window
defined to be the console,

  % cat >/dev/console
  Hello world!
  ^D

the message appeared in the window. Others using X on top of sunview may
wish to give this program a try. Matt Landau mentions that he instructs
his users to run the program after running X.

Sohail Aslam
Department of Computer Science
University of Illinois
arpa		aslam@a.cs.uiuc.edu
csnet		aslam@uiuc.csnet
usenet		{ihnp4,seismo}!uiucdcs!aslam



-------------------------------------------------------------
From: Matt Landau <mlandau@diamond.bbn.com>

In comp.windows.x (<26900028@uiucdcsm>), you write:
>
>I build the Sun Xserver with sunwindows so that I could run X on top off
>sunview. It works except that the server messes up the designation of a
>sunview window as the console. After the server stops, messages for the
>console end up bloaching the screen instead of being directed to the
>console window. Has any one else seen this behavior?

This is a well-known problem.  What I do is have users run the following
little program after running X on top of SunView.  Given a tty name, it
makes that tty the console.  With no argument, it makes the current window
the console.


#include <stdio.h>
#include <errno.h>
#include <sys/file.h>
#include <sys/ioctl.h>

extern char *rindex ();
static char *ProgName;

main (ac, av)
int	ac;
char	*av[];
{   
    int		fd;
    int		on = 1;
    char	*p, *name = NULL;
    char	prelude[80];
    
    if ((p = rindex (av[0], '/')) != NULL)
	ProgName = p+1;
    else
	ProgName = av[0];
    
    switch (ac)
    {   
      case 1:
	fd = fileno (stderr);
	break;
	
      case 2:
	name = av[1];
	fd = open (name, O_RDWR, 0777);
	break;
	
      default:
	fprintf (stderr, "usage: %s [ttyname]\n", ProgName);
	exit (1);
    }
    if (fd < 0)
    {   
	sprintf (prelude, "%s: %s", ProgName, name ? name : "stderr");
	perror (prelude);
	exit (2);
    }
    if (!isatty (fd))
    {   
	fprintf (stderr, "%s: %s is not a tty device\n", 
		 			ProgName, name ? name : "stderr");
	exit (3);
    }
    if (ioctl (fd, TIOCCONS, &on) < 0)
    {   
	sprintf (prelude, "%s: cannot make %s the console", 
		 			ProgName, name ? name : "tty");
	perror (prelude);
	exit (4);
    }
    if (name) close (fd);
    return (0);
}

----------------------------------------------------

I also received the following reply from dshr@Sun.com

From dshr@Sun.COM Tue Mar 15 11:17:41 1988
Date: Tue 15 Mar 1988 09:16:27 EST
From: David Rosenthal <dshr@Sun.COM>
Subject: Re: Sun Xserver on top of Sunview
To: aslam@m.cs.uiuc.edu
In-Reply-To: aslam's message of 14 Mar 88 20:17:00 GMT

Do  not use an xterm as the console in this case.  Omit the -C flag.

There is no way to save and restore console-hood.

        David.