예제 #1
0
파일: a.c 프로젝트: shattered/dmd-tc630
ripple()
{
	register Point p1, p2;
	register Point inc;
	register Point p;

	while (kbdchar() != 'q') {
		if (P->state & MOVED) {
			P->state &= ~(MOVED|RESHAPED);
			p = sub (Drect.origin, p);
			p1 = add (p1, p);
			p2 = add (p2, p);
			p = Drect.origin;
		}
		else if (P->state & RESHAPED) {
			P->state &= ~RESHAPED;
			p1.x=p2.x=avg(Drect.origin.x, Drect.corner.x);
			p1.y=p2.y=avg(Drect.origin.y, Drect.corner.y);
			inc.x=1;
			inc.y=1;
			rectf(&display, Drect, F_XOR);
			p = Drect.origin;
		}
		rectf(&display, canon(p1, p2), F_XOR);
		if (p1.x==Drect.origin.x || p1.x==Drect.corner.x) {
			inc.x= -inc.x;
		}
		if (p1.y==Drect.origin.y || p1.y==Drect.corner.y) {
			inc.y= -inc.y;
		}
		p1 = sub (p1, inc);
		p2 = add (p2, inc);
		wait (CPU);
	}
}
예제 #2
0
main()
{
	/*
	** temp2 is an uninitialized static variable
	** an is placed in the bss section.
	*/
        static temp2;

	/*
	** Release the host connection. 
	*/
        local();

	/*
	** Put application in the cache and do not
	** initialize the bss section to zero on
	** subsequent invocations.  Note that the
	** bss section is initialized to zero the
	** first time the application runs.
	*/
        cache((char *)0, A_BSS);

        lprintf("\n temp1 = %d, temp2 = %d", temp1, temp2);
        temp1++;
        temp2++;
        lprintf("\n temp1 = %d, temp2 = %d", temp1, temp2);

        /*
        ** Wait for the user to hit a key.
        */
        request(KBD);
        while (kbdchar() == -1) wait(KBD);
}
예제 #3
0
main()
{
	/*
	** Release the host connection. 
	*/
	local();

	/*
	** Make window not reshapable.
	*/
	P->state |= NO_RESHAPE;

	/*
	** Initialize ctob.
	*/
	P->ctob = WindowSize;

	/*
	** Put application in the cache
	** as a shared application.
	*/
        cache((char *)0, A_SHARED);

        lprintf("\n Hello World.");

        /*
        ** Wait for the user to hit a key.
        */
        request(KBD);
        while (kbdchar() == -1) wait(KBD);
}
예제 #4
0
파일: b.c 프로젝트: shattered/dmd-tc630
main()
{
	register Point Min;
	register Point Max;
	register Rectangle r;
	register Point p, q, s;
	register Point inc;

#ifdef DMD630
	local();
#endif
	request(KBD);
	s.x = s.y = SIZE;
	P->state |= RESHAPED;
	while (kbdchar() != 'q') {
		if (P->state & MOVED) {
			q = sub (Drect.origin, q);
			p = add (q, p);
			Max = add (q, Max);
			Min = add (q, Min);
			P->state &= ~(MOVED|RESHAPED);
			q = Drect.origin;
		}
		else if (P->state & RESHAPED) {
			rectf(&display, Drect, F_XOR);
			Min = p = Drect.origin;
			Max = sub (Drect.corner, s);
			inc.x = 1;
			inc.y = 1;
			P->state &= ~RESHAPED;
			q = Drect.origin;
		}
		rectf(&display, Rpt(p, add (p, s)), F_XOR);
		p.x += inc.x;
		if ((p.x >= Max.x) || (p.x <= Min.x))
			inc.x = -inc.x;
		p.y += inc.y;
		if ((p.y >= Max.y) || (p.y <= Min.y))
			inc.y = -inc.y;
		wait(CPU);
	}
}
예제 #5
0
파일: main.c 프로젝트: siebenmann/sam
void
type(Flayer *l, int res)	/* what a bloody mess this is */
{
	Text *t = (Text *)l->user1;
	Rune buf[100];
	Rune *p = buf;
	int c, backspacing;
	long a;
	int scrollkey, upkey;

	scrollkey = 0;
	upkey = 0;
	if(res == RKeyboard) {
		scrollkey = qpeekc()==SCROLLKEY;	/* ICK */
		upkey = qpeekc() == UPKEY;
	}

	if(lock || t->lock){
		kbdblock();
		return;
	}
	a = l->p0;
	if(a!=l->p1 && !scrollkey && !upkey){
		flushtyping(1);
		cut(t, t->front, 1, 1);
		return;	/* it may now be locked */
	}
	backspacing = 0;
	while((c = kbdchar())>0){
		if(res == RKeyboard){
			if(c == UPKEY || c==SCROLLKEY || c==ESC)
				break;
			/* backspace, ctrl-u, ctrl-w, del, ctrl-x */
			if(c=='\b' || c==0x15 || c==0x17 || c==0x7F || c==0x18){
				backspacing = 1;
				break;
			}
		}
		*p++ = c;
		if(c == '\n' || p >= buf+sizeof(buf)/sizeof(buf[0]))
			break;
	}
	if(p > buf){
		if(typestart < 0)
			typestart = a;
		if(typeesc < 0)
			typeesc = a;
		hgrow(t->tag, a, p-buf, 0);
		t->lock++;	/* pretend we Trequest'ed for hdatarune*/
		hdatarune(t->tag, a, buf, p-buf);
		a += p-buf;
		l->p0 = a;
		l->p1 = a;
		typeend = a;
		if(c=='\n' || typeend-typestart>100)
			flushtyping(0);
		onethird(l, a);
	}
	if(c == SCROLLKEY){
		flushtyping(0);
		center(l, l->origin+l->f.nchars+1);
	} else if (c == UPKEY) {
		flushtyping(0);
		outTsll(Torigin, t->tag, l->origin, l->f.maxlines+1);
		/* backspacing immediately after outcmd(): sorry */
	}else if(backspacing && !lock){
		if(l->f.p0>0 && a>0){
			switch(c){
			case '\b':
			case 0x7F:	/* del */
				l->p0 = a-1;
				break;
			case 0x18:	/* ctrl-x */
			case 0x15:	/* ctrl-u */
				l->p0 = ctlu(&t->rasp, l->origin, a);
				break;
			case 0x17:	/* ctrl-w */
				l->p0 = ctlw(&t->rasp, l->origin, a);
				break;
			}
			l->p1 = a;
			if(l->p1 != l->p0){
				/* cut locally if possible */
				if(typestart<=l->p0 && l->p1<=typeend){
					t->lock++;	/* to call hcut */
					hcut(t->tag, l->p0, l->p1-l->p0);
					/* hcheck is local because we know rasp is contiguous */
					hcheck(t->tag);
				}else{
					flushtyping(0);
					cut(t, t->front, 0, 1);
				}
			}
			if(typeesc >= l->p0)
				typeesc = l->p0;
			if(typestart >= 0){
				if(typestart >= l->p0)
					typestart = l->p0;
				typeend = l->p0;
				if(typestart == typeend){
					typestart = -1;
					typeend = -1;
					modified = 0;
				}
			}
		}
	}else{
		if(c==ESC && typeesc>=0){
			l->p0 = typeesc;
			l->p1 = a;
			flushtyping(1);
		}
		for(l=t->l; l<&t->l[NL]; l++)
			if(l->textfn)
				flsetselect(l, l->p0, l->p1);
	}
}
예제 #6
0
main()
{
	int c;
	Titem *titemptr;
	int kbdstart = 0;
		
	/*
	** Release the host connection.
	*/

	local();
	/*
	** Place check mark in menu next to
	** current mode.
	*/
	kbditems[KBD_NORM].icon = &B_checkmark;

	/*
	** Request keyboard and mouse resources.
	*/
	request(KBD | MOUSE);

	/*
	** Main loop of program.
	*/
	while (1) {
		/*
		** Wait on MOUSE, means wait until I'm current.
		** Wait on KBD, means wait until I receive a char.
		*/
		wait(KBD | MOUSE);
		switch(button23()) {
		case 1:		/* button 3 */
			/*
			** Let control process handle
			** button 3.
			*/
			request(KBD);
			sleep(2);
			request(KBD | MOUSE);
			break;
		case 2:		/* button 2 */
			if ((titemptr = tmenuhit(&kbdmenu, 2, 0)) == (Titem *) 0)
				break;
			switch(titemptr->ufield.uval) {
			/*
			** Normal Keyboard processing.
			*/
			case KBD_NORM:
				kbditems[KBD_NORM].icon = &B_checkmark;
				kbditems[KBD_NOTRAN].icon = 0;
				kbditems[KBD_NOPFXPAN].icon = 0;
				kbditems[KBD_NOPADXPAN].icon = 0;
				kbditems[KBD_NOCURXPAN].icon = 0;
				P->state &= ~(NOPFEXPAND | NOCURSEXPAND |
					    NOPADEXPAND | NOTRANSLATE);
				break;
			/*
			** Turn of the normal translation of
			** all keys typed on the keyboard.
			*/
			case KBD_NOTRAN:
				kbditems[KBD_NOTRAN].icon = &B_checkmark;
				kbditems[KBD_NORM].icon = 0;
				kbditems[KBD_NOPFXPAN].icon = 0;
				kbditems[KBD_NOPADXPAN].icon = 0;
				kbditems[KBD_NOCURXPAN].icon = 0;
				P->state |= NOTRANSLATE;
				P->state &= ~(NOPFEXPAND | NOCURSEXPAND |
					    NOPADEXPAND);
				break;
			/*
			** Turn off pf key expansion.
			*/
			case KBD_NOPFXPAN:
				kbditems[KBD_NOPFXPAN].icon = &B_checkmark;
				kbditems[KBD_NORM].icon = 0;
				kbditems[KBD_NOTRAN].icon = 0;
				P->state |= NOPFEXPAND;
				P->state &= ~NOTRANSLATE;
				break;
			/*
			** Turn off expansion of keypad.
			*/
			case KBD_NOPADXPAN:
				kbditems[KBD_NOPADXPAN].icon = &B_checkmark;
				kbditems[KBD_NORM].icon = 0;
				kbditems[KBD_NOTRAN].icon = 0;
				P->state |= NOPADEXPAND;
				P->state &= ~NOTRANSLATE;
				break;
			/*
			** Turn of expansion of cursor keys.
			*/
			case KBD_NOCURXPAN:
				kbditems[KBD_NOCURXPAN].icon = &B_checkmark;
				kbditems[KBD_NORM].icon = 0;
				kbditems[KBD_NOTRAN].icon = 0;
				P->state |= NOCURSEXPAND;
				P->state &= ~NOTRANSLATE;
				break;
			case KBD_EXIT:
				exit();
				break;
			}
		}
		/*
		** display data received from the keyboard.
		*/
		while((c = kbdchar()) != -1) {
			kbdstart=1;
			lprintf("\n hex=0x%x", c);
		}
		if (kbdstart) {
			kbdstart = 0;
			lprintf("\n");
		}
	}
}
예제 #7
0
main()
{
	char buff[100];
	int cn, r, k, t, dt, lp, x, rx, ry;
	int oldx, oldy, newx, newy;
	int offx, offy;
	Point jstring();
	char *getstring();
	Point p;
	int nonstop = NONSTOP;

	local();
	request(MOUSE);
	/* random number seed is derived from position of dmd layer */
	srand(mouse.xy.x);
	request(KBD);
	for ( ;; ) {
		lp = dt = 0;
		if ( nonstop == 0 ) {
			/* ask for lp parameter */
			jmoveto(Pt(0,0));
			p = jstring("loops=");
			lp = getnum(p);
			jmoveto(Pt(0,0));
			jstring("loops=");
		}
		if ( lp < 0 )
			exit();
		if ( lp == 0 )
			lp = rand() % 31 + 1;

		if ( nonstop == 0 ) {
			/* ask for dt parameter */
			jmoveto(Pt(0,0));
			p = jstring("delta=");
			dt = getnum(p);
			jmoveto(Pt(0,0));
			jstring("delta=");
		}
		if ( dt <= 0 )
			dt = rand() % 358 + 1;

		/* clear screen */
		jrectf(Jrect,F_CLR);
		t=0; 
		oldx = offx = XMAX / 2;
		oldy = offy = YMAX / 2;
		cn = 1;
		/* draw rose */
		do {
			t=(t+dt)%360;
			x=(lp*t)%360;
			r = Isin(x);
			rx=muldiv(r,XMAX-1,1024);
			ry=muldiv(r,YMAX-1,1024);
			newx = offx + muldiv(rx,Icos(t),1024) / 2;
			newy = offy +  muldiv(ry,Isin(t),1024) / 2;
			jsegment(Pt(oldx,oldy),Pt(newx,newy),F_STORE);
			oldx=newx; 
			oldy=newy;
			/* give up the CPU every 10 times around */
			if ( cn++ > 10 ) {
				cn = 0;
				sleep(4);
			}
		} while ( t != 0 && (k=kbdchar()) != 'q' ) ;
		if ( nonstop == 1 ) {
			/* in nonstop mode, any key aborts */
			if ( k != -1 )
				exit();
			/* sleep 2 seconds between random patterns */
			sleep(120);
		}
	}
}
예제 #8
0
파일: main.c 프로젝트: carriercomm/legacy
void
type(Flayer *l, int res)	/* what a bloody mess this is */
{
	Text *t = (Text *)l->user1;
	Rune buf[100];
	Rune *p = buf;
	int c, backspacing;
	int32_t a, a0;
	int scrollkey;

	scrollkey = 0;
	if(res == RKeyboard)
		scrollkey = nontypingkey(qpeekc());	/* ICK */

	if(hostlock || t->lock){
		kbdblock();
		return;
	}
	a = l->p0;
	if(a!=l->p1 && !scrollkey){
		flushtyping(1);
		cut(t, t->front, 1, 1);
		return;	/* it may now be locked */
	}
	backspacing = 0;
	while((c = kbdchar())>0){
		if(res == RKeyboard){
			if(nontypingkey(c) || c==ESC)
				break;
			/* backspace, ctrl-u, ctrl-w, del */
			if(c=='\b' || c==0x15 || c==0x17 || c==0x7F){
				backspacing = 1;
				break;
			}
		}
		*p++ = c;
		if(autoindent)
		if(c == '\n'){
			/* autoindent */
			int cursor, ch;
			cursor = ctlu(&t->rasp, 0, a+(p-buf)-1);
			while(p < buf+nelem(buf)){
				ch = raspc(&t->rasp, cursor++);
				if(ch == ' ' || ch == '\t')
					*p++ = ch;
				else
					break;
			}
		}
		if(c == '\n' || p >= buf+sizeof(buf)/sizeof(buf[0]))
			break;
	}
	if(p > buf){
		if(typestart < 0)
			typestart = a;
		if(typeesc < 0)
			typeesc = a;
		hgrow(t->tag, a, p-buf, 0);
		t->lock++;	/* pretend we Trequest'ed for hdatarune*/
		hdatarune(t->tag, a, buf, p-buf);
		a += p-buf;
		l->p0 = a;
		l->p1 = a;
		typeend = a;
		if(c=='\n' || typeend-typestart>100)
			flushtyping(0);
		onethird(l, a);
	}
	if(c==SCROLLKEY || c==PAGEDOWN){
		flushtyping(0);
		center(l, l->origin+l->f.nchars+1);
		/* backspacing immediately after outcmd(): sorry */
	}else if(c==BACKSCROLLKEY || c==PAGEUP){
		flushtyping(0);
		a0 = l->origin-l->f.nchars;
		if(a0 < 0)
			a0 = 0;
		center(l, a0);
	}else if(c == RIGHTARROW){
		flushtyping(0);
		a0 = l->p0;
		if(a0 < t->rasp.nrunes)
			a0++;
		flsetselect(l, a0, a0);
		center(l, a0);
	}else if(c == LEFTARROW){
		flushtyping(0);
		a0 = l->p0;
		if(a0 > 0)
			a0--;
		flsetselect(l, a0, a0);
		center(l, a0);
	}else if(c == HOMEKEY){
		flushtyping(0);
		center(l, 0);
	}else if(c == ENDKEY){
		flushtyping(0);
		center(l, t->rasp.nrunes);
	}else if(c == LINESTART || c == LINEEND){
		flushtyping(1);
		if(c == LINESTART)
			while(a > 0 && raspc(&t->rasp, a-1)!='\n')
				a--;
		else
			while(a < t->rasp.nrunes && raspc(&t->rasp, a)!='\n')
				a++;
		l->p0 = l->p1 = a;
		for(l=t->l; l<&t->l[NL]; l++)
			if(l->textfn)
				flsetselect(l, l->p0, l->p1);
	}else if(backspacing && !hostlock){
		/* backspacing immediately after outcmd(): sorry */
		if(l->f.p0>0 && a>0){
			switch(c){
			case '\b':
			case 0x7F:	/* del */
				l->p0 = a-1;
				break;
			case 0x15:	/* ctrl-u */
				l->p0 = ctlu(&t->rasp, l->origin, a);
				break;
			case 0x17:	/* ctrl-w */
				l->p0 = ctlw(&t->rasp, l->origin, a);
				break;
			}
			l->p1 = a;
			if(l->p1 != l->p0){
				/* cut locally if possible */
				if(typestart<=l->p0 && l->p1<=typeend){
					t->lock++;	/* to call hcut */
					hcut(t->tag, l->p0, l->p1-l->p0);
					/* hcheck is local because we know rasp is contiguous */
					hcheck(t->tag);
				}else{
					flushtyping(0);
					cut(t, t->front, 0, 1);
				}
			}
			if(typeesc >= l->p0)
				typeesc = l->p0;
			if(typestart >= 0){
				if(typestart >= l->p0)
					typestart = l->p0;
				typeend = l->p0;
				if(typestart == typeend){
					typestart = -1;
					typeend = -1;
					modified = 0;
				}
			}
		}
	}else{
		if(c==ESC && typeesc>=0){
			l->p0 = typeesc;
			l->p1 = a;
			flushtyping(1);
		}
		for(l=t->l; l<&t->l[NL]; l++)
			if(l->textfn)
				flsetselect(l, l->p0, l->p1);
	}
}
예제 #9
0
파일: main.c 프로젝트: rennis250/sam
void
type(Flayer *l, int res)	/* what a bloody mess this is */
{
	Text *t = (Text *)l->user1;
	Rune buf[100];
	Rune *p = buf;
	int c, backspacing;
//	long a, a0, a2, ao;
	long a, a0;
	int scrollkey;

	scrollkey = 0;
	if(res == RKeyboard)
		scrollkey = nontypingkey(qpeekc());	/* ICK */

	if(hostlock || t->lock){
		kbdblock();
		return;
	}
	a = l->p0;
	if(a!=l->p1 && !scrollkey){
		flushtyping(1);
		cut(t, t->front, 1, 1);
		return;	/* it may now be locked */
	}
	backspacing = 0;
	while((c = kbdchar())>0){
		if(res == RKeyboard){
			if(nontypingkey(c) || c==ESC)
				break;
			/* backspace, ctrl-u, ctrl-w, del */
			//if(c=='\b' || c==0x15 || c==0x17 || c==0x7F){
			if(c=='\b' || c==0x06 || c==0x17 || c==0x7F || c==0x11){
				backspacing = 1;
				break;
			}
		}
		//*p++ = c;
		if(spacesindent && c == '\t'){
			int i, col, n;
			col = getcol(&t->rasp, a);
			n = maxtab - col % maxtab;
			for(i = 0; i < n && p < buf+nelem(buf); i++)
				*p++ = ' ';
		} else
			*p++ = c;
		if(autoindent)
		if(c == '\n'){
			/* autoindent */
			int cursor, ch;
			cursor = ctlu(&t->rasp, 0, a+(p-buf)-1);
			while(p < buf+nelem(buf)){
				ch = raspc(&t->rasp, cursor++);
				if(ch == ' ' || ch == '\t')
					*p++ = ch;
				else
					break;
			}
		}
		if(c == '\n' || p >= buf+nelem(buf))
			break;
	}
	if(p > buf){
		if(typestart < 0)
			typestart = a;
		if(typeesc < 0)
			typeesc = a;
		hgrow(t->tag, a, p-buf, 0);
		t->lock++;	/* pretend we Trequest'ed for hdatarune*/
		hdatarune(t->tag, a, buf, p-buf);
		a += p-buf;
		l->p0 = a;
		l->p1 = a;
		typeend = a;
		if(c=='\n' || typeend-typestart>100)
			flushtyping(0);
		onethird(l, a);
	}
	if(c==SCROLLKEY || c==PAGEDOWN){
		flushtyping(0);
		center(l, l->origin+l->f.nchars+1);
	}else if(c==BACKSCROLLKEY || c==PAGEUP){
		flushtyping(0);
		a0 = l->origin-l->f.nchars;
		if(a0 < 0)
			a0 = 0;
		center(l, a0);
	}else if(c == RIGHTARROW){
		flushtyping(0);
		a0 = l->p0;
		if(a0 < t->rasp.nrunes)
			a0++;
		flsetselect(l, a0, a0);
		center(l, a0);
	}else if(c == LEFTARROW){
		flushtyping(0);
		a0 = l->p0;
		if(a0 > 0)
			a0--;
		flsetselect(l, a0, a0);
		center(l, a0);
	}else if(c == HOMEKEY){
		flushtyping(0);
		center(l, 0);
	}else if(c == ENDKEY){
		flushtyping(0);
		center(l, t->rasp.nrunes);
	}else if(c == LINESTART || c == LINEEND){
		flushtyping(1);
		if(c == LINESTART)
			while(a > 0 && raspc(&t->rasp, a-1)!='\n')
				a--;
		else
			while(a < t->rasp.nrunes && raspc(&t->rasp, a)!='\n')
				a++;
		l->p0 = l->p1 = a;
		for(l=t->l; l<&t->l[NL]; l++)
			if(l->textfn)
				flsetselect(l, l->p0, l->p1);
	}else if(backspacing && !hostlock){
		/* backspacing immediately after outcmd(): sorry */
		if(l->f.p0>0 && a>0){
			switch(c){
			case '\b':
			case 0x7F:	/* del */
			//case 0x11:	/* del */
			          	//l->p0 = a-1;
			          	l->p0 = del(&t->rasp, l->origin, a);
			          	break;
			case 0x15:	/* ctrl-u */
			//case 0x06:	/* ctrl-f */
			          	l->p0 = ctlu(&t->rasp, l->origin, a);
			          	break;
			case 0x17:	/* ctrl-w */
			          	l->p0 = ctlw(&t->rasp, l->origin, a);
			          	break;
			}
			l->p1 = a;
			if(l->p1 != l->p0){
				/* cut locally if possible */
				if(typestart<=l->p0 && l->p1<=typeend){
					t->lock++;	/* to call hcut */
					hcut(t->tag, l->p0, l->p1-l->p0);
					/* hcheck is local because we know rasp is contiguous */
					hcheck(t->tag);
				}else{
					flushtyping(0);
					cut(t, t->front, 0, 1);
				}
			}
			if(typeesc >= l->p0)
				typeesc = l->p0;
			if(typestart >= 0){
				if(typestart >= l->p0)
					typestart = l->p0;
				typeend = l->p0;
				if(typestart == typeend){
					typestart = -1;
					typeend = -1;
					modified = 0;
				}
			}
		}
	}else{
		if(c==ESC && typeesc>=0){
			l->p0 = typeesc;
			l->p1 = a;
			flushtyping(1);
		}
//		if(c==MID){
//    		flushtyping(1);
//    		a2 = a;
//			while(a2 > 0 && raspc(&t->rasp, a2-1)!='\n')
//				a2--;
//    		if(a2!=t->rasp.nrunes){
//        		a2--;
//        	}
//		    flushtyping(0);
//    		flsetselect(l, a, a);
//    		outTsll(Torigin, t->tag, a2, 1L);
//		}
//		if(c==CWIN){
//            if (inCMD==0) {
//                tp = t;
//                t = &cmd;
//                for(l=t->l; l->textfn==0; l++)
//                    ;
//                current(l);
//                flushtyping(0);
//                a = t->rasp.nrunes;
//                flsetselect(l, a, a);
//                center(l, a);
//                inCMD = 1;
//            } else {
//                for(l=tp->l; l->textfn==0; l++)
//                    ;
//                current(l);
//                flushtyping(0);
//                inCMD = 0;         
//            }
//		}
//        if(c==GFO)
//            sendcmd("<gfo", 4, t);
//        if(c==GFU)
//            sendcmd("<gfu", 4, t);
//        if(c==GI)
//            sendcmd("<gi", 3, t);
//        if(c==GIE)
//            sendcmd("<gie", 4, t);
//        if(c==GIEI)
//            sendcmd("<giei", 5, t);
//        if(c==GP)
//            sendcmd("<gp", 3, t);
//		if(c==MK)
//            sendcmd("!mk", 3, t);
//		if(c==MCO)
//            sendcmd("|mco", 4, t);
//		if(c==MLI)
//            sendcmd(",|mli", 5, t);
//		if(c==MFU)
//            sendcmd("<mfu", 4, t);
//		if(c==UNDO)
//            sendcmd("u", 1, t);
//		if(c==REDO)
//            sendcmd("u-1", 3, t);
//		if(c==ALL)
//            sendcmd(",", 1, t);
//		if(c==MARK)
//            sendcmd("k", 1, t);
//		if(c==GO)
//            sendcmd("'", 1, t);
//		if(c==SEL)
//            sendcmd("',.", 3, t);
//		if(c==SAVE){
//            for(l=t->l; l->textfn==0; l++)
//                ;
//            current(l);
//            flushtyping(0);
//            ao = l->p0;
//            a = t->rasp.nrunes;
//            flsetselect(l, a, a);
//            if(raspc(&t->rasp, a-1)!='\n'){   
//                *p++ = '\n';
//                if(typestart < 0)
//                    typestart = a;
//                if(typeesc < 0)
//                    typeesc = a;
//                hgrow(t->tag, a, p-buf, 0);
//                t->lock++;	/* pretend we Trequest'ed for hdatarune*/
//                hdatarune(t->tag, a, buf, p-buf);
//                a += p-buf;
//            }
//            l->p0 = ao;
//            l->p1 = ao;
//            typeend = ao;
//            flushtyping(0);
//            flsetselect(l, ao, ao);
//            center(l, ao);
//            sendcmd("w", 1, t);
//        }
//		if(c==FMT)
//            sendcmd("|par", 4, t);
//		if(c==FFMT)
//            sendcmd(",|par", 5, t);
//        if(c==WC)
//            sendcmd(">wc", 3, t);
//		if(c==MI)
//            sendcmd("|a+", 3, t);
//		if(c==LI)
//            sendcmd("|a-", 3, t);
//		if(c==RIOEXCH){
//			snarf(t, t->front);
//			outT0(Tstartsnarf);
//			setlock();
//		}
//		if(c==PLUMB){
//			if(hversion > 0)
//				outTsll(Tplumb, t->tag, which->p0, which->p1);
//		}
//		if(c==LOOK){
//			outTsll(Tlook, t->tag, which->p0, which->p1);
//			setlock();
//		}
//		if(c==NEW){
//			sweeptext(1, 0);
//		}
//		if(c==CLOSE){
//			t=(Text *)l->user1;
//			if (t->nwin>1)
//				closeup(l);
//			else if(t!=&cmd) {
//				outTs(Tclose, t->tag);
//				setlock();
//			}
//		}
		for(l=t->l; l<&t->l[NL]; l++)
			if(l->textfn)
				flsetselect(l, l->p0, l->p1);
		switch(c) {
		case CUT:
			flushtyping(0);
			cut(t, t->front, 1, 1);
			break;
		case COPY:
			flushtyping(0);
			snarf(t, t->front);
			break;
		case PASTE:
			flushtyping(0);
			paste(t, t->front);
			break;
		}
	}
}