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 / strtok.c < prev    next >
C/C++ Source or Header  |  2000-12-21  |  563b  |  35 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_STRTOK
  12. char * ___strtok = NULL;
  13.  
  14. char * strtok(char * s,const char * ct)
  15. {
  16.   char *sbegin, *send;
  17.   
  18.   sbegin  = s ? s : ___strtok;
  19.   if (!sbegin) {
  20.     return NULL;
  21.   }
  22.   sbegin += strspn(sbegin,ct);
  23.   if (*sbegin == '\0') {
  24.     ___strtok = NULL;
  25.     return( NULL );
  26.   }
  27.   send = strpbrk( sbegin, ct);
  28.   if (send && *send != '\0')
  29.     *send++ = '\0';
  30.   ___strtok = send;
  31.   return (sbegin);
  32. }
  33. #endif
  34.  
  35.