# 2.11BSD#431 - /usr/src/usr.bin/refer/hunt3.c

##### Functions

    getq              X

##### Macros

    BSIZ              X

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

#### Defined functions

getq defined in line 8; used 2 times

- in /usr/src/usr.bin/refer/glue1.c line 205
- in /usr/src/usr.bin/refer/hunt1.c line 167

#### Defined variables

sccsid defined in line 2; never used

#### Defined macros

BSIZ defined in line 6; used 4 times

- in line 11, 40-42(3)

Last modified: 1987-02-17 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 501 |