URI:
       ttc.c - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       ttc.c (1360B)
       ---
            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[256], 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                                         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 }
           56 
           57 
           58 int
           59 point(char *ss)
           60 {
           61         int        s = (int)(uintptr)ss;
           62         return(s >= 128 || s < 0);
           63 }