ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

strtok.c
Go to the documentation of this file.
00001 /* taken from wine string.c */
00002 
00003 #include <precomp.h>
00004 #include <internal/wine/msvcrt.h>
00005 
00006 /*********************************************************************
00007  *      strtok  (MSVCRT.@)
00008  */
00009 char * CDECL strtok( char *str, const char *delim )
00010 {
00011     thread_data_t *data = msvcrt_get_thread_data();
00012     char *ret;
00013 
00014     if (!str)
00015         if (!(str = data->strtok_next)) return NULL;
00016 
00017     while (*str && strchr( delim, *str )) str++;
00018     if (!*str) return NULL;
00019     ret = str++;
00020     while (*str && !strchr( delim, *str )) str++;
00021     if (*str) *str++ = 0;
00022     data->strtok_next = str;
00023     return ret;
00024 }
00025 
00026 /*********************************************************************
00027  *      strtok_s  (MSVCRT.@)
00028  */
00029 char * CDECL strtok_s(char *str, const char *delim, char **ctx)
00030 {
00031     if (!MSVCRT_CHECK_PMT(delim != NULL) || !MSVCRT_CHECK_PMT(ctx != NULL) ||
00032         !MSVCRT_CHECK_PMT(str != NULL || *ctx != NULL)) {
00033         *_errno() = EINVAL;
00034         return NULL;
00035     }
00036 
00037     if(!str)
00038         str = *ctx;
00039 
00040     while(*str && strchr(delim, *str))
00041         str++;
00042     if(!*str)
00043         return NULL;
00044 
00045     *ctx = str+1;
00046     while(**ctx && !strchr(delim, **ctx))
00047         (*ctx)++;
00048     if(**ctx)
00049         *(*ctx)++ = 0;
00050 
00051     return str;
00052 }

Generated on Sat May 26 2012 04:35:36 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.