xref: /illumos-gate/usr/src/cmd/troff/nroff.d/n10.c (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate /*
34*7c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
35*7c478bd9Sstevel@tonic-gate  * The Regents of the University of California
36*7c478bd9Sstevel@tonic-gate  * All Rights Reserved
37*7c478bd9Sstevel@tonic-gate  *
38*7c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
39*7c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
40*7c478bd9Sstevel@tonic-gate  * contributors.
41*7c478bd9Sstevel@tonic-gate  */
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate /*
44*7c478bd9Sstevel@tonic-gate n10.c
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate Device interfaces
47*7c478bd9Sstevel@tonic-gate */
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate #include <limits.h>
50*7c478bd9Sstevel@tonic-gate #include <ctype.h>
51*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
52*7c478bd9Sstevel@tonic-gate #include <sys/stat.h>
53*7c478bd9Sstevel@tonic-gate #ifdef EUC
54*7c478bd9Sstevel@tonic-gate #ifdef NROFF
55*7c478bd9Sstevel@tonic-gate #include <stdlib.h>
56*7c478bd9Sstevel@tonic-gate #endif /* NROFF */
57*7c478bd9Sstevel@tonic-gate #endif /* EUC */
58*7c478bd9Sstevel@tonic-gate #include "tdef.h"
59*7c478bd9Sstevel@tonic-gate #include "ext.h"
60*7c478bd9Sstevel@tonic-gate #include "tw.h"
61*7c478bd9Sstevel@tonic-gate 
62*7c478bd9Sstevel@tonic-gate struct t t;	/* terminal characteristics */
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate int	dtab;
65*7c478bd9Sstevel@tonic-gate int	plotmode;
66*7c478bd9Sstevel@tonic-gate int	esct;
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate char	xchname[4 * (NROFFCHARS-_SPECCHAR_ST)];	/* hy, em, etc. */
69*7c478bd9Sstevel@tonic-gate short	xchtab[NROFFCHARS-_SPECCHAR_ST];		/* indexes into chname[] */
70*7c478bd9Sstevel@tonic-gate char	*codestr;
71*7c478bd9Sstevel@tonic-gate char	*chname = xchname;
72*7c478bd9Sstevel@tonic-gate short	*chtab = xchtab;
73*7c478bd9Sstevel@tonic-gate int	nchtab = 0;
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate int	Inch;
77*7c478bd9Sstevel@tonic-gate int	Hor;
78*7c478bd9Sstevel@tonic-gate int	Vert;
79*7c478bd9Sstevel@tonic-gate int	nfonts	= 4;	/* R, I, B, S */
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate /* these characters are used as various signals or values
82*7c478bd9Sstevel@tonic-gate  * in miscellaneous places.
83*7c478bd9Sstevel@tonic-gate  * values are set in specnames in t10.c
84*7c478bd9Sstevel@tonic-gate  */
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate int	c_hyphen;
87*7c478bd9Sstevel@tonic-gate int	c_emdash;
88*7c478bd9Sstevel@tonic-gate int	c_rule;
89*7c478bd9Sstevel@tonic-gate int	c_minus;
90*7c478bd9Sstevel@tonic-gate int	c_fi;
91*7c478bd9Sstevel@tonic-gate int	c_fl;
92*7c478bd9Sstevel@tonic-gate int	c_ff;
93*7c478bd9Sstevel@tonic-gate int	c_ffi;
94*7c478bd9Sstevel@tonic-gate int	c_ffl;
95*7c478bd9Sstevel@tonic-gate int	c_acute;
96*7c478bd9Sstevel@tonic-gate int	c_grave;
97*7c478bd9Sstevel@tonic-gate int	c_under;
98*7c478bd9Sstevel@tonic-gate int	c_rooten;
99*7c478bd9Sstevel@tonic-gate int	c_boxrule;
100*7c478bd9Sstevel@tonic-gate int	c_lefthand;
101*7c478bd9Sstevel@tonic-gate int	c_dagger;
102*7c478bd9Sstevel@tonic-gate int	c_isalnum;
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate ptinit()
105*7c478bd9Sstevel@tonic-gate {
106*7c478bd9Sstevel@tonic-gate 	register int i, j;
107*7c478bd9Sstevel@tonic-gate 	register char *p, *cp, *q;
108*7c478bd9Sstevel@tonic-gate 	int nread, fd;
109*7c478bd9Sstevel@tonic-gate 	extern char *skipstr(), *getstr(), *getint();
110*7c478bd9Sstevel@tonic-gate 	extern char *setbrk();
111*7c478bd9Sstevel@tonic-gate 	struct stat stbuf;
112*7c478bd9Sstevel@tonic-gate 	char check[50];
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate 	strcat(termtab, devname);
115*7c478bd9Sstevel@tonic-gate 	if ((fd = open(termtab, 0)) < 0) {
116*7c478bd9Sstevel@tonic-gate 		errprint(gettext("cannot open %s"), termtab);
117*7c478bd9Sstevel@tonic-gate 		exit(-1);
118*7c478bd9Sstevel@tonic-gate 	}
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate 	fstat(fd, &stbuf);
121*7c478bd9Sstevel@tonic-gate 	codestr = setbrk((int) stbuf.st_size);
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate 	nread = read(fd, codestr, (int) stbuf.st_size);
124*7c478bd9Sstevel@tonic-gate 	close(fd);
125*7c478bd9Sstevel@tonic-gate 
126*7c478bd9Sstevel@tonic-gate 	p = codestr;
127*7c478bd9Sstevel@tonic-gate 	p = skipstr(p);		/* skip over type, could check */
128*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getint(p, &t.bset);
129*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getint(p, &t.breset);
130*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getint(p, &t.Hor);
131*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getint(p, &t.Vert);
132*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getint(p, &t.Newline);
133*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getint(p, &t.Char);
134*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getint(p, &t.Em);
135*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getint(p, &t.Halfline);
136*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getint(p, &t.Adj);
137*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.twinit = p);
138*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.twrest = p);
139*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.twnl = p);
140*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.hlr = p);
141*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.hlf = p);
142*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.flr = p);
143*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.bdon = p);
144*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.bdoff = p);
145*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.iton = p);
146*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.itoff = p);
147*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.ploton = p);
148*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.plotoff = p);
149*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.up = p);
150*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.down = p);
151*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.right = p);
152*7c478bd9Sstevel@tonic-gate 	p = skipstr(p); p = getstr(p, t.left = p);
153*7c478bd9Sstevel@tonic-gate 
154*7c478bd9Sstevel@tonic-gate 	getstr(p, check);
155*7c478bd9Sstevel@tonic-gate 	if (strcmp(check, "charset") != 0) {
156*7c478bd9Sstevel@tonic-gate 		errprint(gettext("device table apparently curdled"));
157*7c478bd9Sstevel@tonic-gate 		exit(1);
158*7c478bd9Sstevel@tonic-gate 	}
159*7c478bd9Sstevel@tonic-gate 
160*7c478bd9Sstevel@tonic-gate 	for (i = 0; i < _SPECCHAR_ST; i++)
161*7c478bd9Sstevel@tonic-gate 		t.width[i] = 1;	/* default widths */
162*7c478bd9Sstevel@tonic-gate 
163*7c478bd9Sstevel@tonic-gate 	i = 0;
164*7c478bd9Sstevel@tonic-gate /* this ought to be a pointer array and in place in codestr */
165*7c478bd9Sstevel@tonic-gate 	cp = chname + 1;	/* bug if starts at 0, in setch */
166*7c478bd9Sstevel@tonic-gate 	while (p < codestr + nread) {
167*7c478bd9Sstevel@tonic-gate 		while (*p == ' ' || *p == '\t' || *p == '\n')
168*7c478bd9Sstevel@tonic-gate 			p++;
169*7c478bd9Sstevel@tonic-gate 		if (i + _SPECCHAR_ST >= NROFFCHARS) {
170*7c478bd9Sstevel@tonic-gate 			errprint(gettext("too many names in charset for %s"),
171*7c478bd9Sstevel@tonic-gate 					 termtab);
172*7c478bd9Sstevel@tonic-gate 			exit(1);
173*7c478bd9Sstevel@tonic-gate 		}
174*7c478bd9Sstevel@tonic-gate 		chtab[i] = cp - chname;	/* index, not pointer */
175*7c478bd9Sstevel@tonic-gate 		*cp++ = *p++;	/* 2-char names */
176*7c478bd9Sstevel@tonic-gate 		*cp++ = *p++;
177*7c478bd9Sstevel@tonic-gate 		*cp++ = '\0';
178*7c478bd9Sstevel@tonic-gate 		while (*p == ' ' || *p == '\t')
179*7c478bd9Sstevel@tonic-gate 			p++;
180*7c478bd9Sstevel@tonic-gate 		t.width[i+_SPECCHAR_ST] = *p++ - '0';
181*7c478bd9Sstevel@tonic-gate 		while (*p == ' ' || *p == '\t')
182*7c478bd9Sstevel@tonic-gate 			p++;
183*7c478bd9Sstevel@tonic-gate 		t.codetab[i] = p;
184*7c478bd9Sstevel@tonic-gate 		p = getstr(p, p);	/* compress string */
185*7c478bd9Sstevel@tonic-gate 		p++;
186*7c478bd9Sstevel@tonic-gate 		i++;
187*7c478bd9Sstevel@tonic-gate 		nchtab++;
188*7c478bd9Sstevel@tonic-gate 	}
189*7c478bd9Sstevel@tonic-gate 
190*7c478bd9Sstevel@tonic-gate 	sps = EM;
191*7c478bd9Sstevel@tonic-gate 	ics = EM * 2;
192*7c478bd9Sstevel@tonic-gate 	dtab = 8 * t.Em;
193*7c478bd9Sstevel@tonic-gate 	for (i = 0; i < 16; i++)
194*7c478bd9Sstevel@tonic-gate 		tabtab[i] = dtab * (i + 1);
195*7c478bd9Sstevel@tonic-gate 	pl = 11 * INCH;
196*7c478bd9Sstevel@tonic-gate 	po = PO;
197*7c478bd9Sstevel@tonic-gate 	spacesz = SS;
198*7c478bd9Sstevel@tonic-gate 	lss = lss1 = VS;
199*7c478bd9Sstevel@tonic-gate 	ll = ll1 = lt = lt1 = LL;
200*7c478bd9Sstevel@tonic-gate 	smnt = nfonts = 5;	/* R I B BI S */
201*7c478bd9Sstevel@tonic-gate 	specnames();	/* install names like "hyphen", etc. */
202*7c478bd9Sstevel@tonic-gate 	if (eqflg)
203*7c478bd9Sstevel@tonic-gate 		t.Adj = t.Hor;
204*7c478bd9Sstevel@tonic-gate }
205*7c478bd9Sstevel@tonic-gate 
206*7c478bd9Sstevel@tonic-gate char *skipstr(s)	/* skip over leading space plus string */
207*7c478bd9Sstevel@tonic-gate 	char *s;
208*7c478bd9Sstevel@tonic-gate {
209*7c478bd9Sstevel@tonic-gate 	while (*s == ' ' || *s == '\t' || *s == '\n')
210*7c478bd9Sstevel@tonic-gate 		s++;
211*7c478bd9Sstevel@tonic-gate 	while (*s != ' ' && *s != '\t' && *s != '\n')
212*7c478bd9Sstevel@tonic-gate 		if (*s++ == '\\')
213*7c478bd9Sstevel@tonic-gate 			s++;
214*7c478bd9Sstevel@tonic-gate 	return s;
215*7c478bd9Sstevel@tonic-gate }
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate char *getstr(s, t)	/* find next string in s, copy to t */
218*7c478bd9Sstevel@tonic-gate 	char *s, *t;
219*7c478bd9Sstevel@tonic-gate {
220*7c478bd9Sstevel@tonic-gate 	int quote = 0;
221*7c478bd9Sstevel@tonic-gate 
222*7c478bd9Sstevel@tonic-gate 	while (*s == ' ' || *s == '\t' || *s == '\n')
223*7c478bd9Sstevel@tonic-gate 		s++;
224*7c478bd9Sstevel@tonic-gate 	if (*s == '"') {
225*7c478bd9Sstevel@tonic-gate 		s++;
226*7c478bd9Sstevel@tonic-gate 		quote = 1;
227*7c478bd9Sstevel@tonic-gate 	}
228*7c478bd9Sstevel@tonic-gate 	for (;;) {
229*7c478bd9Sstevel@tonic-gate 		if (quote && *s == '"') {
230*7c478bd9Sstevel@tonic-gate 			s++;
231*7c478bd9Sstevel@tonic-gate 			break;
232*7c478bd9Sstevel@tonic-gate 		}
233*7c478bd9Sstevel@tonic-gate 		if (!quote && (*s == ' ' || *s == '\t' || *s == '\n'))
234*7c478bd9Sstevel@tonic-gate 			break;
235*7c478bd9Sstevel@tonic-gate 		if (*s != '\\')
236*7c478bd9Sstevel@tonic-gate 			*t++ = *s++;
237*7c478bd9Sstevel@tonic-gate 		else {
238*7c478bd9Sstevel@tonic-gate 			s++;	/* skip \\ */
239*7c478bd9Sstevel@tonic-gate 			if (isdigit((unsigned char)s[0]) &&
240*7c478bd9Sstevel@tonic-gate 			    isdigit((unsigned char)s[1]) &&
241*7c478bd9Sstevel@tonic-gate 			    isdigit((unsigned char)s[2])) {
242*7c478bd9Sstevel@tonic-gate 				*t++ = (s[0]-'0')<<6 | (s[1]-'0')<<3 | s[2]-'0';
243*7c478bd9Sstevel@tonic-gate 				s += 2;
244*7c478bd9Sstevel@tonic-gate 			} else if (isdigit((unsigned char)s[0])) {
245*7c478bd9Sstevel@tonic-gate 				*t++ = *s - '0';
246*7c478bd9Sstevel@tonic-gate 			} else if (*s == 'b') {
247*7c478bd9Sstevel@tonic-gate 				*t++ = '\b';
248*7c478bd9Sstevel@tonic-gate 			} else if (*s == 'n') {
249*7c478bd9Sstevel@tonic-gate 				*t++ = '\n';
250*7c478bd9Sstevel@tonic-gate 			} else if (*s == 'r') {
251*7c478bd9Sstevel@tonic-gate 				*t++ = '\r';
252*7c478bd9Sstevel@tonic-gate 			} else if (*s == 't') {
253*7c478bd9Sstevel@tonic-gate 				*t++ = '\t';
254*7c478bd9Sstevel@tonic-gate 			} else {
255*7c478bd9Sstevel@tonic-gate 				*t++ = *s;
256*7c478bd9Sstevel@tonic-gate 			}
257*7c478bd9Sstevel@tonic-gate 			s++;
258*7c478bd9Sstevel@tonic-gate 		}
259*7c478bd9Sstevel@tonic-gate 	}
260*7c478bd9Sstevel@tonic-gate 	*t = '\0';
261*7c478bd9Sstevel@tonic-gate 	return s;
262*7c478bd9Sstevel@tonic-gate }
263*7c478bd9Sstevel@tonic-gate 
264*7c478bd9Sstevel@tonic-gate char *getint(s, pn)	/* find integer at s */
265*7c478bd9Sstevel@tonic-gate 	char *s;
266*7c478bd9Sstevel@tonic-gate 	int *pn;
267*7c478bd9Sstevel@tonic-gate {
268*7c478bd9Sstevel@tonic-gate 	int base;
269*7c478bd9Sstevel@tonic-gate 
270*7c478bd9Sstevel@tonic-gate 	while (*s == ' ' || *s == '\t' || *s == '\n')
271*7c478bd9Sstevel@tonic-gate 		s++;
272*7c478bd9Sstevel@tonic-gate 	base = (*s == '0') ? 8 : 10;
273*7c478bd9Sstevel@tonic-gate 	*pn = 0;
274*7c478bd9Sstevel@tonic-gate 	while (isdigit((unsigned char)*s))
275*7c478bd9Sstevel@tonic-gate 		*pn = base * *pn + *s++ - '0';
276*7c478bd9Sstevel@tonic-gate 	return s;
277*7c478bd9Sstevel@tonic-gate }
278*7c478bd9Sstevel@tonic-gate 
279*7c478bd9Sstevel@tonic-gate specnames()
280*7c478bd9Sstevel@tonic-gate {
281*7c478bd9Sstevel@tonic-gate 	static struct {
282*7c478bd9Sstevel@tonic-gate 		int	*n;
283*7c478bd9Sstevel@tonic-gate 		char	*v;
284*7c478bd9Sstevel@tonic-gate 	} spnames[] = {
285*7c478bd9Sstevel@tonic-gate 		&c_hyphen, "hy",
286*7c478bd9Sstevel@tonic-gate 		&c_emdash, "em",
287*7c478bd9Sstevel@tonic-gate 		&c_rule, "ru",
288*7c478bd9Sstevel@tonic-gate 		&c_minus, "\\-",
289*7c478bd9Sstevel@tonic-gate 		&c_fi, "fi",
290*7c478bd9Sstevel@tonic-gate 		&c_fl, "fl",
291*7c478bd9Sstevel@tonic-gate 		&c_ff, "ff",
292*7c478bd9Sstevel@tonic-gate 		&c_ffi, "Fi",
293*7c478bd9Sstevel@tonic-gate 		&c_ffl, "Fl",
294*7c478bd9Sstevel@tonic-gate 		&c_acute, "aa",
295*7c478bd9Sstevel@tonic-gate 		&c_grave, "ga",
296*7c478bd9Sstevel@tonic-gate 		&c_under, "ul",
297*7c478bd9Sstevel@tonic-gate 		&c_rooten, "rn",
298*7c478bd9Sstevel@tonic-gate 		&c_boxrule, "br",
299*7c478bd9Sstevel@tonic-gate 		&c_lefthand, "lh",
300*7c478bd9Sstevel@tonic-gate 		&c_isalnum, "__",
301*7c478bd9Sstevel@tonic-gate 		0, 0
302*7c478bd9Sstevel@tonic-gate 	};
303*7c478bd9Sstevel@tonic-gate 	int	i;
304*7c478bd9Sstevel@tonic-gate 
305*7c478bd9Sstevel@tonic-gate 	for (i = 0; spnames[i].n; i++)
306*7c478bd9Sstevel@tonic-gate 		*spnames[i].n = findch(spnames[i].v);
307*7c478bd9Sstevel@tonic-gate 	if (c_isalnum == 0)
308*7c478bd9Sstevel@tonic-gate 		c_isalnum = NROFFCHARS;
309*7c478bd9Sstevel@tonic-gate }
310*7c478bd9Sstevel@tonic-gate 
311*7c478bd9Sstevel@tonic-gate 
312*7c478bd9Sstevel@tonic-gate findch(s)	/* find char s in chname */
313*7c478bd9Sstevel@tonic-gate register char	*s;
314*7c478bd9Sstevel@tonic-gate {
315*7c478bd9Sstevel@tonic-gate 	register int	i;
316*7c478bd9Sstevel@tonic-gate 
317*7c478bd9Sstevel@tonic-gate 	for (i = 0; chtab[i] != 0; i++)
318*7c478bd9Sstevel@tonic-gate 		if (strcmp(s, &chname[chtab[i]]) == 0)
319*7c478bd9Sstevel@tonic-gate 			return(i + _SPECCHAR_ST);
320*7c478bd9Sstevel@tonic-gate 	return(0);
321*7c478bd9Sstevel@tonic-gate }
322*7c478bd9Sstevel@tonic-gate 
323*7c478bd9Sstevel@tonic-gate twdone()
324*7c478bd9Sstevel@tonic-gate {
325*7c478bd9Sstevel@tonic-gate 	int waitf;
326*7c478bd9Sstevel@tonic-gate 
327*7c478bd9Sstevel@tonic-gate 	obufp = obuf;
328*7c478bd9Sstevel@tonic-gate 	if (t.twrest)		/* has ptinit() been done yet? */
329*7c478bd9Sstevel@tonic-gate 		oputs(t.twrest);
330*7c478bd9Sstevel@tonic-gate 	flusho();
331*7c478bd9Sstevel@tonic-gate 	if (pipeflg) {
332*7c478bd9Sstevel@tonic-gate 		close(ptid);
333*7c478bd9Sstevel@tonic-gate 		wait(&waitf);
334*7c478bd9Sstevel@tonic-gate 	}
335*7c478bd9Sstevel@tonic-gate 	restore_tty();
336*7c478bd9Sstevel@tonic-gate }
337*7c478bd9Sstevel@tonic-gate 
338*7c478bd9Sstevel@tonic-gate 
339*7c478bd9Sstevel@tonic-gate ptout(i)
340*7c478bd9Sstevel@tonic-gate 	tchar i;
341*7c478bd9Sstevel@tonic-gate {
342*7c478bd9Sstevel@tonic-gate 	*olinep++ = i;
343*7c478bd9Sstevel@tonic-gate 	if (olinep >= &oline[LNSIZE])
344*7c478bd9Sstevel@tonic-gate 		olinep--;
345*7c478bd9Sstevel@tonic-gate 	if (cbits(i) != '\n')
346*7c478bd9Sstevel@tonic-gate 		return;
347*7c478bd9Sstevel@tonic-gate 	olinep--;
348*7c478bd9Sstevel@tonic-gate 	lead += dip->blss + lss - t.Newline;
349*7c478bd9Sstevel@tonic-gate 	dip->blss = 0;
350*7c478bd9Sstevel@tonic-gate 	esct = esc = 0;
351*7c478bd9Sstevel@tonic-gate 	if (olinep > oline) {
352*7c478bd9Sstevel@tonic-gate 		move();
353*7c478bd9Sstevel@tonic-gate 		ptout1();
354*7c478bd9Sstevel@tonic-gate 		oputs(t.twnl);
355*7c478bd9Sstevel@tonic-gate 	} else {
356*7c478bd9Sstevel@tonic-gate 		lead += t.Newline;
357*7c478bd9Sstevel@tonic-gate 		move();
358*7c478bd9Sstevel@tonic-gate 	}
359*7c478bd9Sstevel@tonic-gate 	lead += dip->alss;
360*7c478bd9Sstevel@tonic-gate 	dip->alss = 0;
361*7c478bd9Sstevel@tonic-gate 	olinep = oline;
362*7c478bd9Sstevel@tonic-gate }
363*7c478bd9Sstevel@tonic-gate 
364*7c478bd9Sstevel@tonic-gate 
365*7c478bd9Sstevel@tonic-gate ptout1()
366*7c478bd9Sstevel@tonic-gate {
367*7c478bd9Sstevel@tonic-gate 	register k;
368*7c478bd9Sstevel@tonic-gate 	register char	*codep;
369*7c478bd9Sstevel@tonic-gate #ifdef EUC
370*7c478bd9Sstevel@tonic-gate #ifdef NROFF
371*7c478bd9Sstevel@tonic-gate 	register int cnt;
372*7c478bd9Sstevel@tonic-gate 	register tchar *qq;
373*7c478bd9Sstevel@tonic-gate #endif /* NROFF */
374*7c478bd9Sstevel@tonic-gate #endif /* EUC */
375*7c478bd9Sstevel@tonic-gate 	extern char	*plot();
376*7c478bd9Sstevel@tonic-gate 	int	w, j, phyw;
377*7c478bd9Sstevel@tonic-gate #ifdef EUC
378*7c478bd9Sstevel@tonic-gate #ifdef NROFF
379*7c478bd9Sstevel@tonic-gate 	int jj;
380*7c478bd9Sstevel@tonic-gate #endif /* NROFF */
381*7c478bd9Sstevel@tonic-gate #endif /* EUC */
382*7c478bd9Sstevel@tonic-gate 	tchar * q, i;
383*7c478bd9Sstevel@tonic-gate 	static int oxfont = FT;	/* start off in roman */
384*7c478bd9Sstevel@tonic-gate 
385*7c478bd9Sstevel@tonic-gate 	for (q = oline; q < olinep; q++) {
386*7c478bd9Sstevel@tonic-gate 		i = *q;
387*7c478bd9Sstevel@tonic-gate 		if (ismot(i)) {
388*7c478bd9Sstevel@tonic-gate 			j = absmot(i);
389*7c478bd9Sstevel@tonic-gate 			if (isnmot(i))
390*7c478bd9Sstevel@tonic-gate 				j = -j;
391*7c478bd9Sstevel@tonic-gate 			if (isvmot(i))
392*7c478bd9Sstevel@tonic-gate 				lead += j;
393*7c478bd9Sstevel@tonic-gate 			else
394*7c478bd9Sstevel@tonic-gate 				esc += j;
395*7c478bd9Sstevel@tonic-gate 			continue;
396*7c478bd9Sstevel@tonic-gate 		}
397*7c478bd9Sstevel@tonic-gate 		if ((k = cbits(i)) <= 040) {
398*7c478bd9Sstevel@tonic-gate 			switch (k) {
399*7c478bd9Sstevel@tonic-gate 			case ' ': /*space*/
400*7c478bd9Sstevel@tonic-gate 				esc += t.Char;
401*7c478bd9Sstevel@tonic-gate 				break;
402*7c478bd9Sstevel@tonic-gate 			case '\033':
403*7c478bd9Sstevel@tonic-gate 			case '\007':
404*7c478bd9Sstevel@tonic-gate 			case '\016':
405*7c478bd9Sstevel@tonic-gate 			case '\017':
406*7c478bd9Sstevel@tonic-gate 				oput(k);
407*7c478bd9Sstevel@tonic-gate 				break;
408*7c478bd9Sstevel@tonic-gate 			}
409*7c478bd9Sstevel@tonic-gate 			continue;
410*7c478bd9Sstevel@tonic-gate 		}
411*7c478bd9Sstevel@tonic-gate #ifdef EUC
412*7c478bd9Sstevel@tonic-gate #ifdef NROFF
413*7c478bd9Sstevel@tonic-gate 		if (multi_locale && ((k & MBMASK) || (k & CSMASK))) {
414*7c478bd9Sstevel@tonic-gate 			cnt = 0;
415*7c478bd9Sstevel@tonic-gate 			while ((*q & MBMASK1) && (cnt + 1 < (int)MB_CUR_MAX)) {
416*7c478bd9Sstevel@tonic-gate 				cnt++;
417*7c478bd9Sstevel@tonic-gate 				q++;
418*7c478bd9Sstevel@tonic-gate 			}
419*7c478bd9Sstevel@tonic-gate 			if ((cnt && !(*q & CSMASK)) || (*q & MBMASK1)) {
420*7c478bd9Sstevel@tonic-gate 				q -= cnt;
421*7c478bd9Sstevel@tonic-gate 				cnt = 0;
422*7c478bd9Sstevel@tonic-gate 				*q &= ~0xfe00;
423*7c478bd9Sstevel@tonic-gate 			}
424*7c478bd9Sstevel@tonic-gate 			k = cbits(i = *q);
425*7c478bd9Sstevel@tonic-gate 			phyw = w = t.Char * csi_width[cs(i)];
426*7c478bd9Sstevel@tonic-gate 		} else {
427*7c478bd9Sstevel@tonic-gate #endif /* NROFF */
428*7c478bd9Sstevel@tonic-gate #endif /* EUC */
429*7c478bd9Sstevel@tonic-gate 		phyw = w = t.Char * t.width[k];
430*7c478bd9Sstevel@tonic-gate 		if (iszbit(i))
431*7c478bd9Sstevel@tonic-gate 			w = 0;
432*7c478bd9Sstevel@tonic-gate #ifdef EUC
433*7c478bd9Sstevel@tonic-gate #ifdef NROFF
434*7c478bd9Sstevel@tonic-gate 		}
435*7c478bd9Sstevel@tonic-gate #endif /* NROFF */
436*7c478bd9Sstevel@tonic-gate #endif /* EUC */
437*7c478bd9Sstevel@tonic-gate 		if (esc || lead)
438*7c478bd9Sstevel@tonic-gate 			move();
439*7c478bd9Sstevel@tonic-gate 		esct += w;
440*7c478bd9Sstevel@tonic-gate #ifndef EUC
441*7c478bd9Sstevel@tonic-gate 		xfont = fbits(i);
442*7c478bd9Sstevel@tonic-gate #else
443*7c478bd9Sstevel@tonic-gate #ifndef NROFF
444*7c478bd9Sstevel@tonic-gate 		xfont = fbits(i);
445*7c478bd9Sstevel@tonic-gate #else
446*7c478bd9Sstevel@tonic-gate #endif /* NROFF */
447*7c478bd9Sstevel@tonic-gate 		xfont = (fbits(*q) % NFONT);	/* for invalid code */
448*7c478bd9Sstevel@tonic-gate #endif /* EUC */
449*7c478bd9Sstevel@tonic-gate 		if (xfont != oxfont) {
450*7c478bd9Sstevel@tonic-gate 			if (oxfont == ulfont || oxfont == BIFONT)
451*7c478bd9Sstevel@tonic-gate 				oputs(t.itoff);
452*7c478bd9Sstevel@tonic-gate 			if (bdtab[oxfont])
453*7c478bd9Sstevel@tonic-gate 				oputs(t.bdoff);
454*7c478bd9Sstevel@tonic-gate 			if (xfont == ulfont || xfont == BIFONT)
455*7c478bd9Sstevel@tonic-gate 				oputs(t.iton);
456*7c478bd9Sstevel@tonic-gate 			if (bdtab[xfont])
457*7c478bd9Sstevel@tonic-gate 				oputs(t.bdon);
458*7c478bd9Sstevel@tonic-gate 			oxfont = xfont;
459*7c478bd9Sstevel@tonic-gate 		}
460*7c478bd9Sstevel@tonic-gate 		if ((xfont == ulfont || xfont == BIFONT) && !(*t.iton & 0377)) {
461*7c478bd9Sstevel@tonic-gate 			for (j = w / t.Char; j > 0; j--)
462*7c478bd9Sstevel@tonic-gate 				oput('_');
463*7c478bd9Sstevel@tonic-gate 			for (j = w / t.Char; j > 0; j--)
464*7c478bd9Sstevel@tonic-gate 				oput('\b');
465*7c478bd9Sstevel@tonic-gate 		}
466*7c478bd9Sstevel@tonic-gate 		if ((j = bdtab[xfont]) && !(*t.bdon & 0377))
467*7c478bd9Sstevel@tonic-gate 			j++;
468*7c478bd9Sstevel@tonic-gate 		else
469*7c478bd9Sstevel@tonic-gate 			j = 1;	/* number of overstrikes for bold */
470*7c478bd9Sstevel@tonic-gate 		if (k < 128) {	/* ordinary ascii */
471*7c478bd9Sstevel@tonic-gate 			oput(k);
472*7c478bd9Sstevel@tonic-gate 			while (--j > 0) {
473*7c478bd9Sstevel@tonic-gate 				oput('\b');
474*7c478bd9Sstevel@tonic-gate 				oput(k);
475*7c478bd9Sstevel@tonic-gate 			}
476*7c478bd9Sstevel@tonic-gate #ifdef EUC
477*7c478bd9Sstevel@tonic-gate #ifdef NROFF
478*7c478bd9Sstevel@tonic-gate 		} else if (multi_locale && (k & CSMASK)) {
479*7c478bd9Sstevel@tonic-gate 			for (qq = q - cnt; qq <= q;)
480*7c478bd9Sstevel@tonic-gate 				oput(cbits(*qq++));
481*7c478bd9Sstevel@tonic-gate 			while (--j > 0) {
482*7c478bd9Sstevel@tonic-gate 				for (jj = cnt + 1; jj > 0; jj--)
483*7c478bd9Sstevel@tonic-gate 					oput('\b');
484*7c478bd9Sstevel@tonic-gate 				for (qq = q - cnt; qq <= q;)
485*7c478bd9Sstevel@tonic-gate 					oput(cbits(*qq++));
486*7c478bd9Sstevel@tonic-gate 			}
487*7c478bd9Sstevel@tonic-gate 		} else if (k < 256) {
488*7c478bd9Sstevel@tonic-gate 			/*
489*7c478bd9Sstevel@tonic-gate 			 * Invalid character for C locale or
490*7c478bd9Sstevel@tonic-gate 			 * non-printable 8-bit single byte
491*7c478bd9Sstevel@tonic-gate 			 * character such as <no-break-sp>
492*7c478bd9Sstevel@tonic-gate 			 * in ISO-8859-1
493*7c478bd9Sstevel@tonic-gate 			 */
494*7c478bd9Sstevel@tonic-gate 			oput(k);
495*7c478bd9Sstevel@tonic-gate 			while (--j > 0) {
496*7c478bd9Sstevel@tonic-gate 				oput('\b');
497*7c478bd9Sstevel@tonic-gate 				oput(k);
498*7c478bd9Sstevel@tonic-gate 			}
499*7c478bd9Sstevel@tonic-gate #endif /* NROFF */
500*7c478bd9Sstevel@tonic-gate #endif /* EUC */
501*7c478bd9Sstevel@tonic-gate 		} else if (k >= nchtab + _SPECCHAR_ST) {
502*7c478bd9Sstevel@tonic-gate 			oput(k - nchtab - _SPECCHAR_ST);
503*7c478bd9Sstevel@tonic-gate 		} else {
504*7c478bd9Sstevel@tonic-gate 			int oj = j;
505*7c478bd9Sstevel@tonic-gate 			codep = t.codetab[k-_SPECCHAR_ST];
506*7c478bd9Sstevel@tonic-gate 			while (*codep != 0) {
507*7c478bd9Sstevel@tonic-gate 				if (*codep & 0200) {
508*7c478bd9Sstevel@tonic-gate 					codep = plot(codep);
509*7c478bd9Sstevel@tonic-gate 					oput(' ');
510*7c478bd9Sstevel@tonic-gate 				} else {
511*7c478bd9Sstevel@tonic-gate 					if (*codep == '%')	/* escape */
512*7c478bd9Sstevel@tonic-gate 						codep++;
513*7c478bd9Sstevel@tonic-gate 					oput(*codep);
514*7c478bd9Sstevel@tonic-gate 					if (*codep == '\033')
515*7c478bd9Sstevel@tonic-gate 						oput(*++codep);
516*7c478bd9Sstevel@tonic-gate 					else if (*codep != '\b')
517*7c478bd9Sstevel@tonic-gate 						for (j = oj; --j > 0; ) {
518*7c478bd9Sstevel@tonic-gate 							oput('\b');
519*7c478bd9Sstevel@tonic-gate 							oput(*codep);
520*7c478bd9Sstevel@tonic-gate 						}
521*7c478bd9Sstevel@tonic-gate 					codep++;
522*7c478bd9Sstevel@tonic-gate 				}
523*7c478bd9Sstevel@tonic-gate 			}
524*7c478bd9Sstevel@tonic-gate 		}
525*7c478bd9Sstevel@tonic-gate 		if (!w)
526*7c478bd9Sstevel@tonic-gate 			for (j = phyw / t.Char; j > 0; j--)
527*7c478bd9Sstevel@tonic-gate 				oput('\b');
528*7c478bd9Sstevel@tonic-gate 	}
529*7c478bd9Sstevel@tonic-gate }
530*7c478bd9Sstevel@tonic-gate 
531*7c478bd9Sstevel@tonic-gate 
532*7c478bd9Sstevel@tonic-gate char	*plot(x)
533*7c478bd9Sstevel@tonic-gate char	*x;
534*7c478bd9Sstevel@tonic-gate {
535*7c478bd9Sstevel@tonic-gate 	register int	i;
536*7c478bd9Sstevel@tonic-gate 	register char	*j, *k;
537*7c478bd9Sstevel@tonic-gate 
538*7c478bd9Sstevel@tonic-gate 	oputs(t.ploton);
539*7c478bd9Sstevel@tonic-gate 	k = x;
540*7c478bd9Sstevel@tonic-gate 	if ((*k & 0377) == 0200)
541*7c478bd9Sstevel@tonic-gate 		k++;
542*7c478bd9Sstevel@tonic-gate 	for (; *k; k++) {
543*7c478bd9Sstevel@tonic-gate 		if (*k == '%') {	/* quote char within plot mode */
544*7c478bd9Sstevel@tonic-gate 			oput(*++k);
545*7c478bd9Sstevel@tonic-gate 		} else if (*k & 0200) {
546*7c478bd9Sstevel@tonic-gate 			if (*k & 0100) {
547*7c478bd9Sstevel@tonic-gate 				if (*k & 040)
548*7c478bd9Sstevel@tonic-gate 					j = t.up;
549*7c478bd9Sstevel@tonic-gate 				else
550*7c478bd9Sstevel@tonic-gate 					j = t.down;
551*7c478bd9Sstevel@tonic-gate 			} else {
552*7c478bd9Sstevel@tonic-gate 				if (*k & 040)
553*7c478bd9Sstevel@tonic-gate 					j = t.left;
554*7c478bd9Sstevel@tonic-gate 				else
555*7c478bd9Sstevel@tonic-gate 					j = t.right;
556*7c478bd9Sstevel@tonic-gate 			}
557*7c478bd9Sstevel@tonic-gate 			if ((i = *k & 037) == 0) {	/* 2nd 0200 turns it off */
558*7c478bd9Sstevel@tonic-gate 				++k;
559*7c478bd9Sstevel@tonic-gate 				break;
560*7c478bd9Sstevel@tonic-gate 			}
561*7c478bd9Sstevel@tonic-gate 			while (i--)
562*7c478bd9Sstevel@tonic-gate 				oputs(j);
563*7c478bd9Sstevel@tonic-gate 		} else
564*7c478bd9Sstevel@tonic-gate 			oput(*k);
565*7c478bd9Sstevel@tonic-gate 	}
566*7c478bd9Sstevel@tonic-gate 	oputs(t.plotoff);
567*7c478bd9Sstevel@tonic-gate 	return(k);
568*7c478bd9Sstevel@tonic-gate }
569*7c478bd9Sstevel@tonic-gate 
570*7c478bd9Sstevel@tonic-gate 
571*7c478bd9Sstevel@tonic-gate move()
572*7c478bd9Sstevel@tonic-gate {
573*7c478bd9Sstevel@tonic-gate 	register k;
574*7c478bd9Sstevel@tonic-gate 	register char	*i, *j;
575*7c478bd9Sstevel@tonic-gate 	char	*p, *q;
576*7c478bd9Sstevel@tonic-gate 	int	iesct, dt;
577*7c478bd9Sstevel@tonic-gate 
578*7c478bd9Sstevel@tonic-gate 	iesct = esct;
579*7c478bd9Sstevel@tonic-gate 	if (esct += esc)
580*7c478bd9Sstevel@tonic-gate 		i = "\0";
581*7c478bd9Sstevel@tonic-gate 	else
582*7c478bd9Sstevel@tonic-gate 		i = "\n\0";
583*7c478bd9Sstevel@tonic-gate 	j = t.hlf;
584*7c478bd9Sstevel@tonic-gate 	p = t.right;
585*7c478bd9Sstevel@tonic-gate 	q = t.down;
586*7c478bd9Sstevel@tonic-gate 	if (lead) {
587*7c478bd9Sstevel@tonic-gate 		if (lead < 0) {
588*7c478bd9Sstevel@tonic-gate 			lead = -lead;
589*7c478bd9Sstevel@tonic-gate 			i = t.flr;
590*7c478bd9Sstevel@tonic-gate 			/*	if(!esct)i = t.flr; else i = "\0";*/
591*7c478bd9Sstevel@tonic-gate 			j = t.hlr;
592*7c478bd9Sstevel@tonic-gate 			q = t.up;
593*7c478bd9Sstevel@tonic-gate 		}
594*7c478bd9Sstevel@tonic-gate 		if (*i & 0377) {
595*7c478bd9Sstevel@tonic-gate 			k = lead / t.Newline;
596*7c478bd9Sstevel@tonic-gate 			lead = lead % t.Newline;
597*7c478bd9Sstevel@tonic-gate 			while (k--)
598*7c478bd9Sstevel@tonic-gate 				oputs(i);
599*7c478bd9Sstevel@tonic-gate 		}
600*7c478bd9Sstevel@tonic-gate 		if (*j & 0377) {
601*7c478bd9Sstevel@tonic-gate 			k = lead / t.Halfline;
602*7c478bd9Sstevel@tonic-gate 			lead = lead % t.Halfline;
603*7c478bd9Sstevel@tonic-gate 			while (k--)
604*7c478bd9Sstevel@tonic-gate 				oputs(j);
605*7c478bd9Sstevel@tonic-gate 		} else { /* no half-line forward, not at line begining */
606*7c478bd9Sstevel@tonic-gate 			k = lead / t.Newline;
607*7c478bd9Sstevel@tonic-gate 			lead = lead % t.Newline;
608*7c478bd9Sstevel@tonic-gate 			if (k > 0)
609*7c478bd9Sstevel@tonic-gate 				esc = esct;
610*7c478bd9Sstevel@tonic-gate 			i = "\n";
611*7c478bd9Sstevel@tonic-gate 			while (k--)
612*7c478bd9Sstevel@tonic-gate 				oputs(i);
613*7c478bd9Sstevel@tonic-gate 		}
614*7c478bd9Sstevel@tonic-gate 	}
615*7c478bd9Sstevel@tonic-gate 	if (esc) {
616*7c478bd9Sstevel@tonic-gate 		if (esc < 0) {
617*7c478bd9Sstevel@tonic-gate 			esc = -esc;
618*7c478bd9Sstevel@tonic-gate 			j = "\b";
619*7c478bd9Sstevel@tonic-gate 			p = t.left;
620*7c478bd9Sstevel@tonic-gate 		} else {
621*7c478bd9Sstevel@tonic-gate 			j = " ";
622*7c478bd9Sstevel@tonic-gate 			if (hflg)
623*7c478bd9Sstevel@tonic-gate 				while ((dt = dtab - (iesct % dtab)) <= esc) {
624*7c478bd9Sstevel@tonic-gate 					if (dt % t.Em)
625*7c478bd9Sstevel@tonic-gate 						break;
626*7c478bd9Sstevel@tonic-gate 					oput(TAB);
627*7c478bd9Sstevel@tonic-gate 					esc -= dt;
628*7c478bd9Sstevel@tonic-gate 					iesct += dt;
629*7c478bd9Sstevel@tonic-gate 				}
630*7c478bd9Sstevel@tonic-gate 		}
631*7c478bd9Sstevel@tonic-gate 		k = esc / t.Em;
632*7c478bd9Sstevel@tonic-gate 		esc = esc % t.Em;
633*7c478bd9Sstevel@tonic-gate 		while (k--)
634*7c478bd9Sstevel@tonic-gate 			oputs(j);
635*7c478bd9Sstevel@tonic-gate 	}
636*7c478bd9Sstevel@tonic-gate 	if ((*t.ploton & 0377) && (esc || lead)) {
637*7c478bd9Sstevel@tonic-gate 		oputs(t.ploton);
638*7c478bd9Sstevel@tonic-gate 		esc /= t.Hor;
639*7c478bd9Sstevel@tonic-gate 		lead /= t.Vert;
640*7c478bd9Sstevel@tonic-gate 		while (esc--)
641*7c478bd9Sstevel@tonic-gate 			oputs(p);
642*7c478bd9Sstevel@tonic-gate 		while (lead--)
643*7c478bd9Sstevel@tonic-gate 			oputs(q);
644*7c478bd9Sstevel@tonic-gate 		oputs(t.plotoff);
645*7c478bd9Sstevel@tonic-gate 	}
646*7c478bd9Sstevel@tonic-gate 	esc = lead = 0;
647*7c478bd9Sstevel@tonic-gate }
648*7c478bd9Sstevel@tonic-gate 
649*7c478bd9Sstevel@tonic-gate 
650*7c478bd9Sstevel@tonic-gate ptlead()
651*7c478bd9Sstevel@tonic-gate {
652*7c478bd9Sstevel@tonic-gate 	move();
653*7c478bd9Sstevel@tonic-gate }
654*7c478bd9Sstevel@tonic-gate 
655*7c478bd9Sstevel@tonic-gate 
656*7c478bd9Sstevel@tonic-gate dostop()
657*7c478bd9Sstevel@tonic-gate {
658*7c478bd9Sstevel@tonic-gate 	char	junk;
659*7c478bd9Sstevel@tonic-gate 
660*7c478bd9Sstevel@tonic-gate 	flusho();
661*7c478bd9Sstevel@tonic-gate 	read(2, &junk, 1);
662*7c478bd9Sstevel@tonic-gate }
663*7c478bd9Sstevel@tonic-gate 
664*7c478bd9Sstevel@tonic-gate 
665*7c478bd9Sstevel@tonic-gate newpage(){;}
666*7c478bd9Sstevel@tonic-gate pttrailer(){;}
667