111473Sralph /* 2*19790Sdist * Copyright (c) 1980 Regents of the University of California. 3*19790Sdist * All rights reserved. The Berkeley software License Agreement 4*19790Sdist * specifies the terms and conditions for redistribution. 5*19790Sdist */ 6*19790Sdist 7*19790Sdist #ifndef lint 8*19790Sdist static char sccsid[] = "@(#)escseq.c 5.1 (Berkeley) 04/30/85"; 9*19790Sdist #endif not lint 10*19790Sdist 11*19790Sdist /* 1211473Sralph * escseq: get us out of any escape sequence we are in the middle of 1311473Sralph * and put us into the requested kind of escape sequence. 1411473Sralph */ 1511473Sralph 1611473Sralph #include "2648.h" 1711473Sralph escseq(mode)1811473Sralphescseq(mode) 1911473Sralph int mode; 2011473Sralph { 2111473Sralph if (mode == _escmode) 2211473Sralph return; 2311473Sralph /* Get out of previous mode */ 2411473Sralph switch (_escmode) { 2511473Sralph case NONE: 2611473Sralph break; 2711473Sralph case ESCD: 2811473Sralph if (mode == TEXT) { 2911473Sralph outchar('s'); 3011473Sralph _escmode = mode; 3111473Sralph return; 3211473Sralph } 3311473Sralph case ESCP: 3411473Sralph case ESCM: 3511473Sralph outchar('Z'); /* no-op */ 3611473Sralph break; 3711473Sralph case TEXT: 3811473Sralph outstr("\33*dT"); 3911473Sralph break; 4011473Sralph } 4111473Sralph /* Get into new mode */ 4211473Sralph switch (_escmode = mode) { 4311473Sralph case NONE: 4411473Sralph break; 4511473Sralph case ESCD: 4611473Sralph outstr("\33*d"); 4711473Sralph break; 4811473Sralph case ESCP: 4911473Sralph outstr("\33*p"); 5011473Sralph break; 5111473Sralph case ESCM: 5211473Sralph outstr("\33*m"); 5311473Sralph break; 5411473Sralph case TEXT: 5511473Sralph outstr("\33*dS"); 5611473Sralph break; 5711473Sralph } 5811473Sralph } 59