home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 109.lha / PD_C / lib / strcspn.c < prev    next >
Text File  |  1986-11-20  |  597b  |  24 lines

  1. /*
  2.  * strcspn - find length of initial segment of s consisting entirely
  3.  * of characters not from reject
  4.  */
  5.  
  6. SIZET
  7. strcspn(s, reject)
  8. CONST char *s;
  9. CONST char *reject;
  10. {
  11.          register CONST char *scan;
  12.          register CONST char *rscan;
  13.          register SIZET count;
  14.  
  15.          count = 0;
  16.          for (scan = s; *scan != '\0'; scan++) {
  17.                    for (rscan = reject; *rscan != '\0';)   /* ++ moved down. */
  18.                              if (*scan == *rscan++)
  19.                                        return(count);
  20.                    count++;
  21.          }
  22.          return(count);
  23. }
  24.