1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1989 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 
31 /*	from OpenSolaris "nii.c	1.7	05/06/08 SMI"	*/
32 
33 /*
34  * Portions Copyright (c) 2005 Gunnar Ritter, Freiburg i. Br., Germany
35  *
36  * Sccsid @(#)nii.c	1.48 (gritter) 3/5/07
37  */
38 
39 /*
40  * University Copyright- Copyright (c) 1982, 1986, 1988
41  * The Regents of the University of California
42  * All Rights Reserved
43  *
44  * University Acknowledgment- Portions of this document are derived from
45  * software developed by the University of California, Berkeley, and its
46  * contributors.
47  */
48 
49 #include "tdef.h"
50 #ifdef NROFF
51 #include "tw.h"
52 #endif
53 #include "pt.h"
54 #include "ext.h"
55 
56 struct 	s *frame, *stk;
57 int	ejl;
58 struct	s *nxf;
59 
60 pid_t	pipeflg = -1;
61 int	hflg;	/* used in nroff only */
62 int	eqflg;	/* used in nroff only */
63 
64 #ifndef NROFF
65 int	xpts;
66 int	ppts;
67 int	pfont;
68 int	mpts;
69 int	mfont;
70 int	cs;
71 int	ccs;
72 int	bd;
73 char	*fchartab;
74 #else
75 long	lvmot;
76 #endif
77 
78 int	stdi;
79 int	nofeed;
80 int	quiet;
81 int	stop;
82 char	ibuf[IBUFSZ];
83 char	xbuf[IBUFSZ];
84 char	*ibufp;
85 char	*xbufp;
86 char	*eibuf;
87 char	*xeibuf;
88 tchar	*pbbuf;		/* pushback buffer for arguments, \n, etc. */
89 int	pbsize;		/* number of members allocated for pbbuf */
90 int	pbp;		/* next free slot in pbbuf */
91 int	lastpbp;	/* pbp in previous stack frame */
92 int	nx;
93 int	mflg;
94 tchar	ch = 0;
95 int	ttyod;
96 int	iflg;
97 int	rargc;
98 char	**argp;
99 int	*trtab;
100 int	*trintab;
101 int	*trnttab;
102 int	lgf;
103 int	copyf;
104 filep	ip;
105 int	nlflg;
106 int	donef;
107 int	nflush;
108 int	nfo;
109 int	ifile;
110 int	padc;
111 int	raw;
112 int	ifl[NSO];
113 int	ifi;
114 int	flss;
115 int	nonumb;
116 int	trap;
117 int	tflg;
118 int	ejf;
119 int	gflag;
120 int	dilev;
121 filep	offset;
122 int	em;
123 int	ds;
124 filep	woff;
125 int	app;
126 int	ndone;
127 int	lead;
128 int	ralss;
129 filep	nextb;
130 tchar	nrbits;
131 int	nform;
132 int	macerr;
133 filep	apptr;
134 int	diflg;
135 filep	roff;
136 int	wbfi;
137 int	vflag;
138 int	noscale;
139 int	po1;
140 int	ev;
141 int	tty;
142 int	sfont	= FT;	/* appears to be "standard" font; used by .ul */
143 int	sv;
144 int	esc;
145 int	widthp;
146 int	xflag = 1;
147 int	xfont;
148 int	setwdf;
149 int	over;
150 int	nhyp;
151 tchar	**hyp;
152 tchar	*olinep;
153 int	dotT;
154 int	no_out;
155 struct	widcache *widcache;
156 struct	d *d;
157 struct	d *dip;
158 int	mb_cur_max;
159 struct env	initenv;
160 int	lastkern;
161 int	lasttrack;
162 int	defaultpl;
163 int	NCHARS;
164 int	NDI;
165 int	spreadwarn;
166 int	spreadlimit;
167 int	lastrq;
168 long	realpage;
169 int	tryglf;
170 char	*gchtab;
171 int	tailflg;
172 int	minflg;
173 int	minspc;
174 int	blmac;
175 int	lsmac;
176 int	glss;
177 int	lsn;
178 int	rawwidth;
179 int	*olt;
180 int	nolt;
181 int	clonef;
182 size_t	olinesz;
183 tchar	**chartab;
184 struct charout	*charout;
185 int	charoutsz;
186 int	charf;
187 int	fmtchar;
188 int	Tflg;
189 int	dl;
190 int	padj;
191 int	defcf;
192 int	donep;
193 int	gemu;
194 int	argdelim;
195 int	chomp;
196 int	chompend;
197