home *** CD-ROM | disk | FTP | other *** search
/ The Programmer Disk / The Programmer Disk (Microforum).iso / xpro / c / pro14 / mkdesvec.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-04-02  |  768 b   |  26 lines

  1. #include "bm.h"
  2. /* #include <strings.h> */
  3. /* scan a newline-separated string of patterns and set up the
  4. * vector of descriptors, one pattern descriptor per pattern. 
  5. * Return the number of patterns */
  6. int
  7. MkDescVec(DescVec, Pats)
  8. struct PattDesc *DescVec[];
  9. char *Pats;
  10. {
  11.     int NPats = 0;
  12.     char *EndPat, *strchr();
  13.     extern struct PattDesc *MakeDesc();
  14.     while (*Pats && (EndPat = strchr(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.