Annotation of researchv9/cmd/tbl/tc.c, revision 1.1.1.1

1.1       root        1:  /* tc.c: find character not in table to delimit fields */
                      2: # include "t..c"
                      3: choochar()
                      4: {
                      5: /* choose funny characters to delimit fields */
                      6: int had[128], ilin,icol, k;
                      7: char *s;
                      8: for(icol=0; icol<128; icol++)
                      9:        had[icol]=0;
                     10: F1 = F2 = 0;
                     11: for(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 */
                     31: for(
                     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 */
                     43: for(
                     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:        }
                     53: if (F1==0 || F2==0)
                     54:        error("couldn't find characters to use for delimiters");
                     55: return;
                     56: }
                     57: point(s)
                     58: {
                     59: return(s>= 128 || s<0);
                     60: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.