manual page distributed with 4.1BSD
[unix-history] / usr / src / old / tbl / t9.c
CommitLineData
476fcd16
SL
1#ifndef lint
2static char sccsid[] = "@(#)t9.c 4.2 %G%";
3#endif
d883bd6f
BS
4
5 /* t9.c: write lines for tables over 200 lines */
6# include "t..c"
7static useln;
8yetmore()
9{
10for(useln=0; useln<MAXLIN && table[useln]==0; useln++);
11if (useln>=MAXLIN)
12 error("Wierd. No data in table.");
13table[0]=table[useln];
14for(useln=nlin-1; useln>=0 && (fullbot[useln] || instead[useln]); useln--);
15if (useln<0)
16 error("Wierd. No real lines in table.");
17domore(leftover);
18while (gets1(cstore=cspace) && domore(cstore))
19 ;
20last =cstore;
21return;
22}
23domore(dataln)
24 char *dataln;
25{
26 int icol, ch;
27if (prefix(".TE", dataln))
28 return(0);
29if (dataln[0] == '.' && !isdigit(dataln[1]))
30 {
31 puts(dataln);
32 return(1);
33 }
34instead[0]=fullbot[0]=0;
35if (dataln[1]==0)
36switch(dataln[0])
37 {
38 case '_': fullbot[0]= '-'; putline(useln,0); return(1);
39 case '=': fullbot[0]= '='; putline(useln, 0); return(1);
40 }
41for (icol = 0; icol <ncol; icol++)
42 {
43 table[0][icol].col = dataln;
44 table[0][icol].rcol=0;
45 for(; (ch= *dataln) != '\0' && ch != tab; dataln++)
46 ;
47 *dataln++ = '\0';
48 switch(ctype(useln,icol))
49 {
50 case 'n':
51 table[0][icol].rcol = maknew(table[0][icol].col);
52 break;
53 case 'a':
54 table[0][icol].rcol = table[0][icol].col;
55 table[0][icol].col= "";
56 break;
57 }
58 while (ctype(useln,icol+1)== 's') /* spanning */
59 table[0][++icol].col = "";
60 if (ch == '\0') break;
61 }
62while (++icol <ncol)
63 table[0][icol].col = "";
64putline(useln,0);
65return(1);
66}