Window starter program

norman yarvin yarvin-norman at CS.Yale.EDU
Mon Mar 12 13:03:00 AEST 1990


This is the first and probably the last version of "wind", a program for the
Unix PC.  Wind is meant for people who find themselves using the User Agent
solely to start up new shell windows.  Wind maintains a window at the top of
the screen, into which the user types commands.

These commands allow the user to run any program in a new window of any size
and position.  Aliases are provided to automate common commands, and can be
set up in a ".windrc" file.

Wind can also be run in non-interactive mode, where it just starts up a
single process.

Some things I have found useful:

- Use the 36x102 font, if your eyes can stand it.  This gives you 37x102
lines on the largest window you can create.  (the extra line comes from
munching 2/3 of the status line.)

- Use most of the screen for a main window, but leave 6 pixels of unused
space on the right side of the screen.  (text with the 36x102 font wouldn't
use these anyway.)  Then create other, smaller, windows which are mostly
hidden under the main window, but project out into this unused space.  All
windows can then be selected using the mouse only.  The sample .windrc file
includes aliases for windows set up this way.

Specifically for wind:

- Don't run smgr.  Wind needs some place to keep its window; the place that
used to be smgr is ideal.  Smgr can be replaced by cron, update, and
errdemon (the last written by Mike Ditto, probably available from osu-cis).
Wind's window can be placed anywhere on the screen, so this is not essential.

- Make sure the environment variables LINES, COLUMNS, and TERMCAP are
exported to wind.  Also, wind will propagate whatever terminal I/O settings
are on in the window where it was created; if you run wind from your .profile
then an stty in the .profile will propagate.

#--------------------------------CUT HERE-------------------------------------
#! /bin/sh
#
# This is a shell archive.  Save this into a file, edit it
# and delete all lines above this comment.  Then give this
# file to sh by executing the command "sh file".  The files
# will be extracted into the current directory owned by
# you with default permissions.
#
# The files contained herein are:
#
# -rw-r--r--  1 norman  people     2132 Mar 11 02:28 README 
# -rw-r--r--  1 norman  people     1569 Mar 11 02:29 alias.c 
# -rw-r--r--  1 norman  people     1145 Mar 11 02:29 config.h 
# -rw-r--r--  1 norman  people     2728 Mar 11 02:29 edit.c 
# -rw-r--r--  1 norman  people     1256 Mar 11 02:29 execute.c 
# -rw-r--r--  1 norman  people     1440 Mar 11 02:29 internal.c 
# -rw-r--r--  1 norman  people      349 Mar 11 02:29 makefile 
# drwxr-xr-x  2 norman  people      160 Mar 10 20:15 mice/
# -rw-r--r--  1 norman  people     1245 Mar 11 02:29 mouse.c 
# -rw-r--r--  1 norman  people     1282 Mar 11 02:29 mouse.h 
# -rw-r--r--  1 norman  people     2743 Mar 11 02:29 parse.c 
# -rw-r--r--  1 norman  people     9145 Mar 11 02:29 wind.1 
# -rw-r--r--  1 norman  people     2962 Mar 11 02:29 wind.c 
# -rw-r--r--  1 norman  people     4105 Mar 11 02:29 windops.c 
# -rw-r--r--  1 norman  people      896 Mar 10 20:16 .windrc 
# -rw-r--r--  1 norman  people      753 Mar 10 23:41 .windrc2 
# -rw-r--r--  1 norman  people      123 Mar 10 20:15 mice/fighter.m 
# -rw-r--r--  1 norman  people      590 Mar 10 20:15 mice/moron.m 
# -rw-r--r--  1 norman  people      146 Mar 10 20:15 mice/mouse.m 
# -rw-r--r--  1 norman  people     1061 Mar 10 20:15 mice/series.m 
# -rw-r--r--  1 norman  people      214 Mar 10 20:15 mice/small.m 
# -rw-r--r--  1 norman  people      480 Mar 10 20:15 mice/target.m 
# -rw-r--r--  1 norman  people     1056 Mar 10 20:15 mice/target2.m 
# -rw-r--r--  1 norman  people      659 Mar 10 20:15 mice/unix.m 
#
echo 'x - README'
if test -f README; then echo 'shar: not overwriting README'; else
sed 's/^X//' << '________This_Is_The_END________' > README
XThis is the first and probably the last version of "wind", a program for the
XUnix PC.  Wind is meant for people who find themselves using the User Agent
Xsolely to start up new shell windows.  Wind maintains a window at the top of
Xthe screen, into which the user types commands.
X
XThese commands allow the user to run any program in a new window of any size
Xand position.  Aliases are provided to automate common commands, and can be
Xset up in a ".windrc" file.
X
XWind can also be run in non-interactive mode, where it just starts up a
Xsingle process then exits.
X
XSome things I have found useful:
X
X- Use the 36x102 font, if your eyes can stand it.  This gives you 37x102
Xlines on the largest window you can create.  (the extra line comes from
Xmunching 2/3 of the status line.)
X
X- Use most of the screen for a main window, but leave 6 pixels of unused
Xspace on the right side of the screen.  (text with the 36x102 font wouldn't
Xuse these anyway.)  Then create other, smaller, windows which are mostly
Xhidden under the main window, but project out into this unused space.  All
Xwindows can then be selected using the mouse only.  The sample .windrc file
Xincludes aliases for windows set up this way.
X
X- Don't run smgr.  Wind needs some place to keep its window; the place that
Xused to be smgr is ideal.  Smgr can be replaced by cron, update, and
Xerrdemon (the last written by Mike Ditto, probably available from osu-cis).
XWind's window can be placed anywhere on the screen, so this is not essential.
X
X- Make sure the environment variables LINES, COLUMNS, and TERMCAP are
Xexported to wind.  Also, wind will propagate whatever terminal I/O settings
Xare on in the window where it was created; if you run wind from your .profile
Xthen an stty in the .profile will propagate.
X
XI include two sample .windrc files: the first is the one I use, and is
Xintended for the 36x102 font; the other is for the standard 24x80 font.  I
Xalso include several mouse files.
X
XTo set up wind, modify config.h and the makefile as you desire then run
Xmake.  A manual page is included in the file "wind.1".  It can be displayed
Xwith the command "nroff -man wind.1".
________This_Is_The_END________
if test `wc -c < README` -ne 2132; then
	echo 'shar: README was damaged during transit (should have been 2132 bytes)'
fi
fi		; : end of overwriting check
echo 'x - alias.c'
if test -f alias.c; then echo 'shar: not overwriting alias.c'; else
sed 's/^X//' << '________This_Is_The_END________' > alias.c
X/*
X* alias.c -- for "wind", a Unix PC window starter
X*/
X
X#include <sys/pte.h>
X#include <stdio.h>
X#include "config.h"
X
Xstruct alias {				/* a binary tree of aliases */
X	struct alias *gt, *lt;
X	char *alias, *text;
X};
X
Xchar *alloc();
Xchar shmac[80]=SHMAC;
X
Xstruct alias **afind(s)			/* find an alias, or a place */
Xchar *s;				/* to put a new alias */
X{
X	static struct alias *head=NULL;	
X	struct alias **al;
X	int i;
X
X	for(al=&head; *al; ) {
X		if(!(i=strcmp(s,(*al)->alias)))
X			break;
X		al = i<0 ? &(*al)->lt : &(*al)->gt;
X	}
X	return al;
X}
X
Xchar *alias(s)				/* find text given alias */
Xchar *s;
X{
X	char *strcpy();
X	struct alias *a;
X	static char abuf[256];
X
X	return (a=*afind(s)) ? strcpy(abuf,a->text) : NULL;
X}
X
Xchar *mkalias(alias,text)		/* make an alias */
Xchar *alias,*text;
X{
X	struct alias **a;
X
X	if(*alias=='!' && alias[1]==0)		/* is it for shell macro? */
X		strcpy(shmac,text);
X	a=afind(alias);
X	if(!*a) {				/* does it exist already? */
X		*a=(struct alias *)alloc(sizeof(struct alias));
X		(*a)->alias=alloc(strlen(alias)+1);
X		strcpy((*a)->alias,alias);
X	}
X	(*a)->text=alloc(strlen(text)+1);
X	strcpy((*a)->text,text);
X}
X
Xchar *alloc(n)		/* fast allocator for objects not to be unallocated */
X{
X	static char *brk=0, *ubrk;		/* brk is actual breakpoint,*/
X	register char *oldubrk;			/* ubrk is simulated */
X	register int size;
X	char *sbrk();
X
X	n+=1;						/* word align */
X	n&=0xfffffffe;
X	size=(n/BYTES_PER_PAGE+1)*BYTES_PER_PAGE;
X	if(!brk)
X		brk=(ubrk=sbrk(size))+size;
X	if(ubrk+n >= brk){
X		brk+=size;
X		sbrk(size);
X	}
X	oldubrk=ubrk;
X	ubrk+=n;
X	return oldubrk;
X}
________This_Is_The_END________
if test `wc -c < alias.c` -ne 1569; then
	echo 'shar: alias.c was damaged during transit (should have been 1569 bytes)'
fi
fi		; : end of overwriting check
echo 'x - config.h'
if test -f config.h; then echo 'shar: not overwriting config.h'; else
sed 's/^X//' << '________This_Is_The_END________' > config.h
X/*
X* config.h -- configuration file for "wind", a Unix PC window starter.
X*/
X
X/*
X* If SMGR is defined, wind will designate itsself the "screen manager".
X* The <Msg> key is always sent to the screen manager.  When command receives
X* <Msg>, it runs an alias.  The initial text of that alias is SHMAC,
X* defined below:
X*/
X
X#define SMGR
X#define SHMAC	"/bin/ksh"		/* invoked when <Msg> is pressed */
X
X/*
X* Wind can be told to use the shell to interpret commands.  It gets the name
X* of the shell from the environment variable SHELL.  The default shell is
X* defined below.
X*/
X
X#define SHELL	"/bin/ksh"		/* for command lines beginning with '!' */
X
X/*
X* Wind starts out with a default mouse.  Two mouse arrays are included; one
X* mouse has the normal "pointer" shape, and is smaller (and, in my opinion,
X* better formed) than the system mouse.  The other mouse array is for a
X* default mouse which is a gunsight-like crosshair.
X*/
X
X/*#define M_SMALL				/* small mouse */
X					/* --OR-- */
X#define M_TARGET			/* crosshair */
X
X/*
X* In interactive mode, wind keeps a history buffer.  This is its size.
X*/
X
X#define HISTSIZE	20		/* size of history buffer */
________This_Is_The_END________
if test `wc -c < config.h` -ne 1145; then
	echo 'shar: config.h was damaged during transit (should have been 1145 bytes)'
fi
fi		; : end of overwriting check
echo 'x - edit.c'
if test -f edit.c; then echo 'shar: not overwriting edit.c'; else
sed 's/^X//' << '________This_Is_The_END________' > edit.c
X/*
X* edit.c -- for "wind", a Unix PC window starter.
X*/
X
X#include <sys/window.h>
X#include "config.h"
X
Xextern char shmac[];
Xextern struct utdata utdata;
X
Xchar *getcmd()
X{
X	static char cmdhist[HISTSIZE][80];	/* assume initialized to 0 */
X	static int lastcmd=0;			/* position of last command */
X	static char *cmd=utdata.ut_text;
X	char c;
X	int offset, first=1, histoffset=0;
X	register char *cmdp,*cp1,*cp2;
X
X	utdata.ut_num=WTXTCMD;
X	for(*(cmdp=cmd)=0; ; ){
X		if(*cmdp) {
X			*cmdp|=0x80;	/* highlight current position */
X			ioctl(0,WIOCSETTEXT,&utdata);
X			*cmdp&=0x7f;	/* remove highlight */
X		} else {
X			*cmdp=' '|0x80;
X			cmdp[1]=0;
X			ioctl(0,WIOCSETTEXT,&utdata);
X			*cmdp=0;
X		}
X		read(0, &c, 1);
X		if(first) {
X			first=0;
X			error("");
X			utdata.ut_num=WTXTCMD;
X		}
X		c&=0x7f;				/* strip 8th bit */
X		switch(c) {
X			case 0x01:	/* ^a: to beginning of line */
X				cmdp=cmd;
X				break;
X			case 0x02:	/* ^b: non-destructive backspace */
X				if(cmdp<=cmd)
X					break;
X				cmdp--;
X				break;
X			case 0x04:	/* ^d: delete next character */
X				if(!*cmdp) {
X					if(cmdp==cmd)
X						return 0;
X					break;
X				}
X				cp2=cmdp;
X				for(cp1=cp2++; *cp1++=*cp2++; );
X				break;
X			case 0x05:	/* ^e: end of line */
X				while(*cmdp)
X					cmdp++;
X				break;
X			case 0x06:	/* ^f: forward a character */
X				if(!*cmdp)
X					break;
X				cmdp++;
X				break;
X			case 0x08:	/* ^h: backspace */
X			case 0x7f:	/* delete */
X				if(cmdp<=cmd)
X					break;
X				cp2=cmdp--;
X				for(cp1=cmdp; *cp1++=*cp2++; );
X				break;
X			case 0x0b:	/* ^k: kill to end of line */
X				*cmdp=0;
X				break;
X			case 0x10:	/* ^p: previous history line */
X				histoffset+=(HISTSIZE-2);
X			case 0x0e:	/* ^n: next history line */
X				cp1=cmdhist[(lastcmd + ++histoffset)%HISTSIZE];
X				if(*cp1) {
X					cmdp=cmd;
X					while(*cmdp++=*cp1++);
X					cmdp--;
X				}
X				break;
X			case 0x15:	/* ^u: kill line */
X				*(cmdp=cmd)=0;
X				break;
X			case 0x1a:	/* ^z (Msg): copy macro, return */
X				if(!*shmac) {
X					ioctl(0,WIOCSELECT);
X					break;
X				}
X				for(cp1=shmac,cmdp=cmd; *cmdp++=*cp1++; );
X			case 0x0d:	/* ^m: return */
X				if(*cmd)
X					strcpy(cmdhist[lastcmd++%HISTSIZE],
X						cmd);
X				return cmd;
X			case 0x00:	/* ^~ */
X			case 0x03:	/* ^c */
X			case 0x07:	/* ^g */
X			case 0x0a:	/* ^j */
X			case 0x0c:	/* ^l: redraw */
X			case 0x0f:	/* ^o */
X			case 0x11:	/* ^q */
X			case 0x12:	/* ^r */
X			case 0x13:	/* ^s */
X			case 0x14:	/* ^t */
X			case 0x16:	/* ^v */
X			case 0x17:	/* ^w */
X			case 0x18:	/* ^x */
X			case 0x19:	/* ^y */
X				break;
X			case 0x09:	/* ^i: tab inserted as space */
X				c=' ';
X			default:	/* insert it */
X				for(cp1=cmdp; *cp1; cp1++);
X				if(cp1>=cmd+(WTXTLEN-2))
X					break;
X				cp2=cp1++;
X				for(; cp1>cmdp; *cp1--=*cp2--);
X				*cmdp++=c;
X		}
X	}
X}
________This_Is_The_END________
if test `wc -c < edit.c` -ne 2728; then
	echo 'shar: edit.c was damaged during transit (should have been 2728 bytes)'
fi
fi		; : end of overwriting check
echo 'x - execute.c'
if test -f execute.c; then echo 'shar: not overwriting execute.c'; else
sed 's/^X//' << '________This_Is_The_END________' > execute.c
X/*
X* execute.c -- for "wind", a Unix PC window starter.
X*/
X
X#include <errno.h>
X#include <signal.h>
X
Xchar *path;
X
Xexecute(argv)
Xchar **argv;
X{
X	char file[128], *file2=file, *str;
X	register char *pathp, *filep, *oldpp;
X
X	signal(SIGCLD,SIG_DFL);			/* /bin/sh wants this */
X	if(strchr(*argv,'/')) {
X		execv(*argv, argv);
X		file2=*argv;
X		goto err;			/* the goto statement */
X	}					/* -- accept no substitutes */
X	for(oldpp=pathp=path; ; pathp++) {
X		if(*pathp==':' || !*pathp) {
X			for(filep=file; oldpp<=pathp; *filep++=*oldpp++);
X			filep[-1]='/';
X			strcpy(filep,*argv);
X			execv(file,argv);
Xerr:			switch(errno) {
X				case ENOENT:
X				case ENOTDIR:
X				case EACCES:
X				case ENOEXEC:
X					str=": can't exec that\n";
X					if(file2==file)
X						if(*pathp)
X							continue;
X						else {
X							str=": not found\n";
X							file2=*argv;
X						}
X					break;
X				case ETXTBSY:
X			str=": somebody's writing to that -- try later\n";
X					break;
X				case ENOMEM:
X					str=": insufficient memory\n";
X					break;
X				case E2BIG:
X			str=": argument list too big.  That's weird.\n";
X					break;
X				case EFAULT:
X				default:
X					str=": It's dead Jim\n";
X					break;
X			}
X			write(2,file2,strlen(file2));
X			write(2,str,strlen(str));
X			sleep(1);
X			_exit(0);
X		}
X	}
X}
________This_Is_The_END________
if test `wc -c < execute.c` -ne 1256; then
	echo 'shar: execute.c was damaged during transit (should have been 1256 bytes)'
fi
fi		; : end of overwriting check
echo 'x - internal.c'
if test -f internal.c; then echo 'shar: not overwriting internal.c'; else
sed 's/^X//' << '________This_Is_The_END________' > internal.c
X/*
X* internal.c -- for "wind", a Unix PC window starter.
X*/
X
X#include <errno.h>
X
Xint wreset(), readmouse(), cd(), source(), fontsize();
X
Xstruct internal{
X	char *name;
X	int (*func)();
X} internals[] = {
X	{ "cd", cd },
X	{ "fontsize", fontsize },
X	{ "mouse", readmouse },		/* add functions in sorted order */
X	{ "self", wreset },			 /* and change INTERNALS */
X	{ "source", source }
X};
X
X#define INTERNALS	4
X
Xinternal(argv)
Xchar **argv;
X{
X	struct internal *top, *bot, *mid;
X	int i;
X
X	top=internals;					/* binary search */
X	bot=internals+(INTERNALS-1);
X	while(top<bot) {
X		mid=top+((bot-top)>>1);
X		if(!(i=strcmp(*argv,mid->name))) {
X			top=mid;
X			break;
X		}
X		if(i<0)
X			bot=mid;
X		else
X			top=mid+1;
X	}
X	if(strcmp(*argv,top->name))
X		return 0;
X	(*top->func)(argv);
X	return 1;
X}
X
Xextern char *home;
Xextern int errno;
X
Xcd(argv)
Xchar **argv;
X{
X	if(chdir(argv[1] ? argv[1] : home))
X		switch(errno) {
X			case ENOTDIR: error("Not a directory"); break;
X			case ENOENT: error("Doesn't exist -- try again");
X				break;
X			case EACCES: error("Trying to break security again?");
X				break;
X			default: error("It's dead Jim.");
X		}
X}
X
Xextern int char_vs, char_hs;
X
Xfontsize(argv)
Xchar **argv;
X{
X	int vs,hs;
X
X	if(!argv[1] || !argv[2]) {
X		error("Usage: fontsize vs hs");
X		return;
X	}
X	if(!((vs=getint(argv[1]-1)) && (hs=getint(argv[2]-1)))) {
X	       error("Arguments to fontsize must be integers greater than 0");
X		return;
X	}
X	char_vs=vs;
X	char_hs=hs;
X}
________This_Is_The_END________
if test `wc -c < internal.c` -ne 1440; then
	echo 'shar: internal.c was damaged during transit (should have been 1440 bytes)'
fi
fi		; : end of overwriting check
echo 'x - makefile'
if test -f makefile; then echo 'shar: not overwriting makefile'; else
sed 's/^X//' << '________This_Is_The_END________' > makefile
X#
X# Makefile for "wind", a Unix PC window starter.
X#
X
XCC=shcc
XCFLAGS=-g
XDEST=/usr/local/bin
XOBJS=edit.o wind.o alias.o windops.o parse.o internal.o mouse.o execute.o
X
Xwind: $(OBJS)
X	$(CC) $(CCFLAGS) -o wind ${OBJS}
X
Xmouse.o: mouse.h config.h
X
Xparse.o alias.o windops.o edit.o: config.h
X
Xinstall:
X	su root -c "chown root.root wind ; mv wind $(DEST)"
________This_Is_The_END________
if test `wc -c < makefile` -ne 349; then
	echo 'shar: makefile was damaged during transit (should have been 349 bytes)'
fi
fi		; : end of overwriting check
echo mkdir mice
mkdir mice
echo 'x - mouse.c'
if test -f mouse.c; then echo 'shar: not overwriting mouse.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mouse.c
X/*
X* mouse.c -- for "wind", a Unix PC window starter
X*/
X
X#include "mouse.h"
X
Xextern int shot;
X
Xreadmouse(argv)
Xchar **argv;
X{
X	int fd;
X	char buf[1500];
X	register char *bp=buf, *end;
X	register int i;
X	unsigned short *data, *dend;
X
X	if(!argv[1]) {
X		error("Usage: mouse file");
X		return;
X	}
X	if((fd=open(argv[1],0)) == -1){
X		error("Can't open mouse data file");
X		return;
X	}
X	bp[read(fd,bp,1500)]=0;
X	close(fd);
X	m_icon.ic_fc.fc_hs=32;				/* clear icon */
X	m_icon.ic_fc.fc_vs=32;
X	m_icon.ic_fc.fc_ha=0;
X	m_icon.ic_fc.fc_va=0;
X	for(dend=(data=m_icon.ic_raster)+64; data<dend; data++)
X		*data=0;
X	for(; *bp; bp++) {			/* get icon parameters */
X		if(*bp=='h') {
X			if(*++bp=='s')
X				m_icon.ic_fc.fc_hs=getint(bp+1);
X			else
X				m_icon.ic_fc.fc_ha=getint(bp+1);
X		} else if(*bp=='v') {
X			if(*++bp=='s')
X				m_icon.ic_fc.fc_vs=getint(bp+1);
X			else
X				m_icon.ic_fc.fc_va=getint(bp+1);
X		}
X		if(*bp=='d') {
X			while(*bp++ != '\n');
X			break;
X		}
X	}
X	for(data=m_icon.ic_raster, i=1; data<dend&&*bp;){
X		if(*bp=='\n') {
X			data += (dend-data)%2 || m_icon.ic_fc.fc_hs<=16 ?
X				1 : 2;
X			i=1;
X			bp++;
X			continue;
X		}
X		if(i >= 1<<16) {
X			i=1;
X			data++;
X		}
X		if(*bp++ != ' ')
X			*data|=i;
X		i<<=1;
X	}
X	if(shot)
X		ioctl(0, WIOCSETMOUSE, &umdata);
X}
________This_Is_The_END________
if test `wc -c < mouse.c` -ne 1245; then
	echo 'shar: mouse.c was damaged during transit (should have been 1245 bytes)'
fi
fi		; : end of overwriting check
echo 'x - mouse.h'
if test -f mouse.h; then echo 'shar: not overwriting mouse.h'; else
sed 's/^X//' << '________This_Is_The_END________' > mouse.h
X/*
X* mouse.h -- for "wind", a Unix PC window starter
X*/
X
X#include <sys/window.h>
X#include <sys/font.h>
X#include "config.h"
X
Xstruct icon m_icon = {
X	0,				/* flags (unused)		*/
X	{				/* font def			*/
X#ifdef M_SMALL
X		16,			/* horizontal size in bits	*/
X		13,			/* vertical size		*/
X		0,			/* horizontal adjust (signed)	*/
X		0,			/* vertical adjust (signed)	*/
X#endif
X#ifdef M_TARGET
X		32, 21, -15, -10,
X#endif
X		0,			/* horizontal increment		*/
X		0,			/* vertical increment (optional)*/
X		0	/* relative mini-raster pointer (not for icons) */
X	},
X	{				/* raster data			*/
X#ifdef M_SMALL
X		0x1,0x2,0xc,0x3c,0xf8,0x3f8,0xff8,0x1f0,0x330,0x610,0xc00,
X			0x1800,0x3000
X#endif
X#ifdef M_TARGET
X	0x000f,	0x7800,	0x0001,	0x4000,	0x0001,	0x4000,	0x0001,	0x4000,	
X	0x0000,	0x0000,	0x0000,	0x0000,	0x8000,	0x0000,	0x8000,	0x0000,	
X	0x8000,	0x0000,	0x8000,	0x0000,	0x7e00,	0x003f,	0x8000,	0x0000,	
X	0x8000,	0x0000,	0x8000,	0x0000,	0x8000,	0x0000,	0x0000,	0x0000,	
X	0x0000,	0x0000,	0x0001,	0x4000,	0x0001,	0x4000,	0x0001,	0x4000,	
X	0x000f,	0x7800
X#endif
X	}
X};
X
Xstruct umdata umdata = {
X	MSICON,				/* wakeup flags			*/
X	0,				/* motion rectangle x		*/
X	0,				/* motion rectangle y		*/
X	0,				/* motion rectangle w		*/
X	0,				/* motion rectangle h		*/
X	&m_icon				/* ptr to icon if MSICON=1	*/
X};
________This_Is_The_END________
if test `wc -c < mouse.h` -ne 1282; then
	echo 'shar: mouse.h was damaged during transit (should have been 1282 bytes)'
fi
fi		; : end of overwriting check
echo 'x - parse.c'
if test -f parse.c; then echo 'shar: not overwriting parse.c'; else
sed 's/^X//' << '________This_Is_The_END________' > parse.c
X/*
X* parse.c -- for "wind", a Unix PC window starter.
X*/
X
X#include <sys/window.h>
X#include <stdio.h>
X#include "config.h"
X
Xextern struct uwdata uwdata;		/* set here, used in window.h */
Xextern char *shell;			/* from environment, or the default */
X
X#define BEGIN	0x00			/* states of command line parser */
X#define BLANK	0x01
X#define BLANK0	0x02
X#define PARAM	0x03
X#define WPARAM	0x04
X
Xchar *argv[40];
X
Xchar **parse(cmd)
Xchar *cmd;
X{
X	register char **argvp=argv, *cmdp, c;
X	register int state=BEGIN;
X	int first=1;
X	char *alias(), *cmdp2=NULL;
X	char *temp;
X
X	for(cmdp=cmd; ; cmdp++) {
X		if(!(c=*cmdp))
X			if(cmdp2) {
X				if(!(c=*(cmdp=cmdp2)))
X					c='#';
X				cmdp2=NULL;
X			} else
X				c='#';
X		switch(state) {
X			case BEGIN:			/* we start here */
X				if(c=='[') {
X					state=WPARAM;
X					break;
X				}
X			case BLANK0:	/* processing first set of blanks */
X				if(c=='!') {
X					argv[0]=shell;
X					argv[1]="-c";
X					argv[2]=cmdp+1;
X					argv[3]=NULL;
X					return argv;
X				}
X			case BLANK:	/* we're processing blanks */
X				if(c==' ')
X					break;
X				if(c=='#')
X					goto finish;
X				state=PARAM;
X				*argvp++=cmdp;
X				break;
X			case PARAM:	/* we're processing a parameter */
X				if(c!=' ' && c!='#')
X					break;
X				*cmdp=0;
X				if(first) {
X					first=0;
X					if(temp=alias(*argv)) {
X						*(cmdp2=cmdp)=c;
X						cmdp=temp-1;
X						argvp=argv;
X						state=BEGIN;
X						break;
X					}
X				}
X				else if(argvp==argv+2 &&
X						!strcmp(*argv,"alias")) {
X					mkalias(argv[1],c=='#' ? "" : ++cmdp);
X					return NULL;
X				}
X				if(c=='#')
X					goto finish;
X				state=BLANK;
X				break;
X			case WPARAM:  /* we're processing window parameters */
X				switch(c) {	
X				case 'x' : uwdata.uw_x      = getint(cmdp);
X					break;
X				case 'y' : uwdata.uw_y      = getint(cmdp);
X					break;
X				case 'w' : uwdata.uw_width  = getint(cmdp);
X					break;
X				case 'h' : uwdata.uw_height = getint(cmdp);
X					break;
X				case 'b' : uwdata.uw_uflags ^= NBORDER;
X					break;
X				case 'v' : uwdata.uw_uflags ^= VCWIDTH;
X					break;
X				case 'u' : uwdata.uw_uflags ^= BORDVSCROLL;
X					break;
X				case 's' : uwdata.uw_uflags ^= BORDHSCROLL;
X					break;
X				case 'e' : uwdata.uw_uflags ^= BORDHELP;
X					break;
X				case 'c' : uwdata.uw_uflags ^= BORDCANCEL;
X					break;
X				case 'r' : uwdata.uw_uflags ^= BORDRESIZE;
X					break;
X				case 'm' : uwdata.uw_uflags ^= NBORDMOVE;
X					break;
X				case '-' : uwdata.uw_uflags = NBORDER; break;
X				case '#' : return NULL;
X				case ']' : state=BLANK0;
X				}
X				break;
X		}
X	}
Xfinish:
X	*argvp=NULL;
X	return argv;
X}
X
Xgetint(s)			/* find whatever integer there is in s+1 */
Xchar *s;
X{
X	register int i=0;
X	int neg=0;
X
X	if(s[1] == '-'){
X		neg=1;
X		s++;
X	}
X	while(*++s>='0' && *s<='9') {
X		i*=10;
X		i+=*s-'0';
X	}
X	return neg ? -i : i;
X}
________This_Is_The_END________
if test `wc -c < parse.c` -ne 2743; then
	echo 'shar: parse.c was damaged during transit (should have been 2743 bytes)'
fi
fi		; : end of overwriting check
echo 'x - wind.1'
if test -f wind.1; then echo 'shar: not overwriting wind.1'; else
sed 's/^X//' << '________This_Is_The_END________' > wind.1
X.TH WIND 1 LOCAL
X.SH NAME
Xwind \- Unix PC window opener / process starter
X.SH SYNOPSIS
Xwind
X.TP
Xwind command
X.TP
Xwind -c [x#y#w#h#bvusecrm-] [ = | ? ]
X.SH DESCRIPTION
X.I Wind
Xis a general-purpose program to open windows and run processes in them.
XWind has two modes: interactive mode and single-command mode.
XInteractive mode is entered by running wind with no arguments.
XIn interactive mode,
Xwind first executes commands from the file
X.B .windrc
Xin the user's home directory (given by the environment variable HOME).  Then
Xwind repeatedly reads (see EDITING below) and executes commands from the
Xscreen.  In single-command mode, wind takes the first argument as a
Xcommand to be executed, then exits.
X.PP
XIf invoked with the argument
X.B -c,
Xwind changes window parameters in the following manner.  It reads the window
Xparameters of the window on the standard input (normally the current
Xwindow).  Then it changes the internally stored window parameters according
Xto the command line.  Arguments on the command line are taken as new window
Xparameters (see WINDOW PARAMETERS below).  Additionally, the argument 
X.B ?
Xwill print out the position and size of the window after modifications, and
Xthe argument 
X.B =
Xwill print out the values that the environment variables
XLINES, COLUMNS, and TERMCAP should take to reflect the current screen size.
X.B ?
Xor
X.B =
Xshould be the last argument.
XIf neither
X.B ?
Xnor
X.B =
Xis specified, the window parameters of the window on the standard output
X(normally the current window) are changed.
X.PP
X.SH EDITING
XIn interactive mode, the command line is displayed on the bottom of the
Xscreen as it is typed in.  Printable characters typed in are inserted at the
Xcursor position; in addition, the following emacs style editing keys are
Xrecognized:
X.PP
X.PD 0
X.TP 10
X.BI ^a
Xgo to beginning of line
X.PP
X.TP 10
X.BI ^b
Xgo backward a character
X.PP
X.TP 10
X.BI ^d
Xdelete next character
X.PP
X.TP 10
X.BI ^e
Xgo to end of line
X.PP
X.TP 10
X.BI ^f
Xgo forward a character
X.PP
X.TP 10
X.BI ^h
Xor
X.BI delete
Xdelete previous character
X.PP
X.TP 10
X.BI ^k
Xkill to end of line
X.PP
X.TP 10
X.BI ^n
Xcopy next history line into current line
X.PP
X.TP 10
X.BI ^p
Xcopy previous history line into current line
X.PP
X.TP 10
X.BI ^m (Return)
Xexecute command line
X.PP
X.TP 10
X.BI ^u
Xkill line
X.PP
X.TP 10
X.BI ^z
X.PP
X.TP 10
X.BI <Msg>
Xexecute shell alias (see below)
X.PD
X.PP
XWind designates itsself the "system manager window", unless compiled without
Xthat option (compile-time options are set in config.h).  The only effect
Xthis has is that the <Msg> key is always sent to the wind window, without
Xregard to which window is currently active.  When wind reads the Msg key, it
Xexecutes a special alias called the shell alias (see the description of the
Xalias internal command.).  If the shell alias is blank (zero length),
Xpressing Msg makes the command window the current window.
X.PP
XIf ^d is pressed when there is no text on the command line, then wind
Xexits.
X.SH COMMANDS
XA command consists of the following: an optional set of window parameters,
Xenclosed in brackets (
X.B [
Xand
X.B ]
X), a program name, then an optional list of blank-separated parameters to be
Xpassed to the program.  Alternatively, if the first character of the program
Xname is
X.B !
X,then the remainder of the command line is executed by the shell.
XThe name of the shell is taken from the environment variable SHELL;
Xif that variable does not exist, the shell defined at compile-time
X(in the header file
X.I config.h
X) is used.
XNormally one does not need to use the shell.  Not using the shell is also
Xfaster.
X.SH WINDOW PARAMETERS
XWind keeps a set of window parameters (user window data; see window(7)).
XThis set is used to make all new windows.  Each time window parameters are
Xincluded in a command, each command line window parameter overwrites the
Xcorresponding current window parameter.  These window parameters control the
Xsize, position, and various other aspects of the windows.  The window
Xparameters, as well as the terminal i/o parameters (which wind cannot alter),
Xare initialized from the window in which wind starts up.  If wind does not
Xstart up in a window, it opens /dev/window and gets the default parameters
Xfrom there.
X.PP
XWindow parameter specifications are any of the following, where 
X.I #
Xdenotes an integer:
X.PP
X.PD 0
X.TP 10
X.BI x#
Xset x coordinate of the upper left hand window corner to #
X.PP
X.TP 10
X.BI y#
Xset y coordinate of the upper left hand window corner to #
X.PP
X.TP 10
X.BI w#
Xset width of the window to #
X.PP
X.TP 10
X.BI h#
Xset height of the window to #
X.PP
X.TP 10
X.BI b
Xtoggle window border flag
X.PP
X.TP 10
X.BI v
Xtoggle window variable character spacing flag
X.PP
X.TP 10
X.BI u
Xtoggle window vertical scroll icon flag
X.PP
X.TP 10
X.BI s
Xtoggle window horizontal scroll icon flag
X.PP
X.TP 10
X.BI e
Xtoggle window help icon flag
X.PP
X.TP 10
X.BI c
Xtoggle window cancel icon flag
X.PP
X.TP 10
X.BI r
Xtoggle window resize icon flag
X.PP
X.TP 10
X.BI m
Xtoggle window border move flag
X.PD
X.PP
XOther characters are ignored.
X.SH INTERNAL COMMANDS
XA program name is either the name of an internal command, or a full
Xpath name of an executable file (not a shell script).  There are
Xfive internal commands in wind v1.0: they are as follows:
X.PP
X.B mouse mfile
X.sp
XWind keeps a current mouse icon, used in the same way as the current
Xwindow parameters.  The "mouse" internal command reads in a new mouse from
Xfile 
X.I mfile.  Mfile
Xmust be organized in the following fashion: a set of mouse parameters, then
Xthe word "data" (actually, just a "d" will do) followed by a newline, then a
Xcharacter bitmap.  Mouse parameters are one of:
X.PP
X.PD 0
X.TP 10
X.BI hs
Xfor horizontal size
X.PP
X.TP 10
X.BI vs
Xfor vertical size
X.PP
X.TP 10
X.BI ha
Xfor horizontal adjust
X.PP
X.TP 10
X.BI va
Xfor vertical adjust
X.PD
X.PP
Xfollowed by a single space, then an integer.  A character bitmap is up to 32
Xlines of up to 32 characters each: for every non-blank character, the
Xcorresponding pixel is turned on.  In a non-interactive invocation of wind,
Xmouse also sets the current window's mouse.
X.PP
X.B self
X.sp
XThis command resets the wind window to the current window parameters and the
Xcurrent mouse.
X.PP
X.B alias aname atext
X.sp
XThis command sets the alias aname to the value atext.  Thereafter, if aname
Xis used as a program name, aname will be replaced with atext on the command
Xline.  If aname is "!", then the alias is also designated the "shell alias",
Xand is executed immediately whenever <Msg> is pressed (see EDITING)
X.PP
X.B cd directory
X.sp
XThis command changes the working directory of wind to
X.I directory.
X.PP
X.B source file
X.sp
XThis command causes wind to read
X.I file,
Xand execute each line of the file as a wind command.
X.PP
X.B fontsize vs hs
X.sp
XAfter this command is executed, any future programs that wind executes will
Xhave environment variables set up for a font
X.I vs
Xpixels high and
X.I hs
Xpixels wide.
X.SH EXECUTION
XIf a program name is not an internal command, it is assumed to be the name
Xof an executable file in some directory specified in the environment
Xvariable PATH.  This file is found and is executed in its own window.  The
Xwindow that is created has the following attributes.  Its size and shape are
Xgiven by the current window parameters.  Its mouse is the current mouse.
XIts terminal I/O settings are those of the window in which wind was
Xinvoked.  The environment variables LINES, COLUMNS, and TERMCAP are set to
Xthe appropriate values for the new window's size.  These variables are only
Xset if they already were present in the environment.  The new window ceases
Xto exist on termination of the program.  In interactive mode, wind executes
Xall programs 'in the background':  that is, it does not wait for them to
Xterminate before seeking a new command.
X.SH EXAMPLES
XExamples of commands issued in interactive mode:
X.sp
Xalias w10 [x6 y210 w714 h80]
X.br
Xw10 !find . -print | xargs ls -l | more ; sleep 3
X.sp
XThis uses the "w10" alias, which designates a 10x102 window near the bottom
Xof the screen.  The
X.B !
Xat the beginning of the command tells wind to send the rest of the line to
Xthe shell, which runs the command.
X.sp
Xmouse /usr/local/lib/mice/strange.m
X.sp
XThis reads a new current mouse from /usr/local/lib/mice/strange.m.
X.sp
XLdriver
X.sp
XThis runs the program /usr/bin/Ldriver, a ua-style loadable device driver
Xcontrol program.  After Ldriver finishes, its window disappears.
X.PP
XExamples of single-command mode:
X.sp
X$ wind "[x160 w560 y16 h192]jove greed.tex" &
X.sp
XThis runs the command "jove greed.tex" in a new window with the specified
Xsize and position; the original shell continues.
X.sp
X$ wind -c - x160 w560 y16 h192
X.sp
XThis, when uttered to the shell, changes the current window to be a
Xborderless 80x24 window in the upper right-hand corner of the screen.
X.sp
X$ wind -c h200 </dev/w1 >/dev/w2
X.sp
XThis changes the window parameters of window 1 to be the parameters of window 2.
X.sp
X$ wind "mouse /dev/null"
X.sp
XThis makes the mouse of the current window blank.
X.sp
X$ wind wind
X.sp
XThis runs wind in interactive mode in a new window.
X.SH AUTHOR
XNorman Yarvin, currently yarvin-norman at cs.yale.edu.
XBug reports are welcome, but don't expect a fast response.
________This_Is_The_END________
if test `wc -c < wind.1` -ne 9145; then
	echo 'shar: wind.1 was damaged during transit (should have been 9145 bytes)'
fi
fi		; : end of overwriting check
echo 'x - wind.c'
if test -f wind.c; then echo 'shar: not overwriting wind.c'; else
sed 's/^X//' << '________This_Is_The_END________' > wind.c
X/*
X*   _______
X*  |       |	WARNING: DO NOT ATTEMPT TO ALTER THIS PROGRAM.  EXPOSED HIGH
X*  |   /   |	VOLTAGE.  NO USER-SERVICEABLE PARTS INSIDE.  THIS PROGRAM IS TO
X*  |  /__  |	BE SERVICED ONLY BY PROPERLY QUALIFIED SERVICE PERSONNEL.
X*  |    /  |	CONSULT THE SERVICE MANUAL FOR PROPER SERVICE PROCEDURES TO
X*  |   /   |	ASSURE CONTINUED COMPLIANCE WITH PERFOMANCE STANDARDS.
X*   -------
X*
X* wind.c -- main routine of Unix PC window starter demon.
X*
X* Written by Norman Yarvin (yarvin at cs.yale.edu)
X* No copyright.
X*
X*/
X
X#include <fcntl.h>
X#include <signal.h>
X#include <stdio.h>
X#include <sys/window.h>
X
Xextern struct uwdata uwdata;
Xextern struct umdata umdata;
Xint initfd;					/* .cmdrc file descriptor */
X
Xmain(argc,argv)
Xint argc;
Xchar **argv;
X{
X	char *strcpy(), *strcat(), *envinit(), *getcmd(), *initgetcmd(),
X		initfile[128], *home;
X
X	home=envinit();	/* get $HOME, set envp up for passing screen size */
X	wgetdefaults();
X	oneshot(argc,argv);		/* perform one function, then exit? */
X	wsetup();				/* set up wind window */
X	strcpy(initfile, home);				/* open .cmdrc */
X	strcat(initfile, "/.windrc");
X	signal(SIGCLD,SIG_IGN);				/* no zombies */
X	if((initfd=open(initfile,O_RDONLY)) != -1) {
X		process(initgetcmd);		/* initgetcmd reads .cmdrc */
X		close(initfd);
X	}
X	process(getcmd);		/* getcmd reads from keyboard */
X	wunsetup();
X}
X
Xsource(argv)
Xchar **argv;
X{
X	if(!argv[1]) {
X		error("Usage: source <file>");
X		return;
X	}
X	if((initfd=open(argv[1],O_RDONLY)) != -1) {
X		process(initgetcmd);
X		close(initfd);
X	} else
X		error("couldn't open file for source");
X}
X
Xprocess(getcmd)
Xchar *(*getcmd)();
X{
X	char *cmd, **argv;
X	char **parse();
X
X	while(cmd=(*getcmd)()) {
X		if((argv=parse(cmd)) && *argv && !internal(argv))
X			switch(fork()){
X				case -1:
X					error("too many processes");
X				default:
X					break;
X				case 0:
X					wmake(cmd);
X					execute(argv);
X			}
X	}
X}
X
Xchar *initgetcmd()
X{
X	static char buf[BUFSIZ], cmd[256];
X	static int size, bp=BUFSIZ;
X	register char c, *cmdp;
X
X	cmdp=cmd;
X	while((size = bp==BUFSIZ ? (bp=0,read(initfd,buf,BUFSIZ)) : size)
X			!= bp) {
X		c=buf[bp++];
X		*cmdp++ = c=='\t' ? ' ' : c;		/* tab -> space */
X		if(c=='\n' || cmdp-cmd>254) {
X			cmdp[-1]=0;
X			return cmd;
X		}
X	}
X	return 0;
X}
X
Xint shot=0;
X
Xoneshot(argc,argv)
Xchar **argv;
X{
X	char **argv2;
X
X	if(argc<2)
X		return;
X	shot=1;
X	if(!strcmp(argv[1],"-c")) {
X		chwind(argc,argv+1);
X		_exit(0);
X	}
X	if((argv2=parse(argv[1])) && *argv2 && !internal(argv2)) {
X		wmake(argv[1]);
X		execute(argv2);
X	}
X	_exit(0);
X}
X
Xchwind(argc,argv)
Xchar **argv;
X{
X	char wbuf[256],c=0,*wbp;
X	extern char lines[], columns[], *termcap;
X
X	wbp=wbuf;
X	*wbp++='[';
X	while(--argc && (c=**++argv) != '=' && c != '?') {
X		while(*wbp++=*((*argv)++));
X		--wbp;
X	}
X	parse(wbuf);
X	if(c=='=') {
X		setsize();
X		printf("%s %s %s\n", lines, columns, termcap);
X	} else if(c=='?') {
X		printf("x%d y%d h%d w%d\n", uwdata.uw_x, uwdata.uw_y,
X			 uwdata.uw_height, uwdata.uw_width);
X	} else
X		ioctl(1,WIOCSETD,&uwdata);
X}
________This_Is_The_END________
if test `wc -c < wind.c` -ne 2962; then
	echo 'shar: wind.c was damaged during transit (should have been 2962 bytes)'
fi
fi		; : end of overwriting check
echo 'x - windops.c'
if test -f windops.c; then echo 'shar: not overwriting windops.c'; else
sed 's/^X//' << '________This_Is_The_END________' > windops.c
X/*
X* window.c -- for "wind", a Unix PC window starter.
X*/
X
X#include <stdio.h>
X#include <sys/window.h>				/* all comments in here */
X#include <fcntl.h>
X#include <termio.h>
X#include "config.h"
X
Xstruct uwdata uwdata;				/* window size/shape */
Xstruct utdata utdata;
Xextern struct umdata umdata;		/* mouse icon -- see mouse.[ch] */
X
Xchar termcapd[9][40]={	"TERMCAP=:al=\\E[1L:am:bs:cd=\\E[0J:ce=\\E[0",
X			"K:cl=\\E[2J\\E[H:cm=\\E[%i%2;%2H:dc=\\E[1P:d",
X			"l=\\E[1M:do=\\E[B:ei=:ho=\\E[H:ic=\\E[1@:im=",
X			":kb=\\10:kd=\\E[B:kl=\\E[D:kr=\\E[C:ku=\\E[A:",
X			"k1=\\EOc:k2=\\EOd:k3=\\EOe:k4=\\EOf:k5=\\EOg:",
X			"k6=\\EOh:k7=\\EOi:k8=\\EOj:nd=\\E[C:se=\\E[m:",
X			"so=\\E[7m:ue=\\E[m:up=\\E[A:us=\\E[4m:EE=\\E[",
X			"m:DS=\\E[2m:CV=\\E[=C:CI=\\E[=1C:KM=/usr/li",
X			"b/ua/kmap.s4:li#000:co#000:"
X};
Xchar *termcap=*termcapd; /* if you change these, change the #defines below */
Xchar lines[]="LINES=000";
Xchar columns[]="COLUMNS=000";
Xint char_vs, char_hs;
X
X#define TERMCAP_XPOS	343		/* locations in the strings */
X#define TERMCAP_YPOS	336
X#define LINES_YPOS	6
X#define COLUMNS_XPOS	8
X
Xchar *path="", *home, *shell=SHELL;			/* $PATH, $HOME */
Xstruct termio termio;
Xextern int shot;
X
Xchar *envinit()
X{
X	extern char **environ;
X	char **envp;
X
X	for(envp=environ;*envp;envp++) {
X		if(!strncmp(*envp,lines,5))
X			*envp=lines;
X		if(!strncmp(*envp,columns,7))
X			*envp=columns;
X		if(!strncmp(*envp,termcap,7))
X			*envp=termcap;
X		if(!strncmp(*envp,"HOME=",5))
X			home=*envp+5;
X		if(!strncmp(*envp,"PATH=",5))
X			path=*envp+5;
X		if(!strncmp(*envp,"SHELL=",6))
X			shell=*envp+6;
X	}
X	return home;
X}
X
Xwgetdefaults()
X{
X	int fd;
X
X	if(fdgetdefaults(0)) {
X		fd=open("/dev/tty",O_RDWR);
X		if(fdgetdefaults(fd)) {
X			close(fd);
X			fd=open("/dev/window",O_RDWR);
X			fdgetdefaults(fd);
X		}
X		close(fd);
X	}
X	char_vs=uwdata.uw_vs;
X	char_hs=uwdata.uw_hs;
X}
X
Xfdgetdefaults(fd)
Xint fd;
X{
X	return ioctl(fd,TCGETA,&termio) == -1 || ioctl(fd,WIOCGETD,&uwdata) == -1;
X}
X
Xwsetup()			/* wind window initialization routine */
X{
X	struct termio cmdtermio;
X
X	ioctl(0, WIOCSETMOUSE, &umdata);
X	if(shot)
X		return;
X#ifdef SMGR
X	ioctl(0, WIOCSYS, SYSSMGR);	/* make wind the system manager */
X#endif
X	strcpy(utdata.ut_text,"wind");		/* name window "wind" */
X	utdata.ut_num = WTXTLABEL;
X	ioctl(0, WIOCSETTEXT, &utdata);	
X	memcpy(&cmdtermio, &termio, sizeof(struct termio));
X 	cmdtermio.c_lflag = 0;				/* raw mode */
X 	cmdtermio.c_iflag = 0;			/* don't fuck with input */
X 	cmdtermio.c_oflag = 0;			/* don't fuck with output */
X	cmdtermio.c_cc[4] = 1;			/* one character read */
X	cmdtermio.c_cc[5] = 0;				/* no timeout */
X	ioctl(0, TCSETA, &cmdtermio);
X	write(1, "\33[2J\33[H\33[=1C", 12);
X}					/* clear screen, turn off cursor */
X
Xwreset()
X{
X	wsetup();
X	ioctl(0, WIOCSETD, &uwdata);
X}
X
Xwunsetup()
X{
X	ioctl(0, TCSETA, &termio);
X	write(1, "\33[2J\33[H\33[=0C", 12);
X}					/* clear screen, turn on cursor */
X
Xwmake(s)
Xchar *s;
X{
X	register int wd;
X
X	close(0);
X	close(1);
X	close(2);
X	setpgrp();
X	wd = open("/dev/window", O_RDWR);
X	dup(wd);
X	dup(wd);
X	setsize();
X	utdata.ut_num=WTXTLABEL;
X	strcpy(utdata.ut_text, s);
X	ioctl(wd, WIOCSETTEXT, &utdata);
X	ioctl(wd, WIOCSETD, &uwdata);
X	ioctl(wd, WIOCSETMOUSE, &umdata);
X	ioctl(wd, TCSETA, &termio);
X}
X
Xsetsize()
X{
X	register int i;
X
X	i = uwdata.uw_x + uwdata.uw_width - 720;
X	if(i>0)
X		uwdata.uw_width -= i;
X	i = uwdata.uw_y + uwdata.uw_height - 300;
X	if(i>0)
X		uwdata.uw_height -= i;
X	i = uwdata.uw_height/char_vs;
X	termcap[TERMCAP_YPOS] = lines[LINES_YPOS] = i/100 + '0';
X	termcap[TERMCAP_YPOS+1] = lines[LINES_YPOS+1] = (i/10)%10 + '0';
X	termcap[TERMCAP_YPOS+2] = lines[LINES_YPOS+2] = i%10 + '0';
X	i = uwdata.uw_width/char_hs;
X	termcap[TERMCAP_XPOS] = columns[COLUMNS_XPOS] = i/100 + '0';
X	termcap[TERMCAP_XPOS+1] = columns[COLUMNS_XPOS+1] = (i/10)%10 + '0';
X	termcap[TERMCAP_XPOS+2] = columns[COLUMNS_XPOS+2] = i%10 + '0';
X}
X
Xextern int shot;
X
Xerror(s)		/* put s in "prompt" line -- clobbers cmd/argv */
Xchar *s;
X{
X	if(shot) {
X		register char *s2;
X
X		for(s2=s;*s2++;);
X		s2[-1]='\n';
X		write(2,s,s2-s);
X		_exit(0);
X	}
X	strcpy(utdata.ut_text,s);
X	utdata.ut_num=WTXTPROMPT;
X	ioctl(0,WIOCSETTEXT,&utdata);
X}
________This_Is_The_END________
if test `wc -c < windops.c` -ne 4105; then
	echo 'shar: windops.c was damaged during transit (should have been 4105 bytes)'
fi
fi		; : end of overwriting check
echo 'x - .windrc'
if test -f .windrc; then echo 'shar: not overwriting .windrc'; else
sed 's/^X//' << '________This_Is_The_END________' > .windrc
X# move to top of screen
X#
X[x300 y0 w350 h12]self
Xalias s0 [x300 y0 w350 h12]self
X#
X# k-shell aliases
X#
Xalias k0 [x0 y4 w714 h296]/bin/ksh
Xalias k1 [x0 y12 w714 h288]/bin/ksh
Xalias k2 [x8 y20 w700 h232]/bin/ksh
Xalias ka [x0 y16 w150 h192]/bin/ksh
Xalias k80 [x160 w560 y16 h192]/bin/ksh
Xalias k90 [x90 w630 y16 h192]/bin/ksh
Xalias k10 [x6 y210 w714 h80]/bin/ksh
Xalias k5 [x6 y256 w714 h40]/bin/ksh
X#
X# window aliases
X#
Xalias w0 [x0 y4 w714 h296]
Xalias w1 [x0 y12 w714 h288]
Xalias w2 [x4 y20 w700 h232]
Xalias wa [x0 y16 w150 h192]
Xalias w80 [x160 w560 y16 h192]
Xalias w90 [x90 w630 y16 h192]
Xalias w10 [x6 y210 w714 h80]
Xalias w5 [x6 y256 w714 h40]
X#
X# window arrangement for decompiling 
X#
Xalias c0 [x0 y4 h298 w250]/bin/ksh
Xalias c1 [x270 y8 h200 w450]/bin/ksh
Xalias c2 [x270 y212 h88 w450]/bin/ksh
X#
X# program aliases
X#
Xalias ksh /bin/ksh
Xalias isn /usr/bin/phdial 3385340
X#
X# run a k-shell
X#
Xk0
________This_Is_The_END________
if test `wc -c < .windrc` -ne 896; then
	echo 'shar: .windrc was damaged during transit (should have been 896 bytes)'
fi
fi		; : end of overwriting check
echo 'x - .windrc2'
if test -f .windrc2; then echo 'shar: not overwriting .windrc2'; else
sed 's/^X//' << '________This_Is_The_END________' > .windrc2
X# .windrc2 -- command initialization file for normal font
X#
X# move to top of screen
X#
X[x288 y0 w40 h12]self
Xalias s0 [x300 y0 w350 h12]self
X#
X# k-shell aliases
X#
Xalias k60 [x180 w540 y8 h180]/bin/ksh	# a 15x60 window
Xalias k8 [x0 y200 w720 h96]/bin/ksh	# a 8x80 window
Xalias k0 [x0 y0 w720 h300]/bin/ksh	# a 25x80 window
Xalias k1 [x0 y12 w708 h288]/bin/ksh	# a 24x79 window
Xalias k2 [x0 y12 w720 h288]/bin/ksh	# a standard 24x80 window
X#
X# window aliases
X#
Xalias w60 [x180 w540 y8 h180]		# a 15x60 window
Xalias w8 [x0 y200 w720 h96]		# a 8x80 window
Xalias w0 [x0 y0 w720 h300]		# a 25x80 window
Xalias w1 [x0 y12 w708 h288]		# a 24x79 window
Xalias w2 [x0 y12 w720 h288]		# a standard 24x80 window
X#
X# make two not completely overlapping windows
X#
Xw60
Xw1
________This_Is_The_END________
if test `wc -c < .windrc2` -ne 753; then
	echo 'shar: .windrc2 was damaged during transit (should have been 753 bytes)'
fi
fi		; : end of overwriting check
echo 'x - mice/fighter.m'
if test -f mice/fighter.m; then echo 'shar: not overwriting mice/fighter.m'; else
sed 's/^X//' << '________This_Is_The_END________' > mice/fighter.m
Xvs 14
Xdata
X#
X ##
X  ###
X   ######
X   ##########
X   ########
X    ######
X    #######
X    ##  ####
X    #    #####
X         ##
X
________This_Is_The_END________
if test `wc -c < mice/fighter.m` -ne 123; then
	echo 'shar: mice/fighter.m was damaged during transit (should have been 123 bytes)'
fi
fi		; : end of overwriting check
echo 'x - mice/moron.m'
if test -f mice/moron.m; then echo 'shar: not overwriting mice/moron.m'; else
sed 's/^X//' << '________This_Is_The_END________' > mice/moron.m
Xdata
XH  H EEEE L   L    OO
XH  H E    L   L   O  O
XHHHH EEE  L   L   O  O
XH  H E    L   L   O  O
XH  H EEEE LLL LLL  OO
X
XM   M  OO  RRR   OO  N  N
XMM MM O  O R  R O  O NN N
XM M M O  O RRR  O  O N NN
XM   M O  O R R  O  O N  N
XM   M  OO  R  R  OO  N  N
X
X GGG  OO    FFFF U  U  CC K  K
XG    O  O   F    U  U C   K K
XG GG O  O   FFF  U  U C   KK
XG  G O  O   F    U  U C   K K
X GG   OO    F     UU   CC K  K
X
XY   Y  OO  U  U RRR
X Y Y  O  O U  U R  R
X  Y   O  O U  U RRR
X  Y   O  O U  U R R
X  Y    OO   UU  R  R
X
X SSS EEEE L   FFFF
XS    E    L   F
X SS  EEE  L   FFF
X   S E    L   F
XSSS  EEEE LLL F
________This_Is_The_END________
if test `wc -c < mice/moron.m` -ne 590; then
	echo 'shar: mice/moron.m was damaged during transit (should have been 590 bytes)'
fi
fi		; : end of overwriting check
echo 'x - mice/mouse.m'
if test -f mice/mouse.m; then echo 'shar: not overwriting mice/mouse.m'; else
sed 's/^X//' << '________This_Is_The_END________' > mice/mouse.m
Xdata
X ##########
X#          #
X# ## ## ## #
X# ## ## ## #
X# ## ## ## #
X# ## ## ## #
X#          #
X#          #
X#          #
X#          #
X ##########
________This_Is_The_END________
if test `wc -c < mice/mouse.m` -ne 146; then
	echo 'shar: mice/mouse.m was damaged during transit (should have been 146 bytes)'
fi
fi		; : end of overwriting check
echo 'x - mice/series.m'
if test -f mice/series.m; then echo 'shar: not overwriting mice/series.m'; else
sed 's/^X//' << '________This_Is_The_END________' > mice/series.m
Xdata
X#                               
X #                              
X  ##                            
X  ##                            
X    ##                          
X    ##                          
X      ###                       
X      ###                       
X      ###                       
X         ####                   
X         ####                   
X         ####                   
X         ####                   
X             ######             
X             ######             
X             ######             
X             ######             
X             ######             
X             ######             
X                   #############
X                   #############
X                   #############
X                   #############
X                   #############
X                   #############
X                   #############
X                   #############
X                   #############
X                   #############
X                   #############
X                   #############
X                   #############
________This_Is_The_END________
if test `wc -c < mice/series.m` -ne 1061; then
	echo 'shar: mice/series.m was damaged during transit (should have been 1061 bytes)'
fi
fi		; : end of overwriting check
echo 'x - mice/small.m'
if test -f mice/small.m; then echo 'shar: not overwriting mice/small.m'; else
sed 's/^X//' << '________This_Is_The_END________' > mice/small.m
Xdata
X#               
X #             
X  ##           
X  ####         
X   #####        
X   #######      
X   #########
X    #####       
X    ##  ##      
X    #    ##     
X          ##    
X           ##
X            ##
________This_Is_The_END________
if test `wc -c < mice/small.m` -ne 214; then
	echo 'shar: mice/small.m was damaged during transit (should have been 214 bytes)'
fi
fi		; : end of overwriting check
echo 'x - mice/target.m'
if test -f mice/target.m; then echo 'shar: not overwriting mice/target.m'; else
sed 's/^X//' << '________This_Is_The_END________' > mice/target.m
Xvs 19
Xvi -9
Xhi -15
Xdata
X               #
X               #
X           #########
X         ##         ##
X       ##             ##
X      #                 #
X     #         #         #
X    #          #          #
X    #          #          #
X#####     ###########     #####
X    #          #          #
X    #          #          #
X     #         #         #
X      #                 #
X       ##             ##
X         ##         ##
X           #########
X               #
X               #
________This_Is_The_END________
if test `wc -c < mice/target.m` -ne 480; then
	echo 'shar: mice/target.m was damaged during transit (should have been 480 bytes)'
fi
fi		; : end of overwriting check
echo 'x - mice/target2.m'
if test -f mice/target2.m; then echo 'shar: not overwriting mice/target2.m'; else
sed 's/^X//' << '________This_Is_The_END________' > mice/target2.m
X####                       #### 
X#                             # 
X#                             # 
X#                             # 
X                                
X                                
X               #                
X               #                
X               #                
X               #                
X         ###### ######          
X               #                
X               #                
X               #                
X               #                
X                                
X                                
X#                             # 
X#                             # 
X#                             # 
X####                       #### 
X                                
X                                
X                                
X                                
X                                
X                                
X                                
X                                
X                                
X                                
X                                
________This_Is_The_END________
if test `wc -c < mice/target2.m` -ne 1056; then
	echo 'shar: mice/target2.m was damaged during transit (should have been 1056 bytes)'
fi
fi		; : end of overwriting check
echo 'x - mice/unix.m'
if test -f mice/unix.m; then echo 'shar: not overwriting mice/unix.m'; else
sed 's/^X//' << '________This_Is_The_END________' > mice/unix.m
Xdata
X#
X ##
X  ####
X   #####
X    ## ###
X    ###  ###
X     ###  ####
X     ###    ####
X     ###  #  #####
X     ###      ######
X     ###   #   ######
X    ####        #######
X   ####     #    #######
X  ########################
X ##########################
X                          ##
X #   #  #    #  #  #    # ###
X #   #  ##   #  #   #  #  ####
X #   #  # #  #  #    ##   ####
X #   #  #  # #  #    ##   #####
X #   #  #   ##  #   #  #  #####
X  ###   #    #  #  #    # ######
X
X ####   #   #  #     ####   ###
X #   #  #   #  #     #     #
X #   #  #   #  #     ###    ###
X ####   #   #  #     #         #
X #  #   #   #  #     #     #   #
X #   #   ###   ####  ####   ###
________This_Is_The_END________
if test `wc -c < mice/unix.m` -ne 659; then
	echo 'shar: mice/unix.m was damaged during transit (should have been 659 bytes)'
fi
fi		; : end of overwriting check
exit 0



More information about the Comp.sys.att mailing list