fixed problem with stab type for initialized static variables,
[unix-history] / usr / src / old / tbl / t3.c
CommitLineData
0eea07d9
BS
1/* t3.c 4.1 83/02/12 */
2
3 /* t3.c: interpret commands affecting whole table */
4# include "t..c"
5struct optstr {char *optnam; int *optadd;} options [] = {
6 "expand", &expflg,
7 "EXPAND", &expflg,
8 "center", &ctrflg,
9 "CENTER", &ctrflg,
10 "box", &boxflg,
11 "BOX", &boxflg,
12 "allbox", &allflg,
13 "ALLBOX", &allflg,
14 "doublebox", &dboxflg,
15 "DOUBLEBOX", &dboxflg,
16 "frame", &boxflg,
17 "FRAME", &boxflg,
18 "doubleframe", &dboxflg,
19 "DOUBLEFRAME", &dboxflg,
20 "tab", &tab,
21 "TAB", &tab,
22 "linesize", &linsize,
23 "LINESIZE", &linsize,
24 "delim", &delim1,
25 "DELIM", &delim1,
26 0,0};
27getcomm()
28{
29char line[200], *cp, nb[25], *t;
30struct optstr *lp;
31int c, ci, found;
32for(lp= options; lp->optnam; lp++)
33 *(lp->optadd) = 0;
34texname = texstr[texct=0];
35tab = '\t';
36printf(".nr %d \\n(.s\n", LSIZE);
37gets1(line);
38/* see if this is a command line */
39if (index(line,';') == NULL)
40 {
41 backrest(line);
42 return;
43 }
44for(cp=line; (c = *cp) != ';'; cp++)
45 {
46 if (!letter(c)) continue;
47 found=0;
48 for(lp= options; lp->optadd; lp++)
49 {
50 if (prefix(lp->optnam, cp))
51 {
52 *(lp->optadd) = 1;
53 cp += strlen(lp->optnam);
54 if (letter(*cp))
55 error("Misspelled global option");
56 while (*cp==' ')cp++;
57 t=nb;
58 if ( *cp == '(')
59 while ((ci= *++cp) != ')')
60 *t++ = ci;
61 else cp--;
62 *t++ = 0; *t=0;
63 if (lp->optadd == &tab)
64 {
65 if (nb[0])
66 *(lp->optadd) = nb[0];
67 }
68 if (lp->optadd == &linsize)
69 printf(".nr %d %s\n", LSIZE, nb);
70 if (lp->optadd == &delim1)
71 {
72 delim1 = nb[0];
73 delim2 = nb[1];
74 }
75 found=1;
76 break;
77 }
78 }
79 if (!found)
80 error("Illegal option");
81 }
82cp++;
83backrest(cp);
84return;
85}
86backrest(cp)
87 char *cp;
88{
89char *s;
90for(s=cp; *s; s++);
91un1getc('\n');
92while (s>cp)
93 un1getc(*--s);
94return;
95}