Blob


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