home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / palmos / pippy-0.6beta-src.tar.gz / pippy-0.6beta-src.tar / pippy-0.6beta-src / src / Palm / libc / strspn.c < prev    next >
C/C++ Source or Header  |  2000-12-21  |  468b  |  32 lines

  1. /*
  2.  *  linux/lib/string.c
  3.  *
  4.  *  Copyright (C) 1991, 1992  Linus Torvalds
  5.  */
  6.  
  7. #include <sys/types.h>
  8. #include <string.h>
  9. #include <ctype.h>
  10.  
  11. #ifndef __HAVE_ARCH_STRSPN
  12. size_t strspn(const char *s, const char *accept)
  13. {
  14.   const char *p;
  15.   const char *a;
  16.   size_t count = 0;
  17.   
  18.   for (p = s; *p != '\0'; ++p) {
  19.     for (a = accept; *a != '\0'; ++a) {
  20.       if (*p == *a)
  21.     break;
  22.     }
  23.     if (*a == '\0')
  24.       return count;
  25.     ++count;
  26.   }
  27.  
  28.   return count;
  29. }
  30. #endif
  31.  
  32.