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