ostroff@oswego.Oswego.EDU (Boyd Ostroff) (05/16/91)
Submitted-by: ostroff@oswego.Oswego.EDU (Boyd Ostroff) Posting-number: Volume 1, Issue 23 Archive-name: wlogin/part01 I posted this several years ago, but there seem to be a whole new "crop" of 3B1 users out there now, and it didn't ever make it into the OSU archives.... Anyway, I've gotten a number of requests for it, so I would like to re-post wlogin. Note that this is NOT a revision, but just a re-post. WLOGIN is a very compact little program which can take the place of /etc/getty on the system console. It allows multiple logins to be run in overlapping 24x80 windows with a small font. WLOGIN does not need wmgr, smgr, ua or ph to function, however it should co-exist with them (personally I don't use any of the above :-). If wmgr is present, the windows may be selected in the usual way. Without wmgr, windows are selected with the mouse. |||| Boyd Ostroff / Tech Director / SUNY Oswego Dept of Theatre / 315-341-2987 |||| Sys Admin at cboard.UUCP / Serving the Performing Arts / 315-947-6414/8N1 |||| ostroff@oswego.oswego.edu / cboard!ostroff@natasha.oswego.edu = = = = = = = = = = = = = = = = CUT HERE = = = = = = = = = = = = = = = = = = #!/bin/sh # to extract, remove the header and type "sh filename" if `test ! -s ./README` then echo "writing ./README" cat > ./README << '\End\Of\Shar\' This is WLOGIN, a program which allows you to run multiple login sessions in small, overlapping 24x80-character windows. Each window will have a proper utmp entry and will behave just as though you were logged in on separate tty lines. Please read the following notes before installing it on your system. Installation is simple, but it does require modifying your /etc/inittab. * BE SURE THAT YOU HAVE A BACKUP OF /ETC/INITTAB BEFORE PROCEEDING * If you seriously damage your inittab, you may not be able to login to your system! If you *really* want to play it safe, provide an alternate way to login, such as a terminal plugged into the serial port, or a PC with a modem. To install WLOGIN, follow these steps: 1) make 2) Read through the manual pages and this README file. 3) su 4) make install Finally, you will need to arrange to run WLOGIN from your inittab. First you must decide how you wish to use it. A good start would be to leave the existing system console getty alone and run one WLOGIN window to see if it works properly, as in the following example: is:2:initdefault: rc::bootwait:/etc/rc > /dev/null 2>&1 vid:2:respawn:/etc/getty window 9600 :ph0:2:respawn:/etc/getty ph0 1200 ph1:2:respawn:/etc/getty ph1 1200 000:2:respawn:/etc/getty tty000 2400 v1:2:respawn:/etc/wlogin In this example, WLOGIN will spawn a window in the upper left-hand corner of the screen, overlapping the phone mgr and time display line. If you wish to totally eliminate the standard console getty, your inittab might look like this: is:2:initdefault: rc::bootwait:/etc/rc > /dev/null 2>&1 :ph0:2:respawn:/etc/getty ph0 1200 ph1:2:respawn:/etc/getty ph1 1200 000:2:respawn:/etc/getty tty000 2400 v1:2:respawn:/etc/wlogin 0 0 v2:2:respawn:/etc/wlogin 100 10 v3:2:respawn:/etc/wlogin 200 20 This example would provide you with 3 overlapping WLOGIN windows. Be sure to read the manual page for further information on the use of the program. Finally, double check to make sure that the program and font are properly located and named, then type: telinit q This should cause WLOGIN to spawn it's window(s). If instead, windows start opening and closing and/or you get lots of disk thrashing, you've either mucked up the inittab entries or not followed the instructions above properly. Don't panic! If INIT notices it is continuously respawning the same entry for too long, it will quit (see the INIT(1M) man page). Alternately, you could login either through the standard console window or via a serial terminal (as per the suggestion above). Once logged in, copy your BACKUP version of /etc/inittab over the modified version and then try again. I have also added the following two aliases to my .kshrc: alias small='clear;windy -w 482 -h 240 -f 300;\ setf 0;setf /usr/lib/wfont/122.ft 0' alias big='clear;setf /usr/lib/wfont/system.8.ft 0;windy' This way, if you get tired of looking at a little window, you can just type "big" and return to a full-screen shell. To get back to a small bordered window, type "small" (these both require the program "windy" from the STORE). The WLOGIN source is pretty simple and could be easily modified to make the program suit your particular needs. See the WINDOW(7) manual pages in Volume 1 of the User's Manual for more information. Thanks to Muhammad S. Benten for posting the 122 x 28 font some time ago. Credit is also due to Andy Fyfe for his window.c posting, which gave me the idea to write this. |||| Boyd Ostroff / Tech Director / SUNY Oswego Dept of Theatre / 315-341-2987 |||| Sys Admin at cboard.UUCP / Serving the Performing Arts / 315-947-6414/8N1 |||| ostroff@oswego.oswego.edu / cboard!ostroff@natasha.oswego.edu \End\Of\Shar\ else echo "will not over write ./README" fi if `test ! -s ./wlogin.1m` then echo "writing ./wlogin.1m" cat > ./wlogin.1m << '\End\Of\Shar\' .TH WLOGIN 1M .SH NAME wlogin - log in to a console window .SH SYNOPSIS .I /etc/wlogin [x-coordinate] [y-coordinate] .SH DESCRIPTION .I Wlogin (for window-login) is intended to be used as an alternative to /etc/getty for logging into the system console on the AT&T UNIX-PC/3B1/7300. When run from /etc/inittab, .I wlogin puts up a moveable 24 x 80 character login window using a reduced size font. Multiple instances of .I wlogin are possible in the inittab, allowing simultaneous logins in separate, overlapping windows. /etc/utmp is properly updated so .I who and .I ps will correctly note users and processes in different windows. Screen-oriented programs such as .I vi behave properly using the standard console s4 termcap. .SH USAGE .I Wlogin must be run from /etc/inittab. It may be called with two optional arguments, which are the x and y coordinates of the .I upper left-hand corner of the login window. In order to obtain a full 24 x 80 window, the value of x must be in the range 0 to 200 and the value of y must be from 0 to 20. Values outside this range will result in a truncated window. If no arguments are given, x and y default to 0 and 0. .I Wlogin may be used to replace /etc/getty on /dev/window or in conjunction with it. The resulting window will be titled with the line name, and an appropriate entry will also be added to the window manager's menu. Windows may be selected in the customary way using either the mouse or Susp/Rsume keys. .bp The following entries in /etc/inittab would spawn 3 overlapping .I wlogin windows: .nf v1:2:respawn:/etc/wlogin 0 0 v2:2:respawn:/etc/wlogin 100 10 _v3:2:respawn:/etc/wlogin 200 20 ^ | Important Note! The first column in these inttab entries must be blank or problems may result due to shell scripts which modify /etc/inittab! .fi The labels "v1", "v2" and "v3" in the example above are arbitrary - any desired id may be used as long as it is unique. Before it puts up the login prompt, .I wlogin will display the file .I /etc/wlog if it is present. This file serves the same purpose as /etc/issue does for getty, and allows a different message to be displayed on the system console than the tty ports. After displaying the the login "banner" .I wlogin transfers control to /bin/login via the EXECL(2) system call. The reduced-size font file /usr/lib/wfont/122.ft must be present for .I wlogin to work. .I Wlogin works equally well with or without ua, smgr, wmgr, ph and getty. .SH FILES .nf /etc/inittab - controlling file /bin/login - standard login program /etc/wlog - console login message /etc/utmp - who's on the system /etc/wtmp - who was on the system /dev/w? - console windows /etc/passwd - password file /usr/lib/wfont/122.ft - reduced size (122 x 28) font /etc/.fontload - default system fonts .fi .SH BUGS .I Wlogin can spawn a window overlapping the top "status line" on the screen, but if it is moved below this line with the mouse, it cannot be returned to its original position. It isn't possible to spawn or move a window into the bottom 4 screen lines, which are reserved for command prompts and function key labels. .bp .SH SEE ALSO login(1M), init(1M), issue(4) .SH AUTHOR .nf Boyd Ostroff ostroff@oswego.Oswego.EDU cboard!ostroff@natasha.oswego.edu .fi \End\Of\Shar\ else echo "will not over write ./wlogin.1m" fi if `test ! -s ./Makefile` then echo "writing ./Makefile" cat > ./Makefile << '\End\Of\Shar\' # Makefile for WLOGIN, a windowed getty replacement for the UNIX-PC include $(MAKEINC)/Makepre.h CFLAGS= -O OBJ = wlogin.o DOC = >wlogin.doc all: $(OBJ) $(LD) $(LDFLAGS) $(SHAREDLIB) $(OBJ) -o wlogin strip wlogin uudecode font.uuenc nroff -man wlogin.1m $(DOC) install: cp wlogin /etc chown root /etc/wlogin chgrp bin /etc/wlogin chmod 700 /etc/wlogin cp 122.ft /usr/lib/wfont chown root /usr/lib/wfont/122.ft chgrp sys /usr/lib/wfont/122.ft chmod 644 /usr/lib/wfont/122.ft clean: rm wlogin.o rm wlogin rm 122.ft include $(MAKEINC)/Makepost.h \End\Of\Shar\ else echo "will not over write ./Makefile" fi if `test ! -s ./wlogin.c` then echo "writing ./wlogin.c" cat > ./wlogin.c << '\End\Of\Shar\' /* ======================================================================== */ /* wlogin.c - run /bin/login in a small 24 x 80 bordered window */ /* ======================================================================== */ /* this program must be run from /etc/inittab as follows: */ /* */ /* v2:2:respawn:/etc/wlogin xxx yyy */ /* */ /* where xxx and yyy are the x & y coords of the upper left-hand */ /* corner of the window. If x and y are omitted, they default to 0 0 */ /* */ /* The file /usr/lib/wfont/122.ft must be present for this program to work */ /* ======================================================================== */ /* by Boyd Ostroff (ostroff@oswego.Oswego.EDU) 6/7/89 */ /* This program may be freely distributed and modified as desired */ /* Inspired by Andy Fyfe's window.c program */ /* Thanks to Muhammad S. Benten for posting the small font */ /* ======================================================================== */ #include <stdio.h> #include <fcntl.h> #include <sys/font.h> #include <sys/window.h> main(argc,argv) int argc; char *argv[]; { int x, y; x = (argc > 1) ? atoi(argv[1]) : 0; y = (argc > 1) ? atoi(argv[2]) : 0; mkwindow(x,y); /* create the window */ login(); /* display login banner and exec /bin/login */ exit(1); /* we won't make it this far unless an error occurs */ } mkwindow(x,y) /* open a window, set its size, font and name */ int x, y; { struct uwdata wnd; struct utdata txt; struct ufdata fnt; char *ttyname(); int fd; if ((fd = open("/dev/window", O_RDWR)) < 0) exit(1); wnd.uw_x = x; wnd.uw_y = y; wnd.uw_width = 482; wnd.uw_height = 240; if (ioctl(fd,WIOCSETD, &wnd) < 0) exit(1); fnt.uf_slot = 0; strcpy(fnt.uf_name, "/usr/lib/wfont/122.ft"); if (ioctl(fd,WIOCUFONT, &fnt) < 0) exit(1); /* must do this, but why? */ if (ioctl(fd,WIOCLFONT, &fnt) < 0) exit(1); txt.ut_num = WTXTLABEL; strcpy(txt.ut_text, ttyname(fd)); if (ioctl(fd,WIOCSETTEXT, &txt) < 0) exit(1); txt.ut_num = WTXTUSER; if (ioctl(fd,WIOCSETTEXT, &txt) < 0) exit(1); close(1); /* assign stdout and stderr to new window */ dup(0); close(2); dup(0); } login() /* display the login message and exec /bin/login */ { char username[128]; cat("/etc/wlog"); printf("Login: "); gets(username); execl("/bin/login", "login", username, (char *)0); } cat(filename) /* print the file, if it exists */ char *filename; { FILE *fp; int ch; if ( (fp=fopen(filename, "r")) != NULL) { while ( (ch=getc(fp)) != EOF) putchar(ch); fclose(fp); } } \End\Of\Shar\ else echo "will not over write ./wlogin.c" fi if `test ! -s ./font.uuenc` then echo "writing ./font.uuenc" cat > ./font.uuenc << '\End\Of\Shar\' begin 644 122.ft M !C@ &"@@ &"P#W!@ "^@$( _@& M ,( P,"^ 8 Q %" 'X!@ ##@0* ?@& ,6! @!^ 8 R(%" 'X!@ #*@$# M _@& ,R PD"^ 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"0 ) D !@ ' D "0 ) D !P ! $ #@ ) M D "0 ) X " ( T P ! $ 0 ! X 0 " 0 " ' ( @ / ( M @ " ( # ) D "0 ) D #@ 1 !$ $0 * H ! 1 !4 %0 5 H "@ 1 M H ! $ H $0 1 !$ "@ * 0 ! $ , #P $ 0 @ " \ " $ 0 M! # 0 ! $ @ 0 ! $ 0 ! 0 ! $ 0 ! $ @ " ( # " B ( @ ! !( %0 ) #\ /P _ #\ /P _ #\ /P _ #\ /P$ end \End\Of\Shar\ else echo "will not over write ./font.uuenc" fi echo "Finished archive 1 of 1" exit -- David H. Brierley Home: dave@galaxia.newport.ri.us; Work: dhb@quahog.ssd.ray.com Send comp.sources.3b1 submissions to comp-sources-3b1@galaxia.newport.ri.us %% Can I be excused, my brain is full. **