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