Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /* strtok( char *, const char * )
  2.  
  3.    This file is part of the Public Domain C Library (PDCLib).
  4.    Permission is granted to use, modify, and / or redistribute at will.
  5. */
  6.  
  7. #include <string.h>
  8.  
  9. char* strtok(char* s, const char* delim)
  10. {
  11.     static char* savep;
  12.     char* res;
  13.  
  14.     if(s)
  15.         savep = NULL;
  16.     else
  17.         s = savep;
  18.  
  19.     if (*s == '\0')
  20.         return NULL;
  21.         s += strspn(s, delim);
  22.         if (*s == '\0')
  23.                 return NULL;
  24.         res = s;
  25.         s += strcspn(s, delim);
  26.         savep = s + 1;
  27.         *s = '\0';
  28.         return res;
  29. }
  30.  
  31.