TWO BUGS (printf doesn't take a FILE *, plus wrong arg to gettimeofday)
[unix-history] / usr / src / old / tbl / tg.c
CommitLineData
94bed826
KB
1/*-
2 * %sccs.include.proprietary.c%
3 */
4
476fcd16 5#ifndef lint
94bed826
KB
6static char sccsid[] = "@(#)tg.c 4.3 (Berkeley) %G%";
7#endif /* not lint */
33b55b10
BS
8
9 /* tg.c: process included text blocks */
10# include "t..c"
11gettext(sp, ilin,icol, fn, sz)
12 char *sp, *fn, *sz;
13{
14/* get a section of text */
15char line[256];
16int oname;
17char *vs;
18if (texname==0) error("Too many text block diversions");
19if (textflg==0)
20 {
21 fprintf(tabout, ".nr %d \\n(.lu\n", SL); /* remember old line length */
22 textflg=1;
23 }
24fprintf(tabout, ".eo\n");
25fprintf(tabout, ".am %02d\n", icol+80);
26fprintf(tabout, ".br\n");
27fprintf(tabout, ".di %c+\n", texname);
28rstofill();
29if (fn && *fn) fprintf(tabout, ".nr %d \\n(.f\n.ft %s\n", S1, fn);
30fprintf(tabout, ".ft \\n(.f\n"); /* protect font */
31vs = vsize[stynum[ilin]][icol];
32if ((sz && *sz) || (vs && *vs))
33 {
34 fprintf(tabout, ".nr %d \\n(.v\n", S2);
35 if (vs==0 || *vs==0) vs= "\\n(.s+2";
36 if (sz && *sz)
37 fprintf(tabout, ".ps %s\n",sz);
38 fprintf(tabout, ".vs %s\n",vs);
39 fprintf(tabout, ".if \\n(%du>\\n(.vu .sp \\n(%du-\\n(.vu\n", S2,S2);
40 }
41if (cll[icol][0])
42 fprintf(tabout, ".ll %sn\n", cll[icol]);
43else
44 fprintf(tabout, ".ll \\n(%du*%du/%du\n",SL,ctspan(ilin,icol),ncol+1);
45fprintf(tabout,".if \\n(.l<\\n(%d .ll \\n(%du\n", icol+CRIGHT, icol+CRIGHT);
46if (ctype(ilin,icol)=='a')
47 fprintf(tabout, ".ll -2n\n");
48fprintf(tabout, ".in 0\n");
49while (gets1(line))
50 {
51 if (line[0]=='T' && line[1]=='}' && line[2]== tab) break;
52 if (match("T}", line)) break;
53 fprintf(tabout, "%s\n", line);
54 }
55if (fn && *fn) fprintf(tabout, ".ft \\n(%d\n", S1);
56if (sz && *sz) fprintf(tabout, ".br\n.ps\n.vs\n");
57fprintf(tabout, ".br\n");
58fprintf(tabout, ".di\n");
59fprintf(tabout, ".nr %c| \\n(dn\n", texname);
60fprintf(tabout, ".nr %c- \\n(dl\n", texname);
61fprintf(tabout, "..\n");
62fprintf(tabout, ".ec \\\n");
63/* copy remainder of line */
64if (line[2])
65 tcopy (sp, line+3);
66else
67 *sp=0;
68oname=texname;
69texname = texstr[++texct];
70return(oname);
71}
72untext()
73{
74rstofill();
75fprintf(tabout, ".nf\n");
76fprintf(tabout, ".ll \\n(%du\n", SL);
77}