Replacement phone mgr questions on UNIX PC

Steve Barber steveb at shade.UUCP
Mon Mar 26 06:59:37 AEST 1990


I'm working on writing a replacement for /etc/ph for shade because I wanted
some functionality that I couldn't get with the existing phone manager.
This phone manager will probably not be of use to anyone but me, but I will
probably post it when I'm done to give others a basis for doing the same.

I'm stuck on a few problems though:

1)	When I run it, I make the ioctl(0, WIOCCSYS, 1) to tell the system
	that this process is the phone manager, and should receive the
	SHIFT+function keys.  However, I cannot seem to get the system to
	take this window out of the WMGR's list of windows, and I'm not
	sure what the correct way is to keep this window from becoming
	selected.  I.e., pressing <Suspd> shows a window of Unknown Contents.
	I'm catching SIGWIND signals and using the WIOCGPREV ioctl to
	find out which window used to be active so I can re-make it the
	active window, but this doesn't seem to work quite right.
	(SHIFT+SUSPEND, when it hits the phone manager window, then causes
	the cursor to jump up beside the W icon on the top right of the
	screen.)

	So the question is, how do I make the system pretend this window
	isn't selectable through wmgr?

2)	One of the weird but useful features I had in mind when I started
	working on this was that I wanted to be able to type SHIFT-F8 (or
	some hot key) that would pop up a new full-screen window with a
	getty in it to allow multiple console logins, etc. without normally
	tying up a windows with a getty.

	I've tried a lot of permutations and can't get this to work quite
	right either.  Here's the code I've got right now:

	/* ACTION: Spawn a new window with a getty */
	if (!fork())
	{
	    int i, wfd;
	    struct stat statbuf;
	    char dev[16];

	    /* first: get a window */
	    if ((wfd = open("/dev/window", O_RDWR)) < 0)
		exit(-8);
	    close(0); close(1); close(2);
	    dup(wfd); dup(wfd); dup(wfd);
	    setpgrp();
	    ioctl(0, WIOCPGRP, NULL);
	    for (i = 3; i < 32; i++)	/* close all files */
		close(i);
	    
	    fstat(0, &statbuf);
	    sprintf(dev, "w%d", (statbuf.st_rdev & 0xff));
	    execl("/etc/getty", "getty", dev, "9600", NULL);
	    exit(-9);	/* hopefully never reached */
	}

	When this code runs, a window pops open with an error message
	from getty ("getty: cannot open w6.  errno: 6")

	Supposedly, w6 has already been opened!
	I don't get it.

	I tried doing something simple like this:
	if (!fork())
	{
	    close(0); close(1); close(2); close(phwin);
	    execl("/etc/getty", "getty", "window", "9600", NULL);
	    msg("getty failed!");
	}

	and this caused a window to pop open, with a login prompt,
	but when the password prompt came up, everything I typed would
	echo, and signals were received by my phmgr (SIGINT in the
	getty window killed my phone manager!)  Since I was never
	really logged in anyway, this obviously doesn't work too well
	either.

Anybody got any suggestions?
-- 
--**-Steve Barber----steveb at shade.Ann-Arbor.MI.US----(cmode)-------------------



More information about the Comp.sys.att mailing list