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