1 /* tc.c: find character not in table to delimit fields */ 2 # include "t.h" 3 4 void 5 choochar(void) 6 { 7 /* choose funny characters to delimit fields */ 8 int had[128], ilin, icol, k; 9 char *s; 10 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 if((unsigned char)*s < 128) 27 had[(unsigned char)*s] = 1; 28 s++; 29 } 30 s = table[ilin][icol].rcol; 31 if (point(s)) 32 while (*s) { 33 if((unsigned char)*s < 128) 34 had[(unsigned char)*s] = 1; 35 s++; 36 } 37 } 38 } 39 /* choose first funny character */ 40 for ( 41 s = "\002\003\005\006\007!%&#/?,:;<=>@`^~_{}+-*ABCDEFGHIJKMNOPQRSTUVWXYZabcdefgjkoqrstwxyz"; 42 *s; s++) { 43 if (had[*s] == 0) { 44 F1 = *s; 45 had[F1] = 1; 46 break; 47 } 48 } 49 /* choose second funny character */ 50 for ( 51 s = "\002\003\005\006\007:_~^`@;,<=>#%&!/?{}+-*ABCDEFGHIJKMNOPQRSTUVWXZabcdefgjkoqrstuwxyz"; 52 *s; s++) { 53 if (had[*s] == 0) { 54 F2 = *s; 55 break; 56 } 57 } 58 if (F1 == 0 || F2 == 0) 59 error("couldn't find characters to use for delimiters"); 60 return; 61 } 62 63 int 64 point(char *ss) 65 { 66 int s = (int)(uintptr)ss; 67 68 return(s >= 128 || s < 0); 69 } 70