home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d110 / pdc.lha / Pdc / lib / strcspn.c < prev    next >
Text File  |  1987-10-28  |  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.