home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / bm_src / mkdescve.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-16  |  682 b   |  26 lines

  1. #include "bm.h"
  2. /* scan a newline-separated string of patterns and set up the
  3. * vector of descriptors, one pattern descriptor per pattern. 
  4. * Return the number of patterns */
  5. int
  6. MkDescVec(DescVec, Pats)
  7. struct PattDesc *DescVec[];
  8. char *Pats;
  9. {
  10.     int NPats = 0;
  11.     char *EndPat;
  12.     extern struct PattDesc *MakeDesc();
  13. /* some systems use "strchr" instead of "index" */
  14.     while (*Pats && (EndPat = index(Pats,'\n')) && NPats < MAXPATS) {
  15.         *EndPat = '\0';
  16.         DescVec[NPats] = MakeDesc(Pats);
  17.         Pats = EndPat + 1;
  18.         ++NPats;
  19.     } /* while */
  20.     if (*Pats && NPats < MAXPATS) {
  21.         DescVec[NPats] = MakeDesc(Pats);
  22.         ++NPats;
  23.     } /* if */
  24.     return(NPats);
  25. } /* MkDescVec */
  26.