Annotation of 3BSD/cmd/refer/hunt3.c, revision 1.1

1.1     ! root        1: # include "refer..c"
        !             2: getq(v)
        !             3:        char *v[];
        !             4: {
        !             5: # define BSIZ 250
        !             6: static char buff[BSIZ];
        !             7: static int eof = 0;
        !             8: extern char *sinput;
        !             9: char *p;
        !            10: int c, n = 0, las = 0;
        !            11: if (eof) return(-1);
        !            12: p = buff;
        !            13: while ( (c = (sinput ? *sinput++ : getchar()) ) > 0)
        !            14:        {
        !            15:        if (c== '\n')
        !            16:                break;
        !            17:        if (isalpha(c) || isdigit(c))
        !            18:                {
        !            19:                if (las==0)
        !            20:                        {
        !            21:                        v[n++] = p;
        !            22:                        las=1;
        !            23:                        }
        !            24:                if (las++ <= 6)
        !            25:                        *p++ = c;
        !            26:                }
        !            27:        else
        !            28:                {
        !            29:                if (las>0)
        !            30:                        *p++ = 0;
        !            31:                las=0;
        !            32:                }
        !            33:        }
        !            34: *p=0;
        !            35: assert(p<buff+BSIZ);
        !            36: if (sinput==0 && c<= 0) eof=1;
        !            37: # if D1
        !            38: fprintf(stderr, "no. keys %d\n",n);
        !            39: for(c=0; c<n; c++)
        !            40:  fprintf(stderr, "keys X%sX\n", v[c]);
        !            41: # endif
        !            42: return(n);
        !            43: }

unix.superglobalmegacorp.com

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