8322 nl: misleading-indentation
[unleashed.git] / usr / src / cmd / tbl / t9.c
blobff2608467342aaffa79bb4d33930df58add0ce65
1 /*
2 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
6 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
11 * Copyright (c) 1980 Regents of the University of California.
12 * All rights reserved. The Berkeley software License Agreement
13 * specifies the terms and conditions for redistribution.
16 #pragma ident "%Z%%M% %I% %E% SMI"
18 /* t9.c: write lines for tables over 200 lines */
19 # include "t..c"
21 static int useln;
23 void
24 yetmore(void)
26 for(useln=0; useln<MAXLIN && table[useln]==0; useln++);
27 if (useln>=MAXLIN)
28 error(gettext("Weird. No data in table."));
29 table[0]=table[useln];
30 for(useln=nlin-1; useln>=0 && (fullbot[useln] || instead[useln]); useln--);
31 if (useln<0)
32 error(gettext("Weird. No real lines in table."));
33 domore(leftover);
34 while (gets1(cstore=cspace, MAXSTR) && domore(cstore))
36 last =cstore;
37 return;
40 int
41 domore(char *dataln)
43 int icol, ch;
44 if (prefix(".TE", dataln))
45 return(0);
46 if (dataln[0] == '.' && !isdigit((unsigned char)dataln[1]))
48 puts(dataln);
49 return(1);
51 instead[0]=0;
52 fullbot[0]=0;
53 if (dataln[1]==0)
54 switch(dataln[0])
56 case '_': fullbot[0]= '-'; putline(useln,0); return(1);
57 case '=': fullbot[0]= '='; putline(useln, 0); return(1);
59 for (icol = 0; icol <ncol; icol++)
61 table[0][icol].col = dataln;
62 table[0][icol].rcol=0;
63 for(; (ch= *dataln) != '\0' && ch != tab; dataln++)
65 *dataln++ = '\0';
66 switch(ctype(useln,icol))
68 case 'n':
69 table[0][icol].rcol = maknew(table[0][icol].col);
70 break;
71 case 'a':
72 table[0][icol].rcol = table[0][icol].col;
73 table[0][icol].col= "";
74 break;
76 while (ctype(useln,icol+1)== 's') /* spanning */
77 table[0][++icol].col = "";
78 if (ch == '\0') break;
80 while (++icol <ncol)
81 table[0][icol].col = "";
82 putline(useln,0);
83 return(1);