10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 230Sstevel@tonic-gate * Copyright 2002 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 280Sstevel@tonic-gate /* All Rights Reserved */ 290Sstevel@tonic-gate 300Sstevel@tonic-gate /* 310Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 320Sstevel@tonic-gate * The Regents of the University of California 330Sstevel@tonic-gate * All Rights Reserved 340Sstevel@tonic-gate * 350Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 360Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 370Sstevel@tonic-gate * contributors. 380Sstevel@tonic-gate */ 390Sstevel@tonic-gate 40*217Smuffin #pragma ident "%Z%%M% %I% %E% SMI" 41*217Smuffin 420Sstevel@tonic-gate #include "tdef.h" 430Sstevel@tonic-gate 440Sstevel@tonic-gate /* You may want to change these names */ 450Sstevel@tonic-gate 460Sstevel@tonic-gate #ifdef NROFF 470Sstevel@tonic-gate 480Sstevel@tonic-gate char termtab[NS] = "/usr/share/lib/nterm/tab."; /* term type added in ptinit() */ 490Sstevel@tonic-gate char fontfile[NS] = ""; /* not used */ 500Sstevel@tonic-gate char devname[20] = "37"; 510Sstevel@tonic-gate 520Sstevel@tonic-gate #else 530Sstevel@tonic-gate 540Sstevel@tonic-gate char termtab[NS] = "/usr/lib/font"; /* rest added in ptinit() */ 550Sstevel@tonic-gate char fontfile[NS] = "/usr/lib/font";/* rest added in casefp() */ 560Sstevel@tonic-gate char devname[20] = "post"; /* default typesetter */ 570Sstevel@tonic-gate 580Sstevel@tonic-gate #endif 590Sstevel@tonic-gate char tmp_name[] = "/usr/tmp/trtmpXXXXXX"; 600Sstevel@tonic-gate char obuf[OBUFSZ]; /* characters collected here for typesetter output */ 610Sstevel@tonic-gate char *obufp = obuf; 620Sstevel@tonic-gate struct numtab numtab[NN] = { 630Sstevel@tonic-gate { PAIR('%', 0) }, 640Sstevel@tonic-gate { PAIR('n', 'l') }, 650Sstevel@tonic-gate { PAIR('y', 'r') }, 660Sstevel@tonic-gate { PAIR('h', 'p') }, 670Sstevel@tonic-gate { PAIR('c', 't') }, 680Sstevel@tonic-gate { PAIR('d', 'n') }, 690Sstevel@tonic-gate { PAIR('m', 'o') }, 700Sstevel@tonic-gate { PAIR('d', 'y') }, 710Sstevel@tonic-gate { PAIR('d', 'w') }, 720Sstevel@tonic-gate { PAIR('l', 'n') }, 730Sstevel@tonic-gate { PAIR('d', 'l') }, 740Sstevel@tonic-gate { PAIR('s', 't') }, 750Sstevel@tonic-gate { PAIR('s', 'b') }, 760Sstevel@tonic-gate { PAIR('c', '.') }, 770Sstevel@tonic-gate { PAIR('$', '$') }, 780Sstevel@tonic-gate }; 790Sstevel@tonic-gate 800Sstevel@tonic-gate 810Sstevel@tonic-gate int pto = 10000; 820Sstevel@tonic-gate int pfrom = 1; 830Sstevel@tonic-gate int print = 1; 840Sstevel@tonic-gate char nextf[NS] = "/usr/share/lib/tmac/"; 850Sstevel@tonic-gate char mfiles[NMF][NS]; 860Sstevel@tonic-gate int nmfi = 0; 870Sstevel@tonic-gate #ifndef NROFF 880Sstevel@tonic-gate int oldbits = -1; 890Sstevel@tonic-gate #endif 900Sstevel@tonic-gate int init = 1; 910Sstevel@tonic-gate int fc = IMP; /* field character */ 920Sstevel@tonic-gate int eschar = '\\'; 930Sstevel@tonic-gate #ifdef NROFF 940Sstevel@tonic-gate int pl = 11*INCH; 950Sstevel@tonic-gate int po = PO; 960Sstevel@tonic-gate #else 970Sstevel@tonic-gate int pl; 980Sstevel@tonic-gate int po; 990Sstevel@tonic-gate #endif 1000Sstevel@tonic-gate int dfact = 1; 1010Sstevel@tonic-gate int dfactd = 1; 1020Sstevel@tonic-gate int res = 1; 1030Sstevel@tonic-gate int smnt = 0; /* beginning of special fonts */ 1040Sstevel@tonic-gate int ascii = ASCII; 1050Sstevel@tonic-gate int ptid = PTID; 1060Sstevel@tonic-gate int lg = LG; 1070Sstevel@tonic-gate int pnlist[NPN] = { -1 }; 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate int *pnp = pnlist; 1110Sstevel@tonic-gate int npn = 1; 1120Sstevel@tonic-gate int npnflg = 1; 1130Sstevel@tonic-gate int dpn = -1; 1140Sstevel@tonic-gate int totout = 1; 1150Sstevel@tonic-gate int ulfont = ULFONT; 1160Sstevel@tonic-gate int tabch = TAB; 1170Sstevel@tonic-gate int ldrch = LEADER; 118*217Smuffin extern int caseds(), caseas(), casesp(), caseft(), caseps(), casevs(), 1190Sstevel@tonic-gate casenr(), caseif(), casepo(), casetl(), casetm(), casebp(), casech(), 1200Sstevel@tonic-gate casepn(), tbreak(), caseti(), casene(), casenf(), casece(), casefi(), 1210Sstevel@tonic-gate casein(), casell(), casens(), casemk(), casert(), caseam(), 1220Sstevel@tonic-gate casede(), casedi(), caseda(), casewh(), casedt(), caseit(), caserm(), 1230Sstevel@tonic-gate casern(), casead(), casers(), casena(), casepl(), caseta(), casetr(), 1240Sstevel@tonic-gate caseul(), caselt(), casenx(), caseso(), caseig(), casetc(), casefc(), 1250Sstevel@tonic-gate caseec(), caseeo(), caselc(), caseev(), caserd(), caseab(), casefl(), 1260Sstevel@tonic-gate done(), casess(), casefp(), casecs(), casebd(), caselg(), casehc(), 1270Sstevel@tonic-gate casehy(), casenh(), casenm(), casenn(), casesv(), caseos(), casels(), 1280Sstevel@tonic-gate casecc(), casec2(), caseem(), caseaf(), casehw(), casemc(), casepm(), 1290Sstevel@tonic-gate casecu(), casepi(), caserr(), caseuf(), caseie(), caseel(), casepc(), 1300Sstevel@tonic-gate caseht(), casecf(), casesy(), caself(), casedb(); 1310Sstevel@tonic-gate 1320Sstevel@tonic-gate #define C(a,b) {a, 0, b, 0} 1330Sstevel@tonic-gate struct contab contab[NM] = { 1340Sstevel@tonic-gate C(PAIR('d', 's'), caseds), 1350Sstevel@tonic-gate C(PAIR('a', 's'), caseas), 1360Sstevel@tonic-gate C(PAIR('s', 'p'), casesp), 1370Sstevel@tonic-gate C(PAIR('f', 't'), caseft), 1380Sstevel@tonic-gate C(PAIR('p', 's'), caseps), 1390Sstevel@tonic-gate C(PAIR('v', 's'), casevs), 1400Sstevel@tonic-gate C(PAIR('n', 'r'), casenr), 1410Sstevel@tonic-gate C(PAIR('i', 'f'), caseif), 1420Sstevel@tonic-gate C(PAIR('i', 'e'), caseie), 1430Sstevel@tonic-gate C(PAIR('e', 'l'), caseel), 1440Sstevel@tonic-gate C(PAIR('p', 'o'), casepo), 1450Sstevel@tonic-gate C(PAIR('t', 'l'), casetl), 1460Sstevel@tonic-gate C(PAIR('t', 'm'), casetm), 1470Sstevel@tonic-gate C(PAIR('b', 'p'), casebp), 1480Sstevel@tonic-gate C(PAIR('c', 'h'), casech), 1490Sstevel@tonic-gate C(PAIR('p', 'n'), casepn), 1500Sstevel@tonic-gate C(PAIR('b', 'r'), tbreak), 1510Sstevel@tonic-gate C(PAIR('t', 'i'), caseti), 1520Sstevel@tonic-gate C(PAIR('n', 'e'), casene), 1530Sstevel@tonic-gate C(PAIR('n', 'f'), casenf), 1540Sstevel@tonic-gate C(PAIR('c', 'e'), casece), 1550Sstevel@tonic-gate C(PAIR('f', 'i'), casefi), 1560Sstevel@tonic-gate C(PAIR('i', 'n'), casein), 1570Sstevel@tonic-gate C(PAIR('l', 'l'), casell), 1580Sstevel@tonic-gate C(PAIR('n', 's'), casens), 1590Sstevel@tonic-gate C(PAIR('m', 'k'), casemk), 1600Sstevel@tonic-gate C(PAIR('r', 't'), casert), 1610Sstevel@tonic-gate C(PAIR('a', 'm'), caseam), 1620Sstevel@tonic-gate C(PAIR('d', 'e'), casede), 1630Sstevel@tonic-gate C(PAIR('d', 'i'), casedi), 1640Sstevel@tonic-gate C(PAIR('d', 'a'), caseda), 1650Sstevel@tonic-gate C(PAIR('w', 'h'), casewh), 1660Sstevel@tonic-gate C(PAIR('d', 't'), casedt), 1670Sstevel@tonic-gate C(PAIR('i', 't'), caseit), 1680Sstevel@tonic-gate C(PAIR('r', 'm'), caserm), 1690Sstevel@tonic-gate C(PAIR('r', 'r'), caserr), 1700Sstevel@tonic-gate C(PAIR('r', 'n'), casern), 1710Sstevel@tonic-gate C(PAIR('a', 'd'), casead), 1720Sstevel@tonic-gate C(PAIR('r', 's'), casers), 1730Sstevel@tonic-gate C(PAIR('n', 'a'), casena), 1740Sstevel@tonic-gate C(PAIR('p', 'l'), casepl), 1750Sstevel@tonic-gate C(PAIR('t', 'a'), caseta), 1760Sstevel@tonic-gate C(PAIR('t', 'r'), casetr), 1770Sstevel@tonic-gate C(PAIR('u', 'l'), caseul), 1780Sstevel@tonic-gate C(PAIR('c', 'u'), casecu), 1790Sstevel@tonic-gate C(PAIR('l', 't'), caselt), 1800Sstevel@tonic-gate C(PAIR('n', 'x'), casenx), 1810Sstevel@tonic-gate C(PAIR('s', 'o'), caseso), 1820Sstevel@tonic-gate C(PAIR('i', 'g'), caseig), 1830Sstevel@tonic-gate C(PAIR('t', 'c'), casetc), 1840Sstevel@tonic-gate C(PAIR('f', 'c'), casefc), 1850Sstevel@tonic-gate C(PAIR('e', 'c'), caseec), 1860Sstevel@tonic-gate C(PAIR('e', 'o'), caseeo), 1870Sstevel@tonic-gate C(PAIR('l', 'c'), caselc), 1880Sstevel@tonic-gate C(PAIR('e', 'v'), caseev), 1890Sstevel@tonic-gate C(PAIR('r', 'd'), caserd), 1900Sstevel@tonic-gate C(PAIR('a', 'b'), caseab), 1910Sstevel@tonic-gate C(PAIR('f', 'l'), casefl), 1920Sstevel@tonic-gate C(PAIR('e', 'x'), done), 1930Sstevel@tonic-gate C(PAIR('s', 's'), casess), 1940Sstevel@tonic-gate C(PAIR('f', 'p'), casefp), 1950Sstevel@tonic-gate C(PAIR('c', 's'), casecs), 1960Sstevel@tonic-gate C(PAIR('b', 'd'), casebd), 1970Sstevel@tonic-gate C(PAIR('l', 'g'), caselg), 1980Sstevel@tonic-gate C(PAIR('h', 'c'), casehc), 1990Sstevel@tonic-gate C(PAIR('h', 'y'), casehy), 2000Sstevel@tonic-gate C(PAIR('n', 'h'), casenh), 2010Sstevel@tonic-gate C(PAIR('n', 'm'), casenm), 2020Sstevel@tonic-gate C(PAIR('n', 'n'), casenn), 2030Sstevel@tonic-gate C(PAIR('s', 'v'), casesv), 2040Sstevel@tonic-gate C(PAIR('o', 's'), caseos), 2050Sstevel@tonic-gate C(PAIR('l', 's'), casels), 2060Sstevel@tonic-gate C(PAIR('c', 'c'), casecc), 2070Sstevel@tonic-gate C(PAIR('c', '2'), casec2), 2080Sstevel@tonic-gate C(PAIR('e', 'm'), caseem), 2090Sstevel@tonic-gate C(PAIR('a', 'f'), caseaf), 2100Sstevel@tonic-gate C(PAIR('h', 'w'), casehw), 2110Sstevel@tonic-gate C(PAIR('m', 'c'), casemc), 2120Sstevel@tonic-gate C(PAIR('p', 'm'), casepm), 2130Sstevel@tonic-gate C(PAIR('p', 'i'), casepi), 2140Sstevel@tonic-gate C(PAIR('u', 'f'), caseuf), 2150Sstevel@tonic-gate C(PAIR('p', 'c'), casepc), 2160Sstevel@tonic-gate C(PAIR('h', 't'), caseht), 2170Sstevel@tonic-gate C(PAIR('c', 'f'), casecf), 2180Sstevel@tonic-gate C(PAIR('s', 'y'), casesy), 2190Sstevel@tonic-gate C(PAIR('l', 'f'), caself), 2200Sstevel@tonic-gate C(PAIR('d', 'b'), casedb), 2210Sstevel@tonic-gate /* C(PAIR('!', 0), casesy), */ /* synonym for .sy */ 2220Sstevel@tonic-gate }; 2230Sstevel@tonic-gate 2240Sstevel@tonic-gate 2250Sstevel@tonic-gate tchar oline[LNSIZE+1]; 2260Sstevel@tonic-gate 2270Sstevel@tonic-gate /* 2280Sstevel@tonic-gate * troff environment block 2290Sstevel@tonic-gate */ 2300Sstevel@tonic-gate 2310Sstevel@tonic-gate struct env env = { 2320Sstevel@tonic-gate /* int ics */ 0, 2330Sstevel@tonic-gate /* int sps */ 0, 2340Sstevel@tonic-gate /* int spacesz */ 0, 2350Sstevel@tonic-gate /* int lss */ 0, 2360Sstevel@tonic-gate /* int lss1 */ 0, 2370Sstevel@tonic-gate /* int ll */ 0, 2380Sstevel@tonic-gate /* int ll1 */ 0, 2390Sstevel@tonic-gate /* int lt */ 0, 2400Sstevel@tonic-gate /* int lt1 */ 0, 2410Sstevel@tonic-gate /* tchar i */ 0, /* insertion character */ 2420Sstevel@tonic-gate /* int icf */ 0, 2430Sstevel@tonic-gate /* tchar chbits */ 0, /* size+font bits for current character */ 2440Sstevel@tonic-gate /* tchar spbits */ 0, 2450Sstevel@tonic-gate /* tchar nmbits */ 0, 2460Sstevel@tonic-gate /* int apts */ PS, /* actual point size -- as requested by user */ 2470Sstevel@tonic-gate /* int apts1 */ PS, /* need not match an existent size */ 2480Sstevel@tonic-gate /* int pts */ PS, /* hence, this is the size that really exists */ 2490Sstevel@tonic-gate /* int pts1 */ PS, 2500Sstevel@tonic-gate /* int font */ FT, 2510Sstevel@tonic-gate /* int font1 */ FT, 2520Sstevel@tonic-gate /* int ls */ 1, 2530Sstevel@tonic-gate /* int ls1 */ 1, 2540Sstevel@tonic-gate /* int ad */ 1, 2550Sstevel@tonic-gate /* int nms */ 1, 2560Sstevel@tonic-gate /* int ndf */ 1, 2570Sstevel@tonic-gate /* int fi */ 1, 2580Sstevel@tonic-gate /* int cc */ '.', 2590Sstevel@tonic-gate /* int c2 */ '\'', 2600Sstevel@tonic-gate /* int ohc */ OHC, 2610Sstevel@tonic-gate /* int tdelim */ IMP, 2620Sstevel@tonic-gate /* int hyf */ 0, 2630Sstevel@tonic-gate /* int hyoff */ 0, 2640Sstevel@tonic-gate /* int un1 */ -1, 2650Sstevel@tonic-gate /* int tabc */ 0, 2660Sstevel@tonic-gate /* int dotc */ '.', 2670Sstevel@tonic-gate /* int adsp */ 0, 2680Sstevel@tonic-gate /* int adrem */ 0, 2690Sstevel@tonic-gate /* int lastl */ 0, 2700Sstevel@tonic-gate /* int nel */ 0, 2710Sstevel@tonic-gate /* int admod */ 0, 2720Sstevel@tonic-gate /* tchar *wordp */ 0, 2730Sstevel@tonic-gate /* int spflg */ 0, /* probably to indicate space after punctuation needed */ 2740Sstevel@tonic-gate /* tchar *linep */ 0, 2750Sstevel@tonic-gate /* tchar *wdend */ 0, 2760Sstevel@tonic-gate /* tchar *wdstart */ 0, 2770Sstevel@tonic-gate /* int wne */ 0, 2780Sstevel@tonic-gate /* int ne */ 0, 2790Sstevel@tonic-gate /* int nc */ 0, 2800Sstevel@tonic-gate /* int nb */ 0, 2810Sstevel@tonic-gate /* int lnmod */ 0, 2820Sstevel@tonic-gate /* int nwd */ 0, 2830Sstevel@tonic-gate /* int nn */ 0, 2840Sstevel@tonic-gate /* int ni */ 0, 2850Sstevel@tonic-gate /* int ul */ 0, 2860Sstevel@tonic-gate /* int cu */ 0, 2870Sstevel@tonic-gate /* int ce */ 0, 2880Sstevel@tonic-gate /* int in */ 0, 2890Sstevel@tonic-gate /* int in1 */ 0, 2900Sstevel@tonic-gate /* int un */ 0, 2910Sstevel@tonic-gate /* int wch */ 0, 2920Sstevel@tonic-gate /* int pendt */ 0, 2930Sstevel@tonic-gate /* tchar *pendw */ (tchar *)0, 2940Sstevel@tonic-gate /* int pendnf */ 0, 2950Sstevel@tonic-gate /* int spread */ 0, 2960Sstevel@tonic-gate /* int it */ 0, 2970Sstevel@tonic-gate /* int itmac */ 0, 2980Sstevel@tonic-gate /* int lnsize */ LNSIZE, 2990Sstevel@tonic-gate }; 300