strcspn.c 424 B

123456789101112131415161718192021
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* $Id$ */
  6. #include <string.h>
  7. size_t
  8. strcspn(const char *string, const char *notin)
  9. {
  10. register const char *s1, *s2;
  11. for (s1 = string; *s1; s1++) {
  12. for(s2 = notin; *s2 != *s1 && *s2; s2++)
  13. /* EMPTY */ ;
  14. if (*s2)
  15. break;
  16. }
  17. return s1 - string;
  18. }