Bell 32V release
[unix-history] / usr / src / cmd / tbl / tc.c
CommitLineData
6554f91c
TL
1 /* tc.c: find character not in table to delimit fields */
2# include "t..c"
3choochar()
4{
5/* choose funny characters to delimit fields */
6int had[128], ilin,icol, k;
7char *s;
8for(icol=0; icol<128; icol++)
9 had[icol]=0;
10F1 = F2 = 0;
11for(ilin=0;ilin<nlin;ilin++)
12 {
13 if (instead[ilin]) continue;
14 if (fullbot[ilin]) continue;
15 for(icol=0; icol<ncol; icol++)
16 {
17 k = ctype(ilin, icol);
18 if (k==0 || k == '-' || k == '=')
19 continue;
20 s = table[ilin][icol].col;
21 if (point(s))
22 while (*s)
23 had[*s++]=1;
24 s=table[ilin][icol].rcol;
25 if (point(s))
26 while (*s)
27 had[*s++]=1;
28 }
29 }
30/* choose first funny character */
31for(
32 s="\002\003\005\006\007!%&#/?,:;<=>@`^~_{}+-*ABCDEFGHIJKMNOPQRSTUVWXYZabcdefgjkoqrstwxyz";
33 *s; s++)
34 {
35 if (had[*s]==0)
36 {
37 F1= *s;
38 had[F1]=1;
39 break;
40 }
41 }
42/* choose second funny character */
43for(
44 s="\002\003\005\006\007:_~^`@;,<=>#%&!/?{}+-*ABCDEFGHIJKMNOPQRSTUVWXZabcdefgjkoqrstuwxyz";
45 *s; s++)
46 {
47 if (had[*s]==0)
48 {
49 F2= *s;
50 break;
51 }
52 }
53if (F1==0 || F2==0)
54 error("couldn't find characters to use for delimiters");
55return;
56}
57point(s)
58{
59return(s>= 128 || s<0);
60}