home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / LIB / unix.zoo / strcspn.c < prev    next >
Text File  |  2009-11-06  |  635b  |  28 lines

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