1*21257Sdist /* 2*21257Sdist * Copyright (c) 1980 Regents of the University of California. 3*21257Sdist * All rights reserved. The Berkeley software License Agreement 4*21257Sdist * specifies the terms and conditions for redistribution. 5*21257Sdist */ 6*21257Sdist 713775Ssam #ifndef lint 8*21257Sdist static char sccsid[] = "@(#)move.c 5.1 (Berkeley) 05/30/85"; 9*21257Sdist #endif not lint 1013775Ssam 1113775Ssam /************************************************************************* 1213775Ssam * 1313775Ssam * MOVE LIBRARY 1413775Ssam * 1513775Ssam * This set of subroutines moves a cursor to a predefined 1613775Ssam * location, independent of the terminal type. If the 1713775Ssam * terminal has an addressable cursor, it uses it. If 1813775Ssam * not, it optimizes for tabs (currently) even if you don't 1913775Ssam * have them. 2013775Ssam * 2113775Ssam * At all times the current address of the cursor must be maintained, 2213775Ssam * and that is available as structure cursor. 2313775Ssam * 2413775Ssam * The following calls are allowed: 2513775Ssam * move(sp) move to point sp. 2613775Ssam * up() move up one line. 2713775Ssam * down() move down one line. 2813775Ssam * bs() move left one space (except column 0). 2913775Ssam * nd() move right one space(no write). 3013775Ssam * clear() clear screen. 3113775Ssam * home() home. 3213775Ssam * ll() move to lower left corner of screen. 3313775Ssam * cr() carriage return (no line feed). 3413775Ssam * printf() just like standard printf, but keeps track 3513775Ssam * of cursor position. (Uses pstring). 3613775Ssam * aprintf() same as printf, but first argument is &point. 3713775Ssam * (Uses pstring). 3813775Ssam * pstring(s) output the string of printing characters. 3913775Ssam * However, '\r' is interpreted to mean return 4013775Ssam * to column of origination AND do linefeed. 4113775Ssam * '\n' causes <cr><lf>. 4213775Ssam * putpad(str) calls tputs to output character with proper 4313775Ssam * padding. 4413775Ssam * outch() the output routine for a character used by 4513775Ssam * tputs. It just calls putchar. 4613775Ssam * pch(ch) output character to screen and update 4713775Ssam * cursor address (must be a standard 4813775Ssam * printing character). WILL SCROLL. 4913775Ssam * pchar(ps,ch) prints one character if it is on the 5013775Ssam * screen at the specified location; 5113775Ssam * otherwise, dumps it.(no wrap-around). 5213775Ssam * 5313775Ssam * getcap() initializes strings for later calls. 5413775Ssam * cap(string) outputs the string designated in the termcap 5513775Ssam * data base. (Should not move the cursor.) 5613775Ssam * done(int) returns the terminal to intial state. If int 5713775Ssam * is not 0, it exits. 5813775Ssam * 5913775Ssam * same(&p1,&p2) returns 1 if p1 and p2 are the same point. 6013775Ssam * point(&p,x,y) return point set to x,y. 6113775Ssam * 6213775Ssam * baudrate(x) returns the baudrate of the terminal. 6313775Ssam * delay(t) causes an approximately constant delay 6413775Ssam * independent of baudrate. 6513775Ssam * Duration is ~ t/20 seconds. 6613775Ssam * 6713775Ssam ******************************************************************************/ 6813775Ssam 6913775Ssam #include "snake.h" 7013775Ssam 7113775Ssam int CMlength; 7213775Ssam int NDlength; 7313775Ssam int BSlength; 7413775Ssam int delaystr[10]; 7513775Ssam short ospeed; 7613775Ssam 7713775Ssam static char str[80]; 7813775Ssam 7913775Ssam move(sp) 8013775Ssam struct point *sp; 8113775Ssam { 8213775Ssam int distance; 8313775Ssam int tabcol,ct; 8413775Ssam struct point z; 8513775Ssam 8613775Ssam if (sp->line <0 || sp->col <0 || sp->col > COLUMNS){ 8713775Ssam printf("move to [%d,%d]?",sp->line,sp->col); 8813775Ssam return; 8913775Ssam } 9013775Ssam if (sp->line >= LINES){ 9113775Ssam move(point(&z,sp->col,LINES-1)); 9213775Ssam while(sp->line-- >= LINES)putchar('\n'); 9313775Ssam return; 9413775Ssam } 9513775Ssam 9613775Ssam if (CM != 0) { 9713775Ssam char *cmstr = tgoto(CM, sp->col, sp->line); 9813775Ssam 9913775Ssam CMlength = strlen(cmstr); 10013775Ssam if(cursor.line == sp->line){ 10113775Ssam distance = sp->col - cursor.col; 10213775Ssam if(distance == 0)return; /* Already there! */ 10313775Ssam if(distance > 0){ /* Moving to the right */ 10413775Ssam if(distance*NDlength < CMlength){ 10513775Ssam right(sp); 10613775Ssam return; 10713775Ssam } 10813775Ssam if(TA){ 10913775Ssam ct=sp->col&7; 11013775Ssam tabcol=(cursor.col|7)+1; 11113775Ssam do{ 11213775Ssam ct++; 11313775Ssam tabcol=(tabcol|7)+1; 11413775Ssam } 11513775Ssam while(tabcol<sp->col); 11613775Ssam if(ct<CMlength){ 11713775Ssam right(sp); 11813775Ssam return; 11913775Ssam } 12013775Ssam } 12113775Ssam } else { /* Moving to the left */ 12213775Ssam if (-distance*BSlength < CMlength){ 12313775Ssam gto(sp); 12413775Ssam return; 12513775Ssam } 12613775Ssam } 12713775Ssam if(sp->col < CMlength){ 12813775Ssam cr(); 12913775Ssam right(sp); 13013775Ssam return; 13113775Ssam } 13213775Ssam /* No more optimizations on same row. */ 13313775Ssam } 13413775Ssam distance = sp->col - cursor.col; 13513775Ssam distance = distance > 0 ? 13613775Ssam distance*NDlength : -distance * BSlength; 13713775Ssam if(distance < 0)printf("ERROR: distance is negative: %d",distance); 13813775Ssam distance += abs(sp->line - cursor.line); 13913775Ssam if(distance >= CMlength){ 14013775Ssam putpad(cmstr); 14113775Ssam cursor.line = sp->line; 14213775Ssam cursor.col = sp->col; 14313775Ssam return; 14413775Ssam } 14513775Ssam } 14613775Ssam 14713775Ssam /* 14813775Ssam * If we get here we have a terminal that can't cursor 14913775Ssam * address but has local motions or one which can cursor 15013775Ssam * address but can get there quicker with local motions. 15113775Ssam */ 15213775Ssam gto(sp); 15313775Ssam } 15413775Ssam gto(sp) 15513775Ssam struct point *sp; 15613775Ssam { 15713775Ssam 15813775Ssam int distance,f,tfield,j; 15913775Ssam 16013775Ssam if (cursor.line > LINES || cursor.line <0 || 16113775Ssam cursor.col <0 || cursor.col > COLUMNS) 16213775Ssam printf("ERROR: cursor is at %d,%d\n", 16313775Ssam cursor.line,cursor.col); 16413775Ssam if (sp->line > LINES || sp->line <0 || 16513775Ssam sp->col <0 || sp->col > COLUMNS) 16613775Ssam printf("ERROR: target is %d,%d\n",sp->line,sp->col); 16713775Ssam tfield = (sp->col) >> 3; 16813775Ssam if (sp->line == cursor.line){ 16913775Ssam if (sp->col > cursor.col)right(sp); 17013775Ssam else{ 17113775Ssam distance = (cursor.col -sp->col)*BSlength; 17213775Ssam if (((TA) && 17313775Ssam (distance > tfield+((sp->col)&7)*NDlength) 17413775Ssam ) || 17513775Ssam (((cursor.col)*NDlength) < distance) 17613775Ssam ){ 17713775Ssam cr(); 17813775Ssam right(sp); 17913775Ssam } 18013775Ssam else{ 18113775Ssam while(cursor.col > sp->col) bs(); 18213775Ssam } 18313775Ssam } 18413775Ssam return; 18513775Ssam } 18613775Ssam /*must change row */ 18713775Ssam if (cursor.col - sp->col > (cursor.col >> 3)){ 18813775Ssam if (cursor.col == 0)f = 0; 18913775Ssam else f = -1; 19013775Ssam } 19113775Ssam else f = cursor.col >> 3; 19213775Ssam if (((sp->line << 1) + 1 < cursor.line - f) && (HO != 0)){ 19313775Ssam /* 19413775Ssam * home quicker than rlf: 19513775Ssam * (sp->line + f > cursor.line - sp->line) 19613775Ssam */ 19713775Ssam putpad(HO); 19813775Ssam cursor.col = cursor.line = 0; 19913775Ssam gto(sp); 20013775Ssam return; 20113775Ssam } 20213775Ssam if (((sp->line << 1) > cursor.line + LINES+1 + f) && (LL != 0)){ 20313775Ssam /* home,rlf quicker than lf 20413775Ssam * (LINES+1 - sp->line + f < sp->line - cursor.line) 20513775Ssam */ 20613775Ssam if (cursor.line > f + 1){ 20713775Ssam /* is home faster than wraparound lf? 20813775Ssam * (cursor.line + 20 - sp->line > 21 - sp->line + f) 20913775Ssam */ 21013775Ssam ll(); 21113775Ssam gto(sp); 21213775Ssam return; 21313775Ssam } 21413775Ssam } 21513775Ssam if ((LL != 0) && (sp->line > cursor.line + (LINES >> 1) - 1)) 21613775Ssam cursor.line += LINES; 21713775Ssam while(sp->line > cursor.line)down(); 21813775Ssam while(sp->line < cursor.line)up(); 21913775Ssam gto(sp); /*can recurse since cursor.line = sp->line */ 22013775Ssam } 22113775Ssam 22213775Ssam right(sp) 22313775Ssam struct point *sp; 22413775Ssam { 22513775Ssam int field,tfield; 22613775Ssam int tabcol,strlength; 22713775Ssam 22813775Ssam if (sp->col < cursor.col) 22913775Ssam printf("ERROR:right() can't move left\n"); 23013775Ssam if(TA){ /* If No Tabs: can't send tabs because ttydrive 23113775Ssam * loses count with control characters. 23213775Ssam */ 23313775Ssam field = cursor.col >> 3; 23413775Ssam /* 23513775Ssam * This code is useful for a terminal which wraps around on backspaces. 23613775Ssam * (Mine does.) Unfortunately, this is not specified in termcap, and 23713775Ssam * most terminals don't work that way. (Of course, most terminals 23813775Ssam * have addressible cursors, too). 23913775Ssam */ 24013775Ssam if (BW && (CM == 0) && 24113775Ssam ((sp->col << 1) - field > (COLUMNS - 8) << 1 ) 24213775Ssam ){ 24313775Ssam if (cursor.line == 0){ 24413775Ssam outch('\n'); 24513775Ssam } 24613775Ssam outch('\r'); 24713775Ssam cursor.col = COLUMNS + 1; 24813775Ssam while(cursor.col > sp->col)bs(); 24913775Ssam if (cursor.line != 0) outch('\n'); 25013775Ssam return; 25113775Ssam } 25213775Ssam 25313775Ssam tfield = sp->col >> 3; 25413775Ssam 25513775Ssam while (field < tfield){ 25613775Ssam putpad(TA); 25713775Ssam cursor.col = ++field << 3; 25813775Ssam } 25913775Ssam tabcol = (cursor.col|7) + 1; 26013775Ssam strlength = (tabcol - sp->col)*BSlength + 1; 26113775Ssam /* length of sequence to overshoot */ 26213775Ssam if (((sp->col - cursor.col)*NDlength > strlength) && 26313775Ssam (tabcol < COLUMNS) 26413775Ssam ){ 26513775Ssam /* 26613775Ssam * Tab past and backup 26713775Ssam */ 26813775Ssam putpad(TA); 26913775Ssam cursor.col = (cursor.col | 7) + 1; 27013775Ssam while(cursor.col > sp->col)bs(); 27113775Ssam } 27213775Ssam } 27313775Ssam while (sp->col > cursor.col){ 27413775Ssam nd(); 27513775Ssam } 27613775Ssam } 27713775Ssam 27813775Ssam cr(){ 27913775Ssam outch('\r'); 28013775Ssam cursor.col = 0; 28113775Ssam } 28213775Ssam 28313775Ssam clear(){ 28413775Ssam int i; 28513775Ssam 28613775Ssam if (CL){ 28713775Ssam putpad(CL); 28813775Ssam cursor.col=cursor.line=0; 28913775Ssam } else { 29013775Ssam for(i=0; i<LINES; i++) { 29113775Ssam putchar('\n'); 29213775Ssam } 29313775Ssam cursor.line = LINES - 1; 29413775Ssam home(); 29513775Ssam } 29613775Ssam } 29713775Ssam 29813775Ssam home(){ 29913775Ssam struct point z; 30013775Ssam 30113775Ssam if(HO != 0){ 30213775Ssam putpad(HO); 30313775Ssam cursor.col = cursor.line = 0; 30413775Ssam return; 30513775Ssam } 30613775Ssam z.col = z.line = 0; 30713775Ssam move(&z); 30813775Ssam } 30913775Ssam 31013775Ssam ll(){ 31113775Ssam int j,l; 31213775Ssam struct point z; 31313775Ssam 31413775Ssam l = lcnt + 2; 31513775Ssam if(LL != NULL && LINES==l){ 31613775Ssam putpad(LL); 31713775Ssam cursor.line = LINES-1; 31813775Ssam cursor.col = 0; 31913775Ssam return; 32013775Ssam } 32113775Ssam z.col = 0; 32213775Ssam z.line = l-1; 32313775Ssam move(&z); 32413775Ssam } 32513775Ssam 32613775Ssam up(){ 32713775Ssam putpad(UP); 32813775Ssam cursor.line--; 32913775Ssam } 33013775Ssam 33113775Ssam down(){ 33213775Ssam putpad(DO); 33313775Ssam cursor.line++; 33413775Ssam if (cursor.line >= LINES)cursor.line=LINES-1; 33513775Ssam } 33613775Ssam bs(){ 33713775Ssam if (cursor.col > 0){ 33813775Ssam putpad(BS); 33913775Ssam cursor.col--; 34013775Ssam } 34113775Ssam } 34213775Ssam 34313775Ssam nd(){ 34413775Ssam putpad(ND); 34513775Ssam cursor.col++; 34613775Ssam if (cursor.col == COLUMNS+1){ 34713775Ssam cursor.line++; 34813775Ssam cursor.col = 0; 34913775Ssam if (cursor.line >= LINES)cursor.line=LINES-1; 35013775Ssam } 35113775Ssam } 35213775Ssam 35313775Ssam pch(c) 35413775Ssam { 35513775Ssam outch(c); 35613775Ssam if(++cursor.col >= COLUMNS && AM) { 35713775Ssam cursor.col = 0; 35813775Ssam ++cursor.line; 35913775Ssam } 36013775Ssam } 36113775Ssam 36213775Ssam aprintf(ps,st,v0,v1,v2,v3,v4,v5,v6,v7,v8,v9) 36313775Ssam struct point *ps; 36413775Ssam char *st; 36513775Ssam int v0,v1,v2,v3,v4,v5,v6,v7,v8,v9; 36613775Ssam 36713775Ssam { 36813775Ssam struct point p; 36913775Ssam 37013775Ssam p.line = ps->line+1; p.col = ps->col+1; 37113775Ssam move(&p); 37213775Ssam sprintf(str,st,v0,v1,v2,v3,v4,v5,v6,v7,v8,v9); 37313775Ssam pstring(str); 37413775Ssam } 37513775Ssam 37613775Ssam printf(st,v0,v1,v2,v3,v4,v5,v6,v7,v8,v9) 37713775Ssam char *st; 37813775Ssam int v0,v1,v2,v3,v4,v5,v6,v7,v8,v9; 37913775Ssam { 38013775Ssam sprintf(str,st,v0,v1,v2,v3,v4,v5,v6,v7,v8,v9); 38113775Ssam pstring(str); 38213775Ssam } 38313775Ssam 38413775Ssam pstring(s) 38513775Ssam char *s;{ 38613775Ssam struct point z; 38713775Ssam int stcol; 38813775Ssam 38913775Ssam stcol = cursor.col; 39013775Ssam while (s[0] != '\0'){ 39113775Ssam switch (s[0]){ 39213775Ssam case '\n': 39313775Ssam move(point(&z,0,cursor.line+1)); 39413775Ssam break; 39513775Ssam case '\r': 39613775Ssam move(point(&z,stcol,cursor.line+1)); 39713775Ssam break; 39813775Ssam case '\t': 39913775Ssam z.col = (((cursor.col + 8) >> 3) << 3); 40013775Ssam z.line = cursor.line; 40113775Ssam move(&z); 40213775Ssam break; 40313775Ssam case '\b': 40413775Ssam bs(); 40513775Ssam break; 40613775Ssam case CTRL(g): 40713775Ssam outch(CTRL(g)); 40813775Ssam break; 40913775Ssam default: 41013775Ssam if (s[0] < ' ')break; 41113775Ssam pch(s[0]); 41213775Ssam } 41313775Ssam s++; 41413775Ssam } 41513775Ssam } 41613775Ssam 41713775Ssam pchar(ps,ch) 41813775Ssam struct point *ps; 41913775Ssam char ch;{ 42013775Ssam struct point p; 42113775Ssam p.col = ps->col + 1; p.line = ps->line + 1; 42213775Ssam if ( 42313775Ssam (p.col >= 0) && 42413775Ssam (p.line >= 0) && 42513775Ssam ( 42613775Ssam ( 42713775Ssam (p.line < LINES) && 42813775Ssam (p.col < COLUMNS) 42913775Ssam ) || 43013775Ssam ( 43113775Ssam (p.col == COLUMNS) && 43213775Ssam (p.line < LINES-1) 43313775Ssam ) 43413775Ssam ) 43513775Ssam ){ 43613775Ssam move(&p); 43713775Ssam pch(ch); 43813775Ssam } 43913775Ssam } 44013775Ssam 44113775Ssam 44213775Ssam outch(c) 44313775Ssam { 44413775Ssam putchar(c); 44513775Ssam } 44613775Ssam 44713775Ssam putpad(str) 44813775Ssam char *str; 44913775Ssam { 45013775Ssam if (str) 45113775Ssam tputs(str, 1, outch); 45213775Ssam } 45313775Ssam baudrate() 45413775Ssam { 45513775Ssam 45613775Ssam switch (orig.sg_ospeed){ 45713775Ssam case B300: 45813775Ssam return(300); 45913775Ssam case B1200: 46013775Ssam return(1200); 46113775Ssam case B4800: 46213775Ssam return(4800); 46313775Ssam case B9600: 46413775Ssam return(9600); 46513775Ssam default: 46613775Ssam return(0); 46713775Ssam } 46813775Ssam } 46913775Ssam delay(t) 47013775Ssam int t; 47113775Ssam { 47213775Ssam int k,j; 47313775Ssam 47413775Ssam k = baudrate() * t / 300; 47513775Ssam for(j=0;j<k;j++){ 47613775Ssam putchar(PC); 47713775Ssam } 47813775Ssam } 47913775Ssam 48013775Ssam done() 48113775Ssam { 48213775Ssam cook(); 48313775Ssam exit(0); 48413775Ssam } 48513775Ssam 48613775Ssam cook() 48713775Ssam { 48813775Ssam delay(1); 48913775Ssam putpad(TE); 49013775Ssam putpad(KE); 49113775Ssam fflush(stdout); 49213775Ssam stty(0, &orig); 49313775Ssam #ifdef TIOCSLTC 49413775Ssam ioctl(0, TIOCSLTC, &olttyc); 49513775Ssam #endif 49613775Ssam } 49713775Ssam 49813775Ssam raw() 49913775Ssam { 50013775Ssam stty(0, &new); 50113775Ssam #ifdef TIOCSLTC 50213775Ssam ioctl(0, TIOCSLTC, &nlttyc); 50313775Ssam #endif 50413775Ssam } 50513775Ssam 50613775Ssam same(sp1,sp2) 50713775Ssam struct point *sp1, *sp2; 50813775Ssam { 50913775Ssam if ((sp1->line == sp2->line) && (sp1->col == sp2->col))return(1); 51013775Ssam return(0); 51113775Ssam } 51213775Ssam 51313775Ssam struct point *point(ps,x,y) 51413775Ssam struct point *ps; 51513775Ssam int x,y; 51613775Ssam { 51713775Ssam ps->col=x; 51813775Ssam ps->line=y; 51913775Ssam return(ps); 52013775Ssam } 52113775Ssam 52213775Ssam char *ap; 52313775Ssam 52413775Ssam getcap() 52513775Ssam { 52613775Ssam char *getenv(); 52713775Ssam char *term; 52813775Ssam char *xPC; 52913775Ssam struct point z; 53013775Ssam int stop(); 53113775Ssam 53213775Ssam term = getenv("TERM"); 53313775Ssam if (term==0) { 53413775Ssam fprintf(stderr, "No TERM in environment\n"); 53513775Ssam exit(1); 53613775Ssam } 53713775Ssam 53813775Ssam switch (tgetent(tbuf, term)) { 53913775Ssam case -1: 54013775Ssam fprintf(stderr, "Cannot open termcap file\n"); 54113775Ssam exit(2); 54213775Ssam case 0: 54313775Ssam fprintf(stderr, "%s: unknown terminal", term); 54413775Ssam exit(3); 54513775Ssam } 54613775Ssam 54713775Ssam ap = tcapbuf; 54813775Ssam 54913775Ssam LINES = tgetnum("li"); 55013775Ssam COLUMNS = tgetnum("co"); 55113775Ssam lcnt = LINES; 55213775Ssam ccnt = COLUMNS - 1; 55313775Ssam 55413775Ssam AM = tgetflag("am"); 55513775Ssam BW = tgetflag("bw"); 55613775Ssam 55713775Ssam ND = tgetstr("nd", &ap); 55813775Ssam UP = tgetstr("up", &ap); 55913775Ssam 56013775Ssam DO = tgetstr("do", &ap); 56113775Ssam if (DO == 0) 56213775Ssam DO = "\n"; 56313775Ssam 56413775Ssam BS = tgetstr("bc", &ap); 56513775Ssam if (BS == 0 && tgetflag("bs")) 56613775Ssam BS = "\b"; 56713775Ssam if (BS) 56813775Ssam xBC = *BS; 56913775Ssam 57013775Ssam TA = tgetstr("ta", &ap); 57113775Ssam if (TA == 0 && tgetflag("pt")) 57213775Ssam TA = "\t"; 57313775Ssam 57413775Ssam HO = tgetstr("ho", &ap); 57513775Ssam CL = tgetstr("cl", &ap); 57613775Ssam CM = tgetstr("cm", &ap); 57713775Ssam LL = tgetstr("ll", &ap); 57813775Ssam 57913775Ssam KL = tgetstr("kl", &ap); 58013775Ssam KR = tgetstr("kr", &ap); 58113775Ssam KU = tgetstr("ku", &ap); 58213775Ssam KD = tgetstr("kd", &ap); 58313775Ssam Klength = strlen(KL); 58413775Ssam /* NOTE: If KL, KR, KU, and KD are not 58513775Ssam * all the same length, some problems 58613775Ssam * may arise, since tests are made on 58713775Ssam * all of them together. 58813775Ssam */ 58913775Ssam 59013775Ssam TI = tgetstr("ti", &ap); 59113775Ssam TE = tgetstr("te", &ap); 59213775Ssam KS = tgetstr("ks", &ap); 59313775Ssam KE = tgetstr("ke", &ap); 59413775Ssam 59513775Ssam xPC = tgetstr("pc", &ap); 59613775Ssam if (xPC) 59713775Ssam PC = *xPC; 59813775Ssam 59913775Ssam NDlength = strlen(ND); 60013775Ssam BSlength = strlen(BS); 60113775Ssam if ((CM == 0) && 60213775Ssam (HO == 0 | UP==0 || BS==0 || ND==0)) { 60313775Ssam fprintf(stderr, "Terminal must have addressible "); 60413775Ssam fprintf(stderr, "cursor or home + 4 local motions\n"); 60513775Ssam exit(5); 60613775Ssam } 60713775Ssam if (tgetflag("os")) { 60813775Ssam fprintf(stderr, "Terminal must not overstrike\n"); 60913775Ssam exit(5); 61013775Ssam } 61113775Ssam if (LINES <= 0 || COLUMNS <= 0) { 61213775Ssam fprintf(stderr, "Must know the screen size\n"); 61313775Ssam exit(5); 61413775Ssam } 61513775Ssam 61613775Ssam gtty(0, &orig); 61713775Ssam new=orig; 61813775Ssam new.sg_flags &= ~(ECHO|CRMOD|ALLDELAY|XTABS); 61913775Ssam new.sg_flags |= CBREAK; 62013775Ssam signal(SIGINT,stop); 62113775Ssam ospeed = orig.sg_ospeed; 62213775Ssam #ifdef TIOCGLTC 62313775Ssam ioctl(0, TIOCGLTC, &olttyc); 62413775Ssam nlttyc = olttyc; 62513775Ssam nlttyc.t_suspc = '\377'; 62613775Ssam nlttyc.t_dsuspc = '\377'; 62713775Ssam #endif 62813775Ssam raw(); 62913775Ssam 63013775Ssam if ((orig.sg_flags & XTABS) == XTABS) TA=0; 63113775Ssam putpad(KS); 63213775Ssam putpad(TI); 63313775Ssam point(&cursor,0,LINES-1); 63413775Ssam } 635