[comp.sys.att] Multiple 3B1 shells without ua

jr@amanue.UUCP (Jim Rosenberg) (09/09/87)

Recently the question has come up about how to make it easy to get to UNIX
without going through ua.  After asking questions here about whether you
really can edit /etc/inittab and run getty in a window, I got rather brave.
Yes indeed, you can edit /etc/inittab and the wheels won't fall off; but
even better you can put **MULTIPLE** getty's on /dev/window into
/etc/inittab.  It works just fine!  My normal configuration now is 6 gettys
on /dev/window.  Each is a true login.  You can log out and log back in
again as root, or as yourself if you foobar up your screen, or whatever.
When you go as high as 6 gettys, though, keep in mind that if you should need
to run something out of ua -- install for instance -- you will *run out of
windows* and have to blow off a couple of the gettys.  (Note that for each
getty on /dev/window you put into /etc/inittab you consume a window,
regardless of whether you're actually logged in on that window.

**DO NOT** put in a getty into /etc/inittab with a specific window device
number, e.g. /dev/w6.  This *DOESN'T* work.  The driver wants to have you
open /dev/window and *hand you* the window number.  In fact, I believe at
the system call level an open on /dev/w[1-9] etc. will fail unless the
window manager has *already* created it by an open on /dev/window.  Make
all of your entries on /dev/window look the same as the one that's there
now -- except for the first field, of course, which should be unique for
each entry.

Now this raises the question of how you identify what's going on with all
these windows.  Most annoying to press Suspend and have it say Unknown
Contents, or whatever it is it does say.  Below is a little program called
specrow.  Its use is

specrow n text

where n is a number 1-6.  I have a ksh alias for cd that puts my current
directory both into the menu contents line and the last status row of the
screen.  These are 3 and 5 respectively for the first specrow argument.
The actual row definitions can be found in /usr/include/sys/window.h.  Now
when I press Suspend I get a menu of all my current directories.  Kind of
useful if I get lost.

============================= CUT HERE ===================================
/* specrow -- put text into special row on the screen */

#include <stdio.h>
#include <fcntl.h>
#include <sys/window.h>
#include <ctype.h>

main(argc, argv)
int argc;
char *argv[];

{
	struct utdata utd;
	register char *p;
	int wrow;


	if (argc != 3) {
		fprintf(stderr, "Usage: %s n text\n", argv[0]);
		exit(1);
	}
	for (p = argv[1]; *p != '\0' && isdigit(*p); ++p)
		;
	if (*p != '\0') {
		fprintf(stderr, "%s: %s is not a number\n", argv[0], argv[1]);
		exit(1);
	}

	switch (wrow = atoi(argv[1])) {

	case WTXTPROMPT :
	case WTXTCMD :
	case WTXTLABEL :
	case WTXTUSER :
	case WTXTSLK1 :
	case WTXTSLK2 :
		break;
	
	default :
		fprintf(stderr,
		"%s: %s invalid, legal values are %d, %d, %d, %d, %d, %d\n",
		argv[0], argv[1], WTXTPROMPT, WTXTCMD, WTXTLABEL, WTXTUSER,
		WTXTSLK1, WTXTSLK2);
		exit(1);
	}

	if (strlen(argv[2]) > WTXTLEN) {
		fprintf(stderr,
		"%s: %s too long, truncating to %d characters\n", argv[0],
		argv[2], WTXTLEN);
		argv[2][WTXTLEN] = '\0';
	}

	utd.ut_num = wrow;
	strcpy(utd.ut_text, argv[2]);

	if (ioctl(0, WIOCSETTEXT, &utd) == -1) {
		fprintf(stderr, "%s: Can't change window text\n", argv[0]);
		exit(1);
	}
}

-- 
 Jim Rosenberg
     CIS: 71515,124                         decvax!idis! \
     WELL: jer                                   allegra! ---- pitt!amanue!jr
     BIX: jrosenberg                 seismo!cmcl2!cadre! /