xref: /illumos-gate/usr/src/cmd/troff/n8.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 #include	<ctype.h>
44*7c478bd9Sstevel@tonic-gate #include	"tdef.h"
45*7c478bd9Sstevel@tonic-gate #include "ext.h"
46*7c478bd9Sstevel@tonic-gate #define	HY_BIT	0200	/* stuff in here only works for ascii */
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate /*
49*7c478bd9Sstevel@tonic-gate  * troff8.c
50*7c478bd9Sstevel@tonic-gate  *
51*7c478bd9Sstevel@tonic-gate  * hyphenation
52*7c478bd9Sstevel@tonic-gate  */
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate char	hbuf[NHEX];
55*7c478bd9Sstevel@tonic-gate char	*nexth = hbuf;
56*7c478bd9Sstevel@tonic-gate tchar	*hyend;
57*7c478bd9Sstevel@tonic-gate #define THRESH 160 /*digram goodness threshold*/
58*7c478bd9Sstevel@tonic-gate int	thresh = THRESH;
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate hyphen(wp)
61*7c478bd9Sstevel@tonic-gate 	tchar *wp;
62*7c478bd9Sstevel@tonic-gate {
63*7c478bd9Sstevel@tonic-gate 	register j;
64*7c478bd9Sstevel@tonic-gate 	register tchar *i;
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate 	i = wp;
67*7c478bd9Sstevel@tonic-gate 	while (punct(cbits(*i++)))
68*7c478bd9Sstevel@tonic-gate 		;
69*7c478bd9Sstevel@tonic-gate 	if (!alph(cbits(*--i)))
70*7c478bd9Sstevel@tonic-gate 		return;
71*7c478bd9Sstevel@tonic-gate 	wdstart = i++;
72*7c478bd9Sstevel@tonic-gate 	while (alph(cbits(*i++)))
73*7c478bd9Sstevel@tonic-gate 		;
74*7c478bd9Sstevel@tonic-gate 	hyend = wdend = --i - 1;
75*7c478bd9Sstevel@tonic-gate 	while (punct(cbits(*i++)))
76*7c478bd9Sstevel@tonic-gate 		;
77*7c478bd9Sstevel@tonic-gate 	if (*--i)
78*7c478bd9Sstevel@tonic-gate 		return;
79*7c478bd9Sstevel@tonic-gate 	if ((wdend - wdstart - 4) < 0)
80*7c478bd9Sstevel@tonic-gate 		return;
81*7c478bd9Sstevel@tonic-gate 	hyp = hyptr;
82*7c478bd9Sstevel@tonic-gate 	*hyp = 0;
83*7c478bd9Sstevel@tonic-gate 	hyoff = 2;
84*7c478bd9Sstevel@tonic-gate 	if (!exword() && !suffix())
85*7c478bd9Sstevel@tonic-gate 		digram();
86*7c478bd9Sstevel@tonic-gate 	*hyp++ = 0;
87*7c478bd9Sstevel@tonic-gate 	if (*hyptr)
88*7c478bd9Sstevel@tonic-gate 		for (j = 1; j; ) {
89*7c478bd9Sstevel@tonic-gate 			j = 0;
90*7c478bd9Sstevel@tonic-gate 			for (hyp = hyptr + 1; *hyp != 0; hyp++) {
91*7c478bd9Sstevel@tonic-gate 				if (*(hyp - 1) > *hyp) {
92*7c478bd9Sstevel@tonic-gate 					j++;
93*7c478bd9Sstevel@tonic-gate 					i = *hyp;
94*7c478bd9Sstevel@tonic-gate 					*hyp = *(hyp - 1);
95*7c478bd9Sstevel@tonic-gate 					*(hyp - 1) = i;
96*7c478bd9Sstevel@tonic-gate 				}
97*7c478bd9Sstevel@tonic-gate 			}
98*7c478bd9Sstevel@tonic-gate 		}
99*7c478bd9Sstevel@tonic-gate }
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate punct(i)
103*7c478bd9Sstevel@tonic-gate {
104*7c478bd9Sstevel@tonic-gate 	if (!i || alph(i))
105*7c478bd9Sstevel@tonic-gate 		return(0);
106*7c478bd9Sstevel@tonic-gate 	else
107*7c478bd9Sstevel@tonic-gate 		return(1);
108*7c478bd9Sstevel@tonic-gate }
109*7c478bd9Sstevel@tonic-gate 
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate alph(i)
112*7c478bd9Sstevel@tonic-gate {
113*7c478bd9Sstevel@tonic-gate 	if (i >= 'a' && i <= 'z' || i >= 'A' && i <= 'Z')
114*7c478bd9Sstevel@tonic-gate 		return(1);
115*7c478bd9Sstevel@tonic-gate 	else
116*7c478bd9Sstevel@tonic-gate 		return(0);
117*7c478bd9Sstevel@tonic-gate }
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate caseht()
121*7c478bd9Sstevel@tonic-gate {
122*7c478bd9Sstevel@tonic-gate 	thresh = THRESH;
123*7c478bd9Sstevel@tonic-gate 	if (skip())
124*7c478bd9Sstevel@tonic-gate 		return;
125*7c478bd9Sstevel@tonic-gate 	noscale++;
126*7c478bd9Sstevel@tonic-gate 	thresh = atoi();
127*7c478bd9Sstevel@tonic-gate 	noscale = 0;
128*7c478bd9Sstevel@tonic-gate }
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate 
131*7c478bd9Sstevel@tonic-gate casehw()
132*7c478bd9Sstevel@tonic-gate {
133*7c478bd9Sstevel@tonic-gate 	register i, k;
134*7c478bd9Sstevel@tonic-gate 	register char	*j;
135*7c478bd9Sstevel@tonic-gate 	tchar t;
136*7c478bd9Sstevel@tonic-gate 
137*7c478bd9Sstevel@tonic-gate 	k = 0;
138*7c478bd9Sstevel@tonic-gate 	while (!skip()) {
139*7c478bd9Sstevel@tonic-gate 		if ((j = nexth) >= (hbuf + NHEX - 2))
140*7c478bd9Sstevel@tonic-gate 			goto full;
141*7c478bd9Sstevel@tonic-gate 		for (; ; ) {
142*7c478bd9Sstevel@tonic-gate 			if (ismot(t = getch()))
143*7c478bd9Sstevel@tonic-gate 				continue;
144*7c478bd9Sstevel@tonic-gate 			i = cbits(t);
145*7c478bd9Sstevel@tonic-gate 			if (i == ' ' || i == '\n') {
146*7c478bd9Sstevel@tonic-gate 				*j++ = 0;
147*7c478bd9Sstevel@tonic-gate 				nexth = j;
148*7c478bd9Sstevel@tonic-gate 				*j = 0;
149*7c478bd9Sstevel@tonic-gate 				if (i == ' ')
150*7c478bd9Sstevel@tonic-gate 					break;
151*7c478bd9Sstevel@tonic-gate 				else
152*7c478bd9Sstevel@tonic-gate 					return;
153*7c478bd9Sstevel@tonic-gate 			}
154*7c478bd9Sstevel@tonic-gate 			if (i == '-') {
155*7c478bd9Sstevel@tonic-gate 				k = HY_BIT;
156*7c478bd9Sstevel@tonic-gate 				continue;
157*7c478bd9Sstevel@tonic-gate 			}
158*7c478bd9Sstevel@tonic-gate 			*j++ = maplow(i) | k;
159*7c478bd9Sstevel@tonic-gate 			k = 0;
160*7c478bd9Sstevel@tonic-gate 			if (j >= (hbuf + NHEX - 2))
161*7c478bd9Sstevel@tonic-gate 				goto full;
162*7c478bd9Sstevel@tonic-gate 		}
163*7c478bd9Sstevel@tonic-gate 	}
164*7c478bd9Sstevel@tonic-gate 	return;
165*7c478bd9Sstevel@tonic-gate full:
166*7c478bd9Sstevel@tonic-gate 	errprint(gettext("exception word list full."));
167*7c478bd9Sstevel@tonic-gate 	*nexth = 0;
168*7c478bd9Sstevel@tonic-gate }
169*7c478bd9Sstevel@tonic-gate 
170*7c478bd9Sstevel@tonic-gate 
171*7c478bd9Sstevel@tonic-gate exword()
172*7c478bd9Sstevel@tonic-gate {
173*7c478bd9Sstevel@tonic-gate 	register tchar *w;
174*7c478bd9Sstevel@tonic-gate 	register char	*e;
175*7c478bd9Sstevel@tonic-gate 	char	*save;
176*7c478bd9Sstevel@tonic-gate 
177*7c478bd9Sstevel@tonic-gate 	e = hbuf;
178*7c478bd9Sstevel@tonic-gate 	while (1) {
179*7c478bd9Sstevel@tonic-gate 		save = e;
180*7c478bd9Sstevel@tonic-gate 		if (*e == 0)
181*7c478bd9Sstevel@tonic-gate 			return(0);
182*7c478bd9Sstevel@tonic-gate 		w = wdstart;
183*7c478bd9Sstevel@tonic-gate 		while (*e && w <= hyend && (*e & 0177) == maplow(cbits(*w))) {
184*7c478bd9Sstevel@tonic-gate 			e++;
185*7c478bd9Sstevel@tonic-gate 			w++;
186*7c478bd9Sstevel@tonic-gate 		};
187*7c478bd9Sstevel@tonic-gate 		if (!*e) {
188*7c478bd9Sstevel@tonic-gate 			if (w-1 == hyend || (w == wdend && maplow(cbits(*w)) == 's')) {
189*7c478bd9Sstevel@tonic-gate 				w = wdstart;
190*7c478bd9Sstevel@tonic-gate 				for (e = save; *e; e++) {
191*7c478bd9Sstevel@tonic-gate 					if (*e & HY_BIT)
192*7c478bd9Sstevel@tonic-gate 						*hyp++ = w;
193*7c478bd9Sstevel@tonic-gate 					if (hyp > (hyptr + NHYP - 1))
194*7c478bd9Sstevel@tonic-gate 						hyp = hyptr + NHYP - 1;
195*7c478bd9Sstevel@tonic-gate 					w++;
196*7c478bd9Sstevel@tonic-gate 				}
197*7c478bd9Sstevel@tonic-gate 				return(1);
198*7c478bd9Sstevel@tonic-gate 			} else {
199*7c478bd9Sstevel@tonic-gate 				e++;
200*7c478bd9Sstevel@tonic-gate 				continue;
201*7c478bd9Sstevel@tonic-gate 			}
202*7c478bd9Sstevel@tonic-gate 		} else
203*7c478bd9Sstevel@tonic-gate 			while (*e++)
204*7c478bd9Sstevel@tonic-gate 				;
205*7c478bd9Sstevel@tonic-gate 	}
206*7c478bd9Sstevel@tonic-gate }
207*7c478bd9Sstevel@tonic-gate 
208*7c478bd9Sstevel@tonic-gate 
209*7c478bd9Sstevel@tonic-gate suffix()
210*7c478bd9Sstevel@tonic-gate {
211*7c478bd9Sstevel@tonic-gate 	register tchar *w;
212*7c478bd9Sstevel@tonic-gate 	register char	*s, *s0;
213*7c478bd9Sstevel@tonic-gate 	tchar i;
214*7c478bd9Sstevel@tonic-gate 	extern char	*suftab[];
215*7c478bd9Sstevel@tonic-gate 	extern tchar *chkvow();
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate again:
218*7c478bd9Sstevel@tonic-gate 	if (!alph(cbits(i = cbits(*hyend))))
219*7c478bd9Sstevel@tonic-gate 		return(0);
220*7c478bd9Sstevel@tonic-gate 	if (i < 'a')
221*7c478bd9Sstevel@tonic-gate 		i -= 'A' - 'a';
222*7c478bd9Sstevel@tonic-gate 	if ((s0 = suftab[i-'a']) == 0)
223*7c478bd9Sstevel@tonic-gate 		return(0);
224*7c478bd9Sstevel@tonic-gate 	for (; ; ) {
225*7c478bd9Sstevel@tonic-gate 		if ((i = *s0 & 017) == 0)
226*7c478bd9Sstevel@tonic-gate 			return(0);
227*7c478bd9Sstevel@tonic-gate 		s = s0 + i - 1;
228*7c478bd9Sstevel@tonic-gate 		w = hyend - 1;
229*7c478bd9Sstevel@tonic-gate 		while (s > s0 && w >= wdstart && (*s & 0177) == maplow(cbits(*w))) {
230*7c478bd9Sstevel@tonic-gate 			s--;
231*7c478bd9Sstevel@tonic-gate 			w--;
232*7c478bd9Sstevel@tonic-gate 		}
233*7c478bd9Sstevel@tonic-gate 		if (s == s0)
234*7c478bd9Sstevel@tonic-gate 			break;
235*7c478bd9Sstevel@tonic-gate 		s0 += i;
236*7c478bd9Sstevel@tonic-gate 	}
237*7c478bd9Sstevel@tonic-gate 	s = s0 + i - 1;
238*7c478bd9Sstevel@tonic-gate 	w = hyend;
239*7c478bd9Sstevel@tonic-gate 	if (*s0 & HY_BIT)
240*7c478bd9Sstevel@tonic-gate 		goto mark;
241*7c478bd9Sstevel@tonic-gate 	while (s > s0) {
242*7c478bd9Sstevel@tonic-gate 		w--;
243*7c478bd9Sstevel@tonic-gate 		if (*s-- & HY_BIT) {
244*7c478bd9Sstevel@tonic-gate mark:
245*7c478bd9Sstevel@tonic-gate 			hyend = w - 1;
246*7c478bd9Sstevel@tonic-gate 			if (*s0 & 0100)
247*7c478bd9Sstevel@tonic-gate 				continue;
248*7c478bd9Sstevel@tonic-gate 			if (!chkvow(w))
249*7c478bd9Sstevel@tonic-gate 				return(0);
250*7c478bd9Sstevel@tonic-gate 			*hyp++ = w;
251*7c478bd9Sstevel@tonic-gate 		}
252*7c478bd9Sstevel@tonic-gate 	}
253*7c478bd9Sstevel@tonic-gate 	if (*s0 & 040)
254*7c478bd9Sstevel@tonic-gate 		return(0);
255*7c478bd9Sstevel@tonic-gate 	if (exword())
256*7c478bd9Sstevel@tonic-gate 		return(1);
257*7c478bd9Sstevel@tonic-gate 	goto again;
258*7c478bd9Sstevel@tonic-gate }
259*7c478bd9Sstevel@tonic-gate 
260*7c478bd9Sstevel@tonic-gate 
261*7c478bd9Sstevel@tonic-gate maplow(i)
262*7c478bd9Sstevel@tonic-gate register int	i;
263*7c478bd9Sstevel@tonic-gate {
264*7c478bd9Sstevel@tonic-gate 	if (ischar(i) && isupper(i))
265*7c478bd9Sstevel@tonic-gate 		i = tolower(i);
266*7c478bd9Sstevel@tonic-gate 	return(i);
267*7c478bd9Sstevel@tonic-gate }
268*7c478bd9Sstevel@tonic-gate 
269*7c478bd9Sstevel@tonic-gate 
270*7c478bd9Sstevel@tonic-gate vowel(i)
271*7c478bd9Sstevel@tonic-gate int	i;
272*7c478bd9Sstevel@tonic-gate {
273*7c478bd9Sstevel@tonic-gate 	switch (maplow(i)) {
274*7c478bd9Sstevel@tonic-gate 	case 'a':
275*7c478bd9Sstevel@tonic-gate 	case 'e':
276*7c478bd9Sstevel@tonic-gate 	case 'i':
277*7c478bd9Sstevel@tonic-gate 	case 'o':
278*7c478bd9Sstevel@tonic-gate 	case 'u':
279*7c478bd9Sstevel@tonic-gate 	case 'y':
280*7c478bd9Sstevel@tonic-gate 		return(1);
281*7c478bd9Sstevel@tonic-gate 	default:
282*7c478bd9Sstevel@tonic-gate 		return(0);
283*7c478bd9Sstevel@tonic-gate 	}
284*7c478bd9Sstevel@tonic-gate }
285*7c478bd9Sstevel@tonic-gate 
286*7c478bd9Sstevel@tonic-gate 
287*7c478bd9Sstevel@tonic-gate tchar *chkvow(w)
288*7c478bd9Sstevel@tonic-gate tchar *w;
289*7c478bd9Sstevel@tonic-gate {
290*7c478bd9Sstevel@tonic-gate 	while (--w >= wdstart)
291*7c478bd9Sstevel@tonic-gate 		if (vowel(cbits(*w)))
292*7c478bd9Sstevel@tonic-gate 			return(w);
293*7c478bd9Sstevel@tonic-gate 	return(0);
294*7c478bd9Sstevel@tonic-gate }
295*7c478bd9Sstevel@tonic-gate 
296*7c478bd9Sstevel@tonic-gate 
297*7c478bd9Sstevel@tonic-gate digram()
298*7c478bd9Sstevel@tonic-gate {
299*7c478bd9Sstevel@tonic-gate 	register tchar *w;
300*7c478bd9Sstevel@tonic-gate 	register val;
301*7c478bd9Sstevel@tonic-gate 	tchar * nhyend, *maxw;
302*7c478bd9Sstevel@tonic-gate 	int	maxval;
303*7c478bd9Sstevel@tonic-gate 	extern char	bxh[26][13], bxxh[26][13], xxh[26][13], xhx[26][13], hxx[26][13];
304*7c478bd9Sstevel@tonic-gate 
305*7c478bd9Sstevel@tonic-gate again:
306*7c478bd9Sstevel@tonic-gate 	if (!(w = chkvow(hyend + 1)))
307*7c478bd9Sstevel@tonic-gate 		return;
308*7c478bd9Sstevel@tonic-gate 	hyend = w;
309*7c478bd9Sstevel@tonic-gate 	if (!(w = chkvow(hyend)))
310*7c478bd9Sstevel@tonic-gate 		return;
311*7c478bd9Sstevel@tonic-gate 	nhyend = w;
312*7c478bd9Sstevel@tonic-gate 	maxval = 0;
313*7c478bd9Sstevel@tonic-gate 	w--;
314*7c478bd9Sstevel@tonic-gate 	while ((++w < hyend) && (w < (wdend - 1))) {
315*7c478bd9Sstevel@tonic-gate 		val = 1;
316*7c478bd9Sstevel@tonic-gate 		if (w == wdstart)
317*7c478bd9Sstevel@tonic-gate 			val *= dilook('a', cbits(*w), bxh);
318*7c478bd9Sstevel@tonic-gate 		else if (w == wdstart + 1)
319*7c478bd9Sstevel@tonic-gate 			val *= dilook(cbits(*(w-1)), cbits(*w), bxxh);
320*7c478bd9Sstevel@tonic-gate 		else
321*7c478bd9Sstevel@tonic-gate 			val *= dilook(cbits(*(w-1)), cbits(*w), xxh);
322*7c478bd9Sstevel@tonic-gate 		val *= dilook(cbits(*w), cbits(*(w+1)), xhx);
323*7c478bd9Sstevel@tonic-gate 		val *= dilook(cbits(*(w+1)), cbits(*(w+2)), hxx);
324*7c478bd9Sstevel@tonic-gate 		if (val > maxval) {
325*7c478bd9Sstevel@tonic-gate 			maxval = val;
326*7c478bd9Sstevel@tonic-gate 			maxw = w + 1;
327*7c478bd9Sstevel@tonic-gate 		}
328*7c478bd9Sstevel@tonic-gate 	}
329*7c478bd9Sstevel@tonic-gate 	hyend = nhyend;
330*7c478bd9Sstevel@tonic-gate 	if (maxval > thresh)
331*7c478bd9Sstevel@tonic-gate 		*hyp++ = maxw;
332*7c478bd9Sstevel@tonic-gate 	goto again;
333*7c478bd9Sstevel@tonic-gate }
334*7c478bd9Sstevel@tonic-gate 
335*7c478bd9Sstevel@tonic-gate 
336*7c478bd9Sstevel@tonic-gate dilook(a, b, t)
337*7c478bd9Sstevel@tonic-gate int	a, b;
338*7c478bd9Sstevel@tonic-gate char	t[26][13];
339*7c478bd9Sstevel@tonic-gate {
340*7c478bd9Sstevel@tonic-gate 	register i, j;
341*7c478bd9Sstevel@tonic-gate 
342*7c478bd9Sstevel@tonic-gate 	i = t[maplow(a)-'a'][(j = maplow(b)-'a')/2];
343*7c478bd9Sstevel@tonic-gate 	if (!(j & 01))
344*7c478bd9Sstevel@tonic-gate 		i >>= 4;
345*7c478bd9Sstevel@tonic-gate 	return(i & 017);
346*7c478bd9Sstevel@tonic-gate }
347*7c478bd9Sstevel@tonic-gate 
348*7c478bd9Sstevel@tonic-gate 
349